Concurrency profiling with VS2010


I'm currently looking at the new concurrency profiling tools that come with Visual Studio 2010. It's interesting and useful stuff. The tools provide what I have attempted to develop in the past by using API Hooking but it's vastly superior in speed and functionality.

One of the big problems for me with my API Hooking concurrency tools (Deadlock detector and Lock Explorer) was that the instrumentation often caused the target process to run pretty slowly. There seems to be none of that with the concurrency tools in VS2010. The target process runs very nicely whilst it's being profiled and the tools then take a while to process the data after the profiling is complete.

The contention report is useful and the multi-threaded view of the process execution is also very useful. It's easy to spot major sources of contention and thread synchonisation (luckily so far the easy to spot culprit is my debug message dump; once that's removed there's hardly any contention when running my simple server under test, which is nice). Once again the MS STL is responsible for the hottest locks, I've fixed up my number to string conversion issues (see here) but there are still IMHO unnecessary and unexpected locks being held during some operations (iterators seem to all use a common mutex, for example). Obviously this may be something that can either be worked around or explained away once it's understood but I expect it will be interesting to compare the lock contention reports for a server built with MS STL and one built with STLPort.

Now, of course, I need to build a version of STLPort for VS2010...

Leave a comment