问题
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?
回答1:
This is available soon, currently shipping in Visual Studio 2010 beta 2. Here's a video of the tool.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/2169143/profiling-thread-sync-lock-contention