- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Everyone,
I am confused about how to use rdpmc instruction to read non-architectural events. For example, an event named CYCLE_ACTIVITY.STALLS_L2_PENDING with event number: A3H umask:05H, how to set ECX to read it? I know for the fixed-function performance counter, it is to set the 30th bit to be 1 and for others to be 0. But how to encode the specific event into ECX and read it through rdpmc instuction?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It sounds like you are getting the "fixed function counters" and the "architectural performance counter events" confused.
The fixed-function counters are the only core performance counters that can be used without programming a performance counter event select register (using a PERFEVTSEL MSR). The "fixed-function counters" each provide access to only one of the architectural performance counter events. The fixed function counters can be accessed either by their "fixed-function MSR" or by using the RDPMC instruction with the counter number set to (1<<30), (1<<30)+1, or (1<<30)+2.
The remainder of the "architectural" performance counter events have nothing to do with the fixed function counters, and must be programmed in exactly the same way as the "non-architectural" events. The difference with the "architectural" events is that they are expected to be carried forward to future systems.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The programming of the core performance counters is described in detail in Chapter 18 of Volume 3 of the Intel Architectures Software Developer's Manual.
The counters are programmed by writing to various control and configuration MSRs. All the MSRs you need to access and all the bit fields you need to program are described in Chapter 18 (except for the Event and Umask bits, which are described in Chapter 19). You will also need to refer to Chapter 35 to find out how to map the MSR name to an MSR number on your particular processor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John McCalpin wrote:
The programming of the core performance counters is described in detail in Chapter 18 of Volume 3 of the Intel Architectures Software Developer's Manual.
The counters are programmed by writing to various control and configuration MSRs. All the MSRs you need to access and all the bit fields you need to program are described in Chapter 18 (except for the Event and Umask bits, which are described in Chapter 19). You will also need to refer to Chapter 35 to find out how to map the MSR name to an MSR number on your particular processor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It sounds like you are getting the "fixed function counters" and the "architectural performance counter events" confused.
The fixed-function counters are the only core performance counters that can be used without programming a performance counter event select register (using a PERFEVTSEL MSR). The "fixed-function counters" each provide access to only one of the architectural performance counter events. The fixed function counters can be accessed either by their "fixed-function MSR" or by using the RDPMC instruction with the counter number set to (1<<30), (1<<30)+1, or (1<<30)+2.
The remainder of the "architectural" performance counter events have nothing to do with the fixed function counters, and must be programmed in exactly the same way as the "non-architectural" events. The difference with the "architectural" events is that they are expected to be carried forward to future systems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! I got it!
John McCalpin wrote:
It sounds like you are getting the "fixed function counters" and the "architectural performance counter events" confused.
The fixed-function counters are the only core performance counters that can be used without programming a performance counter event select register (using a PERFEVTSEL MSR). The "fixed-function counters" each provide access to only one of the architectural performance counter events. The fixed function counters can be accessed either by their "fixed-function MSR" or by using the RDPMC instruction with the counter number set to (1<<30), (1<<30)+1, or (1<<30)+2.
The remainder of the "architectural" performance counter events have nothing to do with the fixed function counters, and must be programmed in exactly the same way as the "non-architectural" events. The difference with the "architectural" events is that they are expected to be carried forward to future systems.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page