
2-39
2
PRELIMINARY
Performance Monitoring
2.8
Performance
Monitoring
Counters 1 and 2
The 48-bit Performance Monitoring Counters
(PMC) Registers MSR(12), MSR(13) count
events as specified by the counter event control
register.
The PMCs can be accessed by the RDMSR and
WRMSR instructions. In addition, the PMCs
can be read by the RDPMC instruction, opcode
0F33h. The RDPMC instruction loads the con-
tents of the PMC register specified in the ECX
register into EDX:EAX. The use of RDPMC in-
structions is restricted by the Performance Mon-
itoring Counter Enable, (PCE) flag in C4.
When the PCE flag is set to 1, the RDPMC in-
struction can be executed at any privilege level.
When the PCE flag is 0, the RDPMC instruction
can only be executed at privilege level 0.
2.8.1
Counter Event
Control Register
Register MSR(11) controls the two internal
counters, #0 and #1. The events to be counted
have been chosen based on the micro-architec-
ture of the M II processor. The control register
for the two event counters is described in
Figure 2-21 (Page 2-36) and Table 2-23 (Page
2-40).
2.8.1.1
PM Pin Control
The Counter Event Control register MSR(11)
contains PM control fields that define the PM0
and PM1 pins as counter overflow indicators or
counter event indicators. When defined as
event counters, the PM pins indicate that one or
more events occurred during a particular clock
cycle and do not count the actual events.
When defined as overflow indicators, the event
counters can be preset with a value less the
248-1 and allowed to increment as events occur.
When the counter overflows the PM pin be-
comes asserted.
2.8.1.2
Counter Type Control
The Counter Type bit determines whether the
counter will count clocks or events. When
counting clocks the counter operates as a timer.
2.8.1.3
CPL Control
The Current Privilege Level (CPL) can be used
to determine if the counters are enabled. The
CP02 bit in the MSR(11) register enables count-
ing when the CPL is less than three, and the
CP03 bit enables counting when CPL is equal to
three. If both bits are set, counting is not depen-
dent on the CPL level; if neither bit is set, count-
ing is disabled.