Udostępnij za pośrednictwem


How to: Collect CPU counter data

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

A CPU event counter is used to collect hardware-specific performance data. This article shows you how to collect event counter data when you use the instrumentation profiling method.

Two types of CPU counter events occur:

  • Portable events - CPU events that can be collected, regardless of the specific CPU.

  • Platform events - CPU events that are coupled to a specific CPU.

Portable events include general events, such as Instructions Retired and Non Halted Cycles, CPU buffer events, branching events, and L2 cache events. The available platform event counters are determined by the processor manufacturer.

Categories of events can be shared between portable and platform counters. For example, the following categories of data are frequently common to both types:

  • Memory events.

  • Front end events.

  • Branch events.

You can collect performance counter data in two ways in the profiler:

  • Collect data from one or more counters when you profile by instrumentation.

  • Specify a counter event as the sampling interval when you profile by sampling. For more information, see How to: Choose sampling events.

To collect CPU performance counter data when you profile by instrumentation

  1. On the performance session Property Pages, click CPU Counters.

  2. Select the Collect CPU Counters check box.

  3. Expand the Available performance counters tree until you find the sample events that you want to collect.

  4. For each event that you want to collect, select the event and then click the right arrow to add the event to the Selected Counters list.

    Note

    Available performance counters is enabled only if you select the Collect CPU counters check box.

See also

Configure performance sessions Performance session properties CPU and Windows counters How to: Choose sampling events