1 /* $Id: event_set_p6.c 37048 2009-11-12 21:44:56Z adam $
2 * Performance counter event descriptions for the Intel P6 family.
4 * Copyright (C) 2003-2004 Mikael Pettersson
8 * [IA32, Volume 3] "Intel Architecture Software Developer's Manual,
9 * Volume 3: System Programming Guide". Intel document number 25366813.
10 * (at http://developer.intel.com/)
12 #include <stddef.h> /* for NULL */
13 #include "libperfctr.h"
14 #include "event_set.h"
17 * Intel Pentium Pro events.
18 * Note that four L2 events were redefined in Pentium M.
21 static const struct perfctr_unit_mask_4 p6_um_mesi = {
22 { .type = perfctr_um_type_bitmask,
23 .default_value = 0x0F,
25 { { 0x08, "M (modified cache state)" },
26 { 0x04, "E (exclusive cache state)" },
27 { 0x02, "S (shared cache state)" },
28 { 0x01, "I (invalid cache state)" } }
31 static const struct perfctr_unit_mask_2 p6_um_ebl = {
32 { .type = perfctr_um_type_exclusive,
33 .default_value = 0x20,
35 { { 0x20, "transactions from any processor" },
36 { 0x00, "self-generated transactions" } }
39 static const struct perfctr_event p6_events[] = {
40 /* Data Cache Unit (DCU) */
41 { 0x43, 0x3, NULL, "DATA_MEM_REFS",
42 "All memory references, cachable and non" },
43 { 0x45, 0x3, NULL, "DCU_LINES_IN",
44 "Total lines allocated in the DCU" },
45 { 0x46, 0x3, NULL, "DCU_M_LINES_IN",
46 "Number of M state lines allocated in DCU" },
47 { 0x47, 0x3, NULL, "DCU_M_LINES_OUT",
48 "Number of M lines evicted from the DCU" },
49 { 0x48, 0x3, NULL, "DCU_MISS_OUTSTANDING",
50 "Number of cycles while DCU miss outstanding" },
51 /* Instruction Fetch Unit (IFU) */
52 { 0x80, 0x3, NULL, "IFU_IFETCH",
53 "Number of non/cachable instruction fetches" }, /* XXX: was IFU_FETCH */
54 { 0x81, 0x3, NULL, "IFU_IFETCH_MISS",
55 "Number of instruction fetch misses" }, /* XXX: was IFU_FETCH_MISS */
56 { 0x85, 0x3, NULL, "ITLB_MISS",
57 "Number of ITLB misses" },
58 { 0x86, 0x3, NULL, "IFU_MEM_STALL",
59 "Cycles instruction fetch pipe is stalled" },
60 { 0x87, 0x3, NULL, "ILD_STALL",
61 "Cycles instruction length decoder is stalled" },
63 { 0x28, 0x3, UM(p6_um_mesi), "L2_IFETCH",
64 "Number of L2 instruction fetches" },
65 { 0x2A, 0x3, UM(p6_um_mesi), "L2_ST",
66 "Number of L2 data stores" },
67 { 0x25, 0x3, NULL, "L2_M_LINES_INM",
68 "Number of modified lines allocated in L2" },
69 { 0x2E, 0x3, UM(p6_um_mesi), "L2_RQSTS",
70 "Number of L2 requests" },
71 { 0x21, 0x3, NULL, "L2_ADS",
72 "Number of L2 address strobes" },
73 { 0x22, 0x3, NULL, "L2_DBUS_BUSY",
74 "Number of cycles data bus was busy" },
75 { 0x23, 0x3, NULL, "L2_DBUS_BUSY_RD",
76 "Cycles data bus was busy in xfer from L2 to CPU" },
77 /* External Bus Logic (EBL) */
78 { 0x62, 0x3, UM(p6_um_ebl), "BUS_DRDY_CLOCKS",
79 "Number of clocks DRDY is asserted" },
80 { 0x63, 0x3, UM(p6_um_ebl), "BUS_LOCK_CLOCKS",
81 "Number of clocks LOCK is asserted" },
82 { 0x60, 0x3, NULL, "BUS_REQ_OUTSTANDING",
83 "Number of outstanding bus requests" },
84 { 0x65, 0x3, UM(p6_um_ebl), "BUS_TRAN_BRD",
85 "Number of burst read transactions" },
86 { 0x66, 0x3, UM(p6_um_ebl), "BUS_TRAN_RFO",
87 "Number of read for ownership transactions" },
88 { 0x67, 0x3, UM(p6_um_ebl), "BUS_TRANS_WB",
89 "Number of write back transactions" },
90 { 0x68, 0x3, UM(p6_um_ebl), "BUS_TRAN_IFETCH",
91 "Number of instruction fetch transactions" },
92 { 0x69, 0x3, UM(p6_um_ebl), "BUS_TRAN_INVAL",
93 "Number of invalidate transactions" },
94 { 0x6A, 0x3, UM(p6_um_ebl), "BUS_TRAN_PWR",
95 "Number of partial write transactions" },
96 { 0x6B, 0x3, UM(p6_um_ebl), "BUS_TRANS_P",
97 "Number of partial transactions" },
98 { 0x6C, 0x3, UM(p6_um_ebl), "BUS_TRANS_IO",
99 "Number of I/O transactions" },
100 { 0x6D, 0x3, UM(p6_um_ebl), "BUS_TRAN_DEF", 0 },
101 { 0x6E, 0x3, UM(p6_um_ebl), "BUS_TRAN_BURST",
102 "Number of burst transactions" },
103 { 0x70, 0x3, UM(p6_um_ebl), "BUS_TRAN_ANY",
104 "Number of all transactions" },
105 { 0x6F, 0x3, UM(p6_um_ebl), "BUS_TRAN_MEM",
106 "Number of memory transactions" },
107 { 0x64, 0x3, NULL, "BUS_DATA_RCV",
108 "Bus cycles this processor is receiving data" },
109 { 0x61, 0x3, NULL, "BUS_BNR_DRV",
110 "Bus cycles this processor is driving BNR pin" },
111 { 0x7A, 0x3, NULL, "BUS_HIT_DRV",
112 "Bus cycles this processor is driving HIT pin" },
113 { 0x7B, 0x3, NULL, "BUS_HITM_DRV",
114 "Bus cycles this processor is driving HITM pin" },
115 { 0x7E, 0x3, NULL, "BUS_SNOOP_STALL",
116 "Cycles during bus snoop stall" },
117 /* Floating-Point Unit */
118 { 0xC1, 0x1, NULL, "FLOPS",
119 "Number of computational FP operations executed" },
120 { 0x10, 0x1, NULL, "FP_COMP_OPS_EXE",
121 "Number of computational FP operations executed" },
122 { 0x11, 0x2, NULL, "FP_ASSIST",
123 "Number of FP exceptions handled by microcode" },
124 { 0x12, 0x2, NULL, "MUL",
125 "Number of multiplies" },
126 { 0x13, 0x2, NULL, "DIV",
127 "Number of divides" },
128 { 0x14, 0x1, NULL, "CYCLES_DIV_BUSY",
129 "Cycles divider is busy" },
130 /* Memory Ordering */
131 { 0x03, 0x3, NULL, "LD_BLOCKS",
132 "Number of store buffer blocks" },
133 { 0x04, 0x3, NULL, "SB_DRAINS",
134 "Number of store buffer drain cycles" },
135 { 0x05, 0x3, NULL, "MISALIGN_MEM_REF",
136 "Number of misaligned data memory references" },
137 /* Instruction Decoding and Retirement */
138 { 0xC0, 0x3, NULL, "INST_RETIRED",
139 "Number of instructions retired" },
140 { 0xC2, 0x3, NULL, "UOPS_RETIRED",
141 "Number of UOPs retired" },
142 { 0xD0, 0x3, NULL, "INST_DECODED",
143 "Number of instructions decoded" },
145 { 0xC8, 0x3, NULL, "HW_INT_RX",
146 "Number of hardware interrupts received" },
147 { 0xC6, 0x3, NULL, "CYCLES_INT_MASKED",
148 "Cycles interrupts are disabled" },
149 { 0xC7, 0x3, NULL, "CYCLES_INT_PENDING_AND_MASKED",
150 "Cycles interrupts are disabled with pending interrupts" },
152 { 0xC4, 0x3, NULL, "BR_INST_RETIRED",
153 "Number of branch instructions retired" },
154 { 0xC5, 0x3, NULL, "BR_MISS_PRED_RETIRED",
155 "Number of mispredicted branches retired" },
156 { 0xC9, 0x3, NULL, "BR_TAKEN_RETIRED",
157 "Number of taken branches retired" },
158 { 0xCA, 0x3, NULL, "BR_MISS_PRED_TAKEN_RET",
159 "Number of taken mispredictions branches retired" },
160 { 0xE0, 0x3, NULL, "BR_INST_DECODED",
161 "Number of branch instructions decoded" },
162 { 0xE2, 0x3, NULL, "BTB_MISSES",
163 "Number of branches that miss the BTB" },
164 { 0xE4, 0x3, NULL, "BR_BOGUS",
165 "Number of bogus branches" },
166 { 0xE6, 0x3, NULL, "BACLEARS",
167 "Number of times BACLEAR is asserted" },
169 { 0xA2, 0x3, NULL, "RESOURCE_STALLS",
170 "Cycles during resource related stalls" },
171 { 0xD2, 0x3, NULL, "PARTIAL_RAT_STALLS",
172 "Cycles or events for partial stalls" },
173 /* Segment Register Loads */
174 { 0x06, 0x3, NULL, "SEGMENT_REG_LOADS",
175 "Number of segment register loads" },
177 { 0x79, 0x3, NULL, "CPU_CLK_UNHALTED",
178 "Clocks processor is not halted" },
181 const struct perfctr_event_set p6_event_set = {
182 .cpu_type = PERFCTR_X86_INTEL_P6,
183 .event_prefix = "P6_",
185 .nevents = ARRAY_SIZE(p6_events),
189 static const struct perfctr_event ppro_events[] = {
191 { 0x29, 0x3, UM(p6_um_mesi), "L2_LD",
192 "Number of L2 data loads" }, /* redefined in Pentium M */
193 { 0x24, 0x3, NULL, "L2_LINES_IN",
194 "Number of allocated lines in L2" }, /* redefined in Pentium M */
195 { 0x26, 0x3, NULL, "L2_LINES_OUT",
196 "Number of recovered lines from L2" }, /* redefined in Pentium M */
197 { 0x27, 0x3, NULL, "L2_M_LINES_OUTM",
198 "Number of modified lines removed from L2" }, /* redefined in Pentium M */
201 const struct perfctr_event_set perfctr_ppro_event_set = {
202 .cpu_type = PERFCTR_X86_INTEL_P6,
203 .event_prefix = "P6_",
204 .include = &p6_event_set,
205 .nevents = ARRAY_SIZE(ppro_events),
206 .events = ppro_events,
210 * Intel Pentium II events.
211 * Note that two PII events (0xB0 and 0xCE) are unavailable in the PIII.
214 static const struct perfctr_unit_mask_0 p2_um_mmx_uops_exec = {
215 { .type = perfctr_um_type_fixed,
216 .default_value = 0x0F,
220 static const struct perfctr_unit_mask_6 p2_um_mmx_instr_type_exec = {
221 { .type = perfctr_um_type_bitmask,
222 .default_value = 0x3F,
224 { { 0x01, "MMX packed multiplies" },
225 { 0x02, "MMX packed shifts" },
226 { 0x04, "MMX pack operations" },
227 { 0x08, "MMX unpack operations" },
228 { 0x10, "MMX packed logical instructions" },
229 { 0x20, "MMX packed arithmetic instructions" } }
232 static const struct perfctr_unit_mask_2 p2_um_fp_mmx_trans = {
233 { .type = perfctr_um_type_exclusive,
234 .default_value = 0x00,
236 { { 0x00, "MMX to FP transitions" },
237 { 0x01, "FP to MMX transitions" } }
240 static const struct perfctr_unit_mask_4 p2_um_seg_reg_rename = {
241 { .type = perfctr_um_type_bitmask,
242 .default_value = 0x0F,
244 { { 0x01, "segment register ES" },
245 { 0x02, "segment register DS" },
246 { 0x04, "segment register FS" },
247 { 0x08, "segment register GS" } }
250 static const struct perfctr_event p2andp3_events[] = {
252 { 0xB1, 0x3, NULL, "MMX_SAT_INSTR_EXEC",
253 "Number of MMX saturating instructions executed" },
254 { 0xB2, 0x3, UM(p2_um_mmx_uops_exec), "MMX_UOPS_EXEC",
255 "Number of MMX UOPS executed" },
256 { 0xB3, 0x3, UM(p2_um_mmx_instr_type_exec), "MMX_INSTR_TYPE_EXEC",
257 "Number of MMX packing instructions" },
258 { 0xCC, 0x3, UM(p2_um_fp_mmx_trans), "FP_MMX_TRANS",
259 "MMX-floating point transitions" },
260 { 0xCD, 0x3, NULL, "MMX_ASSIST",
261 "Number of EMMS instructions executed" },
262 /* Segment Register Renaming */
263 { 0xD4, 0x3, UM(p2_um_seg_reg_rename), "SEG_RENAME_STALLS", 0 },
264 { 0xD5, 0x3, UM(p2_um_seg_reg_rename), "SEG_REG_RENAMES", 0 },
265 { 0xD6, 0x3, NULL, "RET_SEG_RENAMES", 0 },
268 static const struct perfctr_event_set p2andp3_event_set = {
269 .cpu_type = PERFCTR_X86_INTEL_PII,
270 .event_prefix = "PII_",
271 .include = &perfctr_ppro_event_set,
272 .nevents = ARRAY_SIZE(p2andp3_events),
273 .events = p2andp3_events,
276 static const struct perfctr_event p2_events[] = { /* not in PIII :-( */
278 { 0xB0, 0x3, NULL, "MMX_INSTR_EXEC", 0 },
279 { 0xCE, 0x3, NULL, "MMX_INSTR_RET",
280 "Number of MMX instructions retired" },
283 const struct perfctr_event_set perfctr_p2_event_set = {
284 .cpu_type = PERFCTR_X86_INTEL_PII,
285 .event_prefix = "PII_",
286 .include = &p2andp3_event_set,
287 .nevents = ARRAY_SIZE(p2_events),
292 * Intel Pentium III events.
293 * Note that the two KNI decoding events were redefined in Pentium M.
296 static const struct perfctr_unit_mask_4 p3_um_kni_prefetch = {
297 { .type = perfctr_um_type_exclusive,
298 .default_value = 0x00,
300 { { 0x00, "prefetch NTA" },
301 { 0x01, "prefetch T1" },
302 { 0x02, "prefetch T2" },
303 { 0x03, "weakly ordered stores" } }
306 static const struct perfctr_event p3_events_1[] = {
307 /* Memory Ordering */
308 { 0x07, 0x3, UM(p3_um_kni_prefetch), "EMON_KNI_PREF_DISPATCHED",
309 "Number of KNI pre-fetch/weakly ordered insns dispatched" },
310 { 0x4B, 0x3, UM(p3_um_kni_prefetch), "EMON_KNI_PREF_MISS",
311 "Number of KNI pre-fetch/weakly ordered insns that miss all caches" },
314 static const struct perfctr_event_set p3_event_set_1 = {
315 .cpu_type = PERFCTR_X86_INTEL_PIII,
316 .event_prefix = "PIII_",
317 .include = &p2andp3_event_set,
318 .nevents = ARRAY_SIZE(p3_events_1),
319 .events = p3_events_1,
322 static const struct perfctr_unit_mask_2 p3_um_kni_inst_retired = {
323 { .type = perfctr_um_type_exclusive,
324 .default_value = 0x00,
326 { { 0x00, "packed and scalar" },
330 static const struct perfctr_event p3_events_2[] = {
331 /* Instruction Decoding and Retirement */
332 { 0xD8, 0x3, UM(p3_um_kni_inst_retired), "EMON_KNI_INST_RETIRED",
333 "Number of KNI instructions retired" }, /* redefined in Pentium M */
334 { 0xD9, 0x3, UM(p3_um_kni_inst_retired), "EMON_KNI_COMP_INST_RET",
335 "Number of KNI computation instructions retired" }, /* redefined in Pentium M */
338 const struct perfctr_event_set perfctr_p3_event_set = {
339 .cpu_type = PERFCTR_X86_INTEL_PIII,
340 .event_prefix = "PIII_",
341 .include = &p3_event_set_1,
342 .nevents = ARRAY_SIZE(p3_events_2),
343 .events = p3_events_2,
347 * Intel Pentium M events.
348 * Note that six PPro/PIII events were redefined. To describe that
349 * we have to break up the PPro and PIII event sets, and assemble
350 * the Pentium M event set in several steps.
353 static const struct perfctr_unit_mask_6 pentm_um_mesi_prefetch = {
354 { .type = perfctr_um_type_bitmask,
355 .default_value = 0x0F,
357 /* XXX: how should we describe that bits 5-4 are a single field? */
358 { { 0x01, "I (invalid cache state)" },
359 { 0x02, "S (shared cache state)" },
360 { 0x04, "E (exclusive cache state)" },
361 { 0x08, "M (modified cache state)" },
362 /* Bits 5-4: 00: all but HW-prefetched lines, 01: only HW-prefetched
363 lines, 10/11: all lines */
364 { 0x10, "prefetch type bit 0" },
365 { 0x20, "prefetch type bit 1" } }
368 static const struct perfctr_unit_mask_2 pentm_um_est_trans = {
369 { .type = perfctr_um_type_exclusive,
370 .default_value = 0x00,
372 { { 0x00, "All transitions" },
373 { 0x02, "Only Frequency transitions" } }
376 static const struct perfctr_unit_mask_4 pentm_um_sse_inst_ret = {
377 { .type = perfctr_um_type_exclusive,
378 .default_value = 0x00,
380 { { 0x00, "SSE Packed Single and Scalar Single" },
381 { 0x01, "SSE Packed-Single" },
382 { 0x02, "SSE2 Packed-Double" },
383 { 0x03, "SSE2 Scalar-Double" } }
386 static const struct perfctr_unit_mask_4 pentm_um_sse_comp_inst_ret = {
387 { .type = perfctr_um_type_exclusive,
388 .default_value = 0x00,
390 { { 0x00, "SSE Packed Single" },
391 { 0x01, "SSE Scalar-Single" },
392 { 0x02, "SSE2 Packed-Double" },
393 { 0x03, "SSE2 Scalar-Double" } }
396 static const struct perfctr_unit_mask_3 pentm_um_fused_uops = {
397 { .type = perfctr_um_type_exclusive,
398 .default_value = 0x00,
400 { { 0x00, "All fused micro-ops" },
401 { 0x01, "Only load+Op micro-ops" },
402 { 0x02, "Only std+sta micro-ops" } }
405 static const struct perfctr_event pentm_events[] = {
407 { 0x24, 0x3, UM(pentm_um_mesi_prefetch), "L2_LINES_IN",
408 "Number of allocated lines in L2" }, /* redefined */
409 { 0x26, 0x3, UM(pentm_um_mesi_prefetch), "L2_LINES_OUT",
410 "Number of recovered lines from L2" }, /* redefined */
411 { 0x27, 0x3, UM(pentm_um_mesi_prefetch), "L2_M_LINES_OUT",
412 "Number of modified lines in L2, except hardware-prefetched" }, /* redefined */
413 { 0x29, 0x3, UM(pentm_um_mesi_prefetch), "L2_LD",
414 "Number of L2 data loads" }, /* redefined */
415 /* Power Management */
416 { 0x58, 0x3, UM(pentm_um_est_trans), "EMON_EST_TRANS",
417 "Number of SpeedStep(R) thermal transitions" },
418 { 0x59, 0x3, NULL, "EMON_THERMAL_TRIP", /*XXX: set bit 22(!?) for edge */
419 "Number of thermal trips (CPU temp exceeded 100C)" },
421 { 0x88, 0x3, NULL, "BR_INST_EXEC",
422 "All executed branches (not necessarily retired)" },
423 { 0x89, 0x3, NULL, "BR_MISSP_EXEC",
424 "Number of branch instruction mispredicted at execution" },
425 { 0x8A, 0x3, NULL, "BR_BAC_MISSP_EXEC",
426 "Number of branch instructions mispredicted at decoding" },
427 { 0x8B, 0x3, NULL, "BR_CND_EXEC",
428 "Number of conditional branch instructions executed" },
429 { 0x8C, 0x3, NULL, "BR_CND_MISSP_EXEC",
430 "Number of mispredicted conditional branch instructions executed" },
431 { 0x8D, 0x3, NULL, "BR_IND_EXEC",
432 "Number of indirect branch instructions executed" },
433 { 0x8E, 0x3, NULL, "BR_IND_MISSP_EXEC",
434 "Number of mispredicted indirect branch instructions executed" },
435 { 0x8F, 0x3, NULL, "BR_RET_EXEC",
436 "Number of return branch instructions executed" },
437 { 0x90, 0x3, NULL, "BR_RET_MISSP_EXEC",
438 "Number of mispredicted return branch instructions executed"},
439 { 0x91, 0x3, NULL, "BR_RET_BAC_MISSP_EXEC",
440 "Number of executed return branch instructions mispredicted at decoding" },
441 { 0x92, 0x3, NULL, "BR_CALL_EXEC",
442 "Number of function calls executed using CALL instruction" },
443 { 0x93, 0x3, NULL, "BR_CALL_MISSP_EXEC",
444 "Number of mispredicted CALL instructions executed" },
445 { 0x94, 0x3, NULL, "BR_IND_CALL_EXEC",
446 "Number of mispredicted indirect CALL instructions executed" },
448 { 0xCE, 0x3, NULL, "EMON_SIMD_INSTR_RETIRED",
449 "Number of SIMD instructions retired" },
450 { 0xD3, 0x3, NULL, "EMON_SYNCH_UOPS", 0 },
451 { 0xD7, 0x3, NULL, "EMON_ESP_UOPS", 0 },
452 { 0xD8, 0x3, UM(pentm_um_sse_inst_ret), "EMON_SSE_SSE2_INST_RETIRED",
453 "Number of SSE2 instructions retired" }, /* redefined */
454 { 0xD9, 0x3, UM(pentm_um_sse_comp_inst_ret), "EMON_SSE_SSE2_COMP_INST_RETIRED",
455 "Number of scalar-double SSE2 instructions retired" }, /* redefined */
456 { 0xDA, 0x3, UM(pentm_um_fused_uops), "EMON_FUSED_UOPS_RET",
457 "Number of fused UOPS retired" },
458 { 0xDB, 0x3, NULL, "EMON_UNFUSION", 0 },
460 { 0xF0, 0x3, NULL, "EMON_PREF_RQSTS_UP", 0 },
461 { 0xF8, 0x3, NULL, "EMON_PREF_RQSTS_DN", 0 },
464 const struct perfctr_event_set pentm_event_set_1 = {
465 .cpu_type = PERFCTR_X86_INTEL_PII,
466 .event_prefix = "PII_",
467 .include = &p6_event_set,
468 .nevents = ARRAY_SIZE(p2andp3_events),
469 .events = p2andp3_events,
472 const struct perfctr_event_set pentm_event_set_2 = {
473 .cpu_type = PERFCTR_X86_INTEL_PIII,
474 .event_prefix = "PIII_",
475 .include = &pentm_event_set_1,
476 .nevents = ARRAY_SIZE(p3_events_1),
477 .events = p3_events_1,
480 const struct perfctr_event_set perfctr_pentm_event_set = {
481 .cpu_type = PERFCTR_X86_INTEL_PENTM,
482 .event_prefix = "PENTM_",
483 .include = &pentm_event_set_2,
484 .nevents = ARRAY_SIZE(pentm_events),
485 .events = pentm_events,