Udostępnij za pośrednictwem


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

  1. Download Scenario.zip from Scenario Home Page on the MSDN Code Gallery Web site.

  2. Uncompress the file and note where the folder is created.

  3. 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.

  4. 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.

  5. Call the Begin method where you want to put the beginning marker.

  6. Call the End method where you want to put the end marker.

  7. 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.

See Also

Concepts

Concurrency Visualizer

Threads View (Parallel Performance)

Cores View

CPU Utilization View