Search Wiki:

Scenario Home Page


Description


A Scenario object is a highly-accurate timer that logs ETW events (Event Tracing for Windows) when you start and stop it. It's designed to be used for performance instrumentation and benchmarking, and comes in both C# and C++ versions.

Using a Scenario object is straightforward: simply create one, call Begin(), run the code that you want to benchmark, and then call End(). Between the calls to Begin() and End(), the Scenario object will track both elapsed time and thread-level CPU consumption using the most accurate available timers, and it will also log these times using ETW events. The ETW events can be post-processed by any ETW consumer, such as XPerf. Or you can ignore the event feature, and just read elapsed times directly from the fields of the Scenario object.

As a rule of thumb on modern hardware, a call to Begin() or End() takes on the order of a microsecond, and the resulting timestamps are accurate to 100ns (i.e. 0.1 microseconds).

Support and Distribution


The Scenario class is supported on Windows XP and above, although CPU time is only reported on Windows Vista and above. On XP it uses MOF-based ("classic") ETW events, while on Vista and above it uses XML-manifest ("Crimson") ETW events. Versions are available for both .NET 3.5 (written in C#), and native C++, and run on both x86 and x64 platforms. The Scenario class was originally developed using Visual Studio 2008, but is now targeted at developers using Visual Studio 2010.

How to Use It: The Basics


API - all of the methods and properties
Examples - code samples using the Scenario class
FAQ - answers to common questions and problems
Registration - how to register the ETW provider

How To Use It: Advanced


Best Practices - dos and don'ts for using Scenario objects
ETW Format - the payload fields in ETW events from Scenario objects

Feedback? Questions?


We want to hear both! Join in on the "Discussions" tab, or if you're feeling adventurous you can add a bug or feature request on the "Issue Tracker" tab.
Last edited Oct 12 2009 at 3:45 AM  by JonathanH, version 11
Comments
AdeMiller wrote  Aug 15 2010 at 4:54 PM  
It's worth mentioning that scenario markers are also supported within the VS Profiler.

Scenario Marker Support
http://msdn.microsoft.com/en-us/library/dd984115.aspx

Updating...
Page view tracker