Beginner's Guide to Profiling Parallel Apps Part IV

Welcome to fourth and final installment of the "beginner's guide" series.  In my previous entry, I discussed the "Threads" view of the Concurrency Visualizer.  In this entry, I will discuss the "Cores" view.

Using the same set of results as the previous entries, I now navigate to the "Cores" view to find this:

image

This view shows time along the x-axis and each logical core along the y-axis.  While the CPU Utilization view provides no information regarding thread affinity, this view presents just that.  The legend on the lower-half of the screen illustrates the mapping between colors and threads along with statistics which give insight into context switches.  The chart on the upper-half of the screen tells you which threads were running on each logical core at any given moment in time.  For example, the legend shows that thread with id 2880 is represented by purple.  Looking at the chart above, I can see that this thread ran on logical core 1 for approximately 4 ms.

By comparing the thread ids listed in the table to the thread ids shown in the threads view, I can see that the four threads which I created rarely cross cores. In fact, only one of the four worker threads, with id 4480, crosses cores. It’s also interesting to see that the percent of context switches for this thread was only 5.62%. All of this is very useful information but doesn’t help me to investigate my assumption as to the cause of preemption. As shown in the CPU Utilization and Threads views, the preemption results from other processes using the CPU.

This view is particularly useful when managing your own thread affinity as it can help to diagnose thread scheduling bugs.  If you aren't managing thread affinity, it can be informative (as we saw in this case) but may not always be actionable.

This concludes the "beginner's guide" series!  I hope you found these helpful and I encourage you to go download Visual Studio 2010 beta 2 and try this tool out for yourself!

James Rapp - Parallel Computing Platform