分析线程同步锁争用
过去,我使用过 nprof、Equatec profiler 和 Yourkit profiler 等性能分析工具来识别和消除/减少主要在一个线程(串行执行)中运行的代码中的性能瓶颈。现在我写了很多多线程代码,这些代码会因为锁争用而减慢速度;可以使用哪些工具和技巧来识别锁争用发生的位置以及程度?
In the past I've used performance profiling tools such as nprof, Equatec profiler and Yourkit profiler to identify and remove/reduce performance bottlenecks in code mostly running in one thread (serialized execution). Nowadays I write a lot of multi-threaded code which can be slowed down by lock contention; what tools and tricks can be used to identify where lock contention is occuring and by how much?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该功能即将推出,目前在 Visual Studio 2010 beta 2 中提供。这是 该工具的视频。告诉您如何下载和安装并发可视化工具的登录页面为 目前在这里。
This is available soon, currently shipping in Visual Studio 2010 beta 2. Here's a video of the tool. The landing page that tells you how to download and install the concurrency visualizer is currently here.
尝试使用英特尔的 ThreadChecker。它可以在 Windows 和 Linux 上运行。如果您使用的是 Windows,请尝试 Parallel Studio。它提供了一个易于使用的锁定和等待分析器。它显示了运行时期间的总体并发性,这给出了有关锁争用和并发性差的提示。这些工具现在正在做您想要的事情。
Try ThreadChecker from Intel. It works on both Windows and Linux. If you're working on Windows, then try Parallel Studio. It provides a easy-to-use locks-and-waits profiler. It shows overall concurrency during the runtime, which gives hints on lock contentions and poor concurrency. The tools are doing right now what you want.
对于在 Windows 上进行开发,软件验证有一些 (http://www.softwareverify.com/thread.html)。
对于 C、C++、Delphi,请尝试线程验证器。
对于Java,还有Java Thread Validator。
还有 Python 和 Ruby 的实验版本。
For developing on Windows, Software Verification have some (http://www.softwareverify.com/thread.html).
For C, C++, Delphi try Thread Validator.
For Java, there is also Java Thread Validator.
There are also experimental versions for Python and Ruby.