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:
Front end 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.
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.
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
In the Property Pages, click Sampling.
Select the Performance counter data from the Sample event drop-down list.
Expand the Available performance counters tree until you find the sample event you want to use when you profile your application.
Click the sample event.
Available performance counters is enabled only if you choose Performance counter data in the Sample event drop-down list.
To collect CPU performance counter data when profiling by instrumentation
In the Property Pages, click CPU Counters.
Select the Collect CPU Counters check box.
Expand the Available performance counters tree until you find the sample events you want to collect.
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.
Available performance counters is enabled only if you select the Collect CPU counters check box.