Bagikan melalui


How to: Collect CPU Counter Data

A CPU event counter is used to collect hardware-specific performance data. There are two types of CPU counter events:

  • 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, such as ITLB misses, 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 that 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:

  • Specify a counter event as the sampling interval when profiling by sampling.

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

Sampling

By default, the Profiling Tools collects performance data at an interval specified as a number of processor cycles used by the profiled process. The default number of cycles in an interval is 10,000,000 cycles, which is approximately 0.01 seconds on a 1 GH computer.You can specify another CPU performance counter to use as the sample event when collecting application statistics.

Important noteImportant Note:

If you are collecting .NET memory data or thread contention data using the sampling method, all user-specified sampling events are ignored and the appropriate collection events are used instead.

To specify a CPU counter event as the sampling interval

  1. In the Property Pages, click Sampling.

  2. Select the Performance counter data from the Sample event drop-down list.

  3. Expand the Available performance counters tree until you find the sample event you want to use when you profile your application.

  4. Click the sample event.

    Note

    Available performance counters is enabled only if you choose Performance counter data in the Sample event drop-down list.

Instrumentation

To collect CPU performance counter data when profiling by instrumentation

  1. In the 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 you want to collect.

  4. For each event that you want to collect, select the event and 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

Tasks

How to: Choose Sampling Events

Concepts

Performance Session Properties

CPU and Windows Counters in Profiling Tools

Other Resources

Configuring Performance Sessions for Profiling Tools