Tutorial 13 - Leveraging Tasks make sense of Parallel/Asynchronous programs
- Posted: Nov 29, 2012 at 6:26 AM
- 3,790 Views
Right click “Save as…”
This is the second of a set of video tutorials on how to do wall clock time investigations with PerfView. It is best to watch the video using one of the high quality links on the right so the text is readable. If you have not already watched the video on wall clock time basics, you should do that first (as well as the even more fundamental videos it will refer you to).
In the first video the demo was the simplest case, a sequential program with both disk and CPU time. In this video we discuss the more complex case when there are several threads doing concurrent activity that you wish to analyze.
The key PerfView feature that helps in cases like these is the 'Thread Time (with Tasks)', but only works if you use the System.Diagnostics.Threading.Tasks.Task class to spawn the concurrent activities. In this view if one Task spawns another, the time associated with the subtask is attributed to the point at which the new Task was created. Thus even though the work might be done on another thread, the cost is 'rolled up' based on the code that requested that that action be done. This allows concurrent applications to be analyzed like the simple sequential case (where the cost of calling a routine is attributed to the routine that called it).
There is a companion perfView blog entries that you may be interested in. In particular there is a ZIP file of source code and data used in this tutorial, so that you can explore this data and 'follow along' yourself with what was done in this video. To use the zip file simply open it, and drag the directory inside to your desktop (or other location). The file contains the EXE and PDB (symbol file), the complete VS2012 source (in the src directory) as well as the BlockedTimeParallel.ETL.ZIP file (The data file used in this video) You don't need to unzip this file, simply open it in PerfView.
You may be interested in the entire PerfView Tutorial video series,