Scenario Marker Support
The Scenario class is a free download on the MSDN Code Gallery Web site. By using Scenario, you can mark the exact beginning and ending points of a section of code that you want to profile. Concurrency Visualizer displays these markers in Threads View, Cores View, and CPU Utilization View. To display the name that you gave the marker, rest the pointer on its horizontal bar.
Concurrency Visualizer supports Scenario markers in both native code and managed code, subject to the following conditions:
The Scenario.Begin, Scenario.BeginNew, and Scenario.End methods are supported. The Scenario.Mark and Scenario.Step methods are not supported.
Scenario markers that have a Nest Level greater than zero are not supported.
One active Scenario instance per thread is tracked. If a Scenario.Begin event is received when a Scenario instance is already active, Concurrency Visualizer will overwrite the old value with the new value. An active Scenario instance will be closed on the first Scenario.End call in the thread, regardless of the Scenario instance it came from.
To add Scenario markers to code
Download Scenario.zip from Scenario Home Page on the MSDN Code Gallery Web site.
Uncompress the file and note where the folder is created.
In your Visual Studio project, add a reference to the appropriate Scenario native or managed .dll file. x86 and x64 versions are provided for both Visual Studio 2008 and Visual Studio 2010.
In managed code, add a using or Imports statement for the Scenario namespace.
In native code, add the Scenario.h file, which is located in the \native\ folder.
Create an instance of the Scenario class on every thread that you want to mark. Use the constructor to add a name for the marker so that it will appear in Concurrency Visualizer.
Call the Begin method where you want to put the beginning marker.
Call the End method where you want to put the end marker.
Run Concurrency Visualizer. The markers should appear in the various views.
For more information about the Scenario class, see the documentation on the Scenario Home Page.