We recommend using Visual Studio 2017

Collecting Performance Statistics by Using Sampling


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Collecting Performance Statistics by Using Sampling.

By default, the Visual Studio Premium Profiling Tools sampling method collects profiling information every 10,000,000 processor cycles (approximately every one-hundredth of a second on a 1 GHz computer). The sampling method is useful for finding processor utilization issues and is the suggested method for starting most performance investigations.


  • Visual Studio Ultimate, Visual Studio Premium, Visual Studio Professional
System_CAPS_ICON_note.jpg Note

Enhanced security features in Windows 8 and Windows Server 2012 required significant changes in the way the Visual Studio profiler collects data on these platforms. Windows Store apps also require new collection techniques. See Performance Tools on Windows 8 and Windows Server 2012 applications.

You can specify the sampling method by using one of the following procedures:

  • On the first page of the Profiling Wizard, click CPU Sampling (recommended).

  • On the Performance Explorer toolbar, in the Method list, click Sampling.

  • On the General page of the properties dialog box for the performance session, click Sampling.

You can specify additional options in the Performance SessionProperty Pages dialog box of the performance session. To open this dialog box:

  • In Performance Explorer, right-click the performance session name, and then click Properties.

The tasks in the following table describe options that you can specify in the Performance SessionProperty Pages dialog box when you profile by using the sampling method.

TaskRelated Content
On the General page, add .NET memory allocation and lifetime data collection, and specify naming details for the generated profiling data (.vsp) file.- Collecting .NET Memory Allocation and Lifetime Data
- How to: Set Performance Data File Name Options
On the Sampling page, change the sampling rate, change the sampling event from processor clock cycles to another processor performance counter, or change both..- How to: Choose Sampling Events
On the Launch page, specify the application to start and the start order if you have multiple .exe projects in your code solution.- Collecting tier interaction data
On the Tier Interaction page, add ADO.NET call information to to the data collected in theprofiling run.- Collecting tier interaction data
On the Windows Events page, specify one or more Event Tracing for Windows (ETW) events to collect with the sampling data.- How to: Collect Event Tracing for Windows (ETW) Data
On the Windows Counters page, specify one or more operating system performance counters to add to the profiling data as marks.- How to: Collect Windows Counter Data
On the Advanced page, specify the version of the .NET Framework runtime to profile if your application modules use multiple versions. By default, the first version loaded is profiled.- How to: Specify the .NET Framework Runtime