Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
Vol. 3 18-97
DEBUGGING AND PERFORMANCE MONITORING
2. The OS and USR flags in the ESCR selected the privilege levels at which events
will be counted.
3. The ESCR select field of the CCCR selects the ESCR. Since each counter has
several ESCRs associated with it, one ESCR must be chosen to select the classes
of events that may be counted.
4. The compare and complement flags and the threshold field of the CCCR select an
optional threshold to be used in qualifying an event count.
5. The edge flag in the CCCR allows events to be counted only on rising-edge transi-
tions.
The qualification order in the above list implies that the filtered output of one “stage”
forms the input for the next. For instance, events filtered using the privilege level
flags can be further qualified by the compare and complement flags and the
threshold field, and an event that matched the threshold criteria, can be further qual-
ified by edge detection.
The uses of the flags and fields in the CCCRs are discussed in greater detail in Section
18.18.6, “Programming the Performance Counters for Non-Retirement Events.
18.18.4 Debug Store (DS) Mechanism
The debug store (DS) mechanism was introduced in the Pentium 4 and Intel Xeon
processors to allow various types of information to be collected in memory-resident
buffers for use in debugging and tuning programs. For the Pentium 4 and Intel Xeon
processors, the DS mechanism is used to collect two types of information: branch
records and precise event-based sampling (PEBS) records. The availability of the DS
mechanism in a processor is indicated with the DS feature flag (bit 21) returned by
the CPUID instruction.
See Section 18.7.8, “Branch Trace Store (BTS),” and Section 18.18.8, “Precise Event-
Based Sampling (PEBS),” for a description of these facilities. Records collected with
the DS mechanism are saved in the DS save area. See Section 18.18.5, “DS Save
Area.
18.18.5 DS Save Area
The debug store (DS) save area is a software-designated area of memory that is
used to collect the following two types of information:
Branch records — When the BTS flag in the MSR_DEBUGCTLA MSR is set, a
branch record is stored in the BTS buffer in the DS save area whenever a taken
branch, interrupt, or exception is detected.
PEBS records — When a performance counter is configured for PEBS, a PEBS
record is stored in the PEBS buffer in the DS save area after the counter overflow
occurs. This record contains the architectural state of the processor (state of the
8 general purpose registers, EIP register, and EFLAGS register) at the next