xref: /freebsd/sys/dev/hwpmc/pmc_events.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*-
2  * Copyright (c) 2005  Joseph Koshy
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _DEV_HWPMC_PMC_EVENTS_H_
30 #define	_DEV_HWPMC_PMC_EVENTS_H_
31 
32 /*
33  * PMC event codes.
34  *
35  * __PMC_EV(CLASS, SYMBOLIC-NAME, VALUE, READABLE-NAME)
36  *
37  */
38 
39 /*
40  * AMD K7 Events, from "The AMD Athlon(tm) Processor x86 Code
41  * Optimization Guide" [Doc#22007K, Feb 2002]
42  */
43 
44 #define	__PMC_EV_K7()							\
45 __PMC_EV(K7, DC_ACCESSES,		k7-dc-accesses)			\
46 __PMC_EV(K7, DC_MISSES,			k7-dc-misses)			\
47 __PMC_EV(K7, DC_REFILLS_FROM_L2,	k7-dc-refills-from-l2)		\
48 __PMC_EV(K7, DC_REFILLS_FROM_SYSTEM,	k7-dc-refills-from-system)	\
49 __PMC_EV(K7, DC_WRITEBACKS,		k7-dc-writebacks)		\
50 __PMC_EV(K7, L1_DTLB_MISS_AND_L2_DTLB_HITS,				\
51 			k7-l1-dtlb-miss-and-l2-dtlb-hits)		\
52 __PMC_EV(K7, L1_AND_L2_DTLB_MISSES,	k7-l1-and-l2-dtlb-misses)	\
53 __PMC_EV(K7, MISALIGNED_REFERENCES,	k7-misaligned-references)	\
54 __PMC_EV(K7, IC_FETCHES,		k7-ic-fetches)			\
55 __PMC_EV(K7, IC_MISSES,			k7-ic-misses)			\
56 __PMC_EV(K7, L1_ITLB_MISSES,		k7-l1-itlb-misses)		\
57 __PMC_EV(K7, L1_L2_ITLB_MISSES,		k7-l1-l2-itlb-misses)		\
58 __PMC_EV(K7, RETIRED_INSTRUCTIONS,	k7-retired-instructions)	\
59 __PMC_EV(K7, RETIRED_OPS,		k7-retired-ops)			\
60 __PMC_EV(K7, RETIRED_BRANCHES,		k7-retired-branches)		\
61 __PMC_EV(K7, RETIRED_BRANCHES_MISPREDICTED,				\
62 			k7-retired-branches-mispredicted)		\
63 __PMC_EV(K7, RETIRED_TAKEN_BRANCHES,	k7-retired-taken-branches)	\
64 __PMC_EV(K7, RETIRED_TAKEN_BRANCHES_MISPREDICTED,			\
65 			k7-retired-taken-branches-mispredicted)		\
66 __PMC_EV(K7, RETIRED_FAR_CONTROL_TRANSFERS,				\
67 			k7-retired-far-control-transfers)		\
68 __PMC_EV(K7, RETIRED_RESYNC_BRANCHES, k7-retired-resync-branches)	\
69 __PMC_EV(K7, INTERRUPTS_MASKED_CYCLES, k7-interrupts-masked-cycles)	\
70 __PMC_EV(K7, INTERRUPTS_MASKED_WHILE_PENDING_CYCLES,			\
71 			k7-interrupts-masked-while-pending-cycles)	\
72 __PMC_EV(K7, HARDWARE_INTERRUPTS,	k7-hardware-interrupts)
73 
74 #define	PMC_EV_K7_FIRST	PMC_EV_K7_DC_ACCESSES
75 #define	PMC_EV_K7_LAST	PMC_EV_K7_HARDWARE_INTERRUPTS
76 
77 /*
78  * Intel P4 Events, from "IA-32 Intel(r) Architecture Software
79  * Developer's Manual, Volume 3: System Programming Guide" [245472-012]
80  */
81 
82 #define	__PMC_EV_P4()							\
83 __PMC_EV(P4, TC_DELIVER_MODE,		p4-tc-deliver-mode)		\
84 __PMC_EV(P4, BPU_FETCH_REQUEST,		p4-bpu-fetch-request)		\
85 __PMC_EV(P4, ITLB_REFERENCE,		p4-itlb-reference)		\
86 __PMC_EV(P4, MEMORY_CANCEL,		p4-memory-cancel)		\
87 __PMC_EV(P4, MEMORY_COMPLETE,		p4-memory-complete)		\
88 __PMC_EV(P4, LOAD_PORT_REPLAY,		p4-load-port-replay)		\
89 __PMC_EV(P4, STORE_PORT_REPLAY,		p4-store-port-replay)		\
90 __PMC_EV(P4, MOB_LOAD_REPLAY,		p4-mob-load-replay)		\
91 __PMC_EV(P4, PAGE_WALK_TYPE,		p4-page-walk-type)		\
92 __PMC_EV(P4, BSQ_CACHE_REFERENCE,	p4-bsq-cache-reference)		\
93 __PMC_EV(P4, IOQ_ALLOCATION,		p4-ioq-allocation)		\
94 __PMC_EV(P4, IOQ_ACTIVE_ENTRIES,	p4-ioq-active-entries)		\
95 __PMC_EV(P4, FSB_DATA_ACTIVITY,		p4-fsb-data-activity)		\
96 __PMC_EV(P4, BSQ_ALLOCATION,		p4-bsq-allocation)		\
97 __PMC_EV(P4, BSQ_ACTIVE_ENTRIES,	p4-bsq-active-entries)		\
98 __PMC_EV(P4, SSE_INPUT_ASSIST,		p4-sse-input-assist)		\
99 __PMC_EV(P4, PACKED_SP_UOP,		p4-packed-sp-uop)		\
100 __PMC_EV(P4, PACKED_DP_UOP,		p4-packed-dp-uop)		\
101 __PMC_EV(P4, SCALAR_SP_UOP,		p4-scalar-sp-uop)		\
102 __PMC_EV(P4, SCALAR_DP_UOP,		p4-scalar-dp-uop)		\
103 __PMC_EV(P4, 64BIT_MMX_UOP,		p4-64bit-mmx-uop)		\
104 __PMC_EV(P4, 128BIT_MMX_UOP,		p4-128bit-mmx-uop)		\
105 __PMC_EV(P4, X87_FP_UOP,		p4-x87-fp-uop)			\
106 __PMC_EV(P4, X87_SIMD_MOVES_UOP,	p4-x87-simd-moves-uop)		\
107 __PMC_EV(P4, GLOBAL_POWER_EVENTS,	p4-global-power-events)		\
108 __PMC_EV(P4, TC_MS_XFER,		p4-tc-ms-xfer)			\
109 __PMC_EV(P4, UOP_QUEUE_WRITES,		p4-uop-queue-writes)		\
110 __PMC_EV(P4, RETIRED_MISPRED_BRANCH_TYPE,				\
111 			    p4-retired-mispred-branch-type)		\
112 __PMC_EV(P4, RETIRED_BRANCH_TYPE,	p4-retired-branch-type)		\
113 __PMC_EV(P4, RESOURCE_STALL,		p4-resource-stall)		\
114 __PMC_EV(P4, WC_BUFFER,			p4-wc-buffer)			\
115 __PMC_EV(P4, B2B_CYCLES,		p4-b2b-cycles)			\
116 __PMC_EV(P4, BNR,			p4-bnr)				\
117 __PMC_EV(P4, SNOOP,			p4-snoop)			\
118 __PMC_EV(P4, RESPONSE,			p4-response)			\
119 __PMC_EV(P4, FRONT_END_EVENT,		p4-front-end-event)		\
120 __PMC_EV(P4, EXECUTION_EVENT,		p4-execution-event)		\
121 __PMC_EV(P4, REPLAY_EVENT,		p4-replay-event)		\
122 __PMC_EV(P4, INSTR_RETIRED,		p4-instr-retired)		\
123 __PMC_EV(P4, UOPS_RETIRED,		p4-uops-retired)		\
124 __PMC_EV(P4, UOP_TYPE,			p4-uop-type)			\
125 __PMC_EV(P4, BRANCH_RETIRED,		p4-branch-retired)		\
126 __PMC_EV(P4, MISPRED_BRANCH_RETIRED,	p4-mispred-branch-retired)	\
127 __PMC_EV(P4, X87_ASSIST,		p4-x87-assist)			\
128 __PMC_EV(P4, MACHINE_CLEAR,		p4-machine-clear)
129 
130 #define	PMC_EV_P4_FIRST PMC_EV_P4_TC_DELIVER_MODE
131 #define	PMC_EV_P4_LAST	PMC_EV_P4_MACHINE_CLEAR
132 
133 /* Intel Pentium Pro, P-II, P-III and Pentium-M style events */
134 
135 #define	__PMC_EV_P6()							\
136 __PMC_EV(P6, DATA_MEM_REFS,		p6-data-mem-refs)		\
137 __PMC_EV(P6, DCU_LINES_IN,		p6-dcu-lines-in)		\
138 __PMC_EV(P6, DCU_M_LINES_IN,		p6-dcu-m-lines-in)		\
139 __PMC_EV(P6, DCU_M_LINES_OUT,		p6-dcu-m-lines-out)		\
140 __PMC_EV(P6, DCU_MISS_OUTSTANDING,	p6-dcu-miss-outstanding)	\
141 __PMC_EV(P6, IFU_FETCH,			p6-ifu-fetch)			\
142 __PMC_EV(P6, IFU_FETCH_MISS,		p6-ifu-fetch-miss)		\
143 __PMC_EV(P6, ITLB_MISS,			p6-itlb-miss)			\
144 __PMC_EV(P6, IFU_MEM_STALL,		p6-ifu-mem-stall)		\
145 __PMC_EV(P6, ILD_STALL,			p6-ild-stall)			\
146 __PMC_EV(P6, L2_IFETCH,			p6-l2-ifetch)			\
147 __PMC_EV(P6, L2_LD,			p6-l2-ld)			\
148 __PMC_EV(P6, L2_ST,			p6-l2-st)			\
149 __PMC_EV(P6, L2_LINES_IN,		p6-l2-lines-in)			\
150 __PMC_EV(P6, L2_LINES_OUT,		p6-l2-lines-out)		\
151 __PMC_EV(P6, L2_M_LINES_INM,		p6-l2-m-lines-inm)		\
152 __PMC_EV(P6, L2_M_LINES_OUTM,		p6-l2-m-lines-outm)		\
153 __PMC_EV(P6, L2_RQSTS,			p6-l2-rqsts)			\
154 __PMC_EV(P6, L2_ADS,			p6-l2-ads)			\
155 __PMC_EV(P6, L2_DBUS_BUSY,		p6-l2-dbus-busy)		\
156 __PMC_EV(P6, L2_DBUS_BUSY_RD,		p6-l2-dbus-busy-rd)		\
157 __PMC_EV(P6, BUS_DRDY_CLOCKS,		p6-bus-drdy-clocks)		\
158 __PMC_EV(P6, BUS_LOCK_CLOCKS,		p6-bus-lock-clocks)		\
159 __PMC_EV(P6, BUS_REQ_OUTSTANDING,	p6-bus-req-outstanding)		\
160 __PMC_EV(P6, BUS_TRAN_BRD,		p6-bus-tran-brd)		\
161 __PMC_EV(P6, BUS_TRAN_RFO,		p6-bus-tran-rfo)		\
162 __PMC_EV(P6, BUS_TRANS_WB,		p6-bus-trans-wb)		\
163 __PMC_EV(P6, BUS_TRAN_IFETCH,		p6-bus-tran-ifetch)		\
164 __PMC_EV(P6, BUS_TRAN_INVAL,		p6-bus-tran-inval)		\
165 __PMC_EV(P6, BUS_TRAN_PWR,		p6-bus-tran-pwr)		\
166 __PMC_EV(P6, BUS_TRANS_P,		p6-bus-trans-p)			\
167 __PMC_EV(P6, BUS_TRANS_IO,		p6-bus-trans-io)		\
168 __PMC_EV(P6, BUS_TRAN_DEF,		p6-bus-tran-def)		\
169 __PMC_EV(P6, BUS_TRAN_BURST,		p6-bus-tran-burst)		\
170 __PMC_EV(P6, BUS_TRAN_ANY,		p6-bus-tran-any)		\
171 __PMC_EV(P6, BUS_TRAN_MEM,		p6-bus-tran-mem)		\
172 __PMC_EV(P6, BUS_DATA_RCV,		p6-bus-data-rcv)		\
173 __PMC_EV(P6, BUS_BNR_DRV,		p6-bus-bnr-drv)			\
174 __PMC_EV(P6, BUS_HIT_DRV,		p6-bus-hit-drv)			\
175 __PMC_EV(P6, BUS_HITM_DRV,		p6-bus-hitm-drv)		\
176 __PMC_EV(P6, BUS_SNOOP_STALL,		p6-bus-snoop-stall)		\
177 __PMC_EV(P6, FLOPS,			p6-flops)			\
178 __PMC_EV(P6, FP_COMPS_OPS_EXE,		p6-fp-comps-ops-exe)		\
179 __PMC_EV(P6, FP_ASSIST,			p6-fp-assist)			\
180 __PMC_EV(P6, MUL,			p6-mul)				\
181 __PMC_EV(P6, DIV,			p6-div)				\
182 __PMC_EV(P6, CYCLES_DIV_BUSY,		p6-cycles-div-busy)		\
183 __PMC_EV(P6, LD_BLOCKS,			p6-ld-blocks)			\
184 __PMC_EV(P6, SB_DRAINS,			p6-sb-drains)			\
185 __PMC_EV(P6, MISALIGN_MEM_REF,		p6-misalign-mem-ref)		\
186 __PMC_EV(P6, EMON_KNI_PREF_DISPATCHED,	p6-emon-kni-pref-dispatched)	\
187 __PMC_EV(P6, EMON_KNI_PREF_MISS,	p6-emon-kni-pref-miss)		\
188 __PMC_EV(P6, INST_RETIRED,		p6-inst-retired)		\
189 __PMC_EV(P6, UOPS_RETIRED,		p6-uops-retired)		\
190 __PMC_EV(P6, INST_DECODED,		p6-inst-decoded)		\
191 __PMC_EV(P6, EMON_KNI_INST_RETIRED,	p6-emon-kni-inst-retired)	\
192 __PMC_EV(P6, EMON_KNI_COMP_INST_RET,	p6-emon-kni-comp-inst-ret)	\
193 __PMC_EV(P6, HW_INT_RX,			p6-hw-int-rx)			\
194 __PMC_EV(P6, CYCLES_INT_MASKED,		p6-cycles-int-masked)		\
195 __PMC_EV(P6, CYCLES_INT_PENDING_AND_MASKED,				\
196 			    p6-cycles-in-pending-and-masked)		\
197 __PMC_EV(P6, BR_INST_RETIRED,		p6-br-inst-retired)		\
198 __PMC_EV(P6, BR_MISS_PRED_RETIRED,	p6-br-miss-pred-retired)	\
199 __PMC_EV(P6, BR_TAKEN_RETIRED,		p6-br-taken-retired)		\
200 __PMC_EV(P6, BR_MISS_PRED_TAKEN_RET,	p6-br-miss-pred-taken-ret)	\
201 __PMC_EV(P6, BR_INST_DECODED,		p6-br-inst-decoded)		\
202 __PMC_EV(P6, BTB_MISSES,		p6-btb-misses)			\
203 __PMC_EV(P6, BR_BOGUS,			p6-br-bogus)			\
204 __PMC_EV(P6, BACLEARS,			p6-baclears)			\
205 __PMC_EV(P6, RESOURCE_STALLS,		p6-resource-stalls)		\
206 __PMC_EV(P6, PARTIAL_RAT_STALLS,	p6-partial-rat-stalls)		\
207 __PMC_EV(P6, SEGMENT_REG_LOADS,		p6-segment-reg-loads)		\
208 __PMC_EV(P6, CPU_CLK_UNHALTED,		p6-cpu-clk-unhalted)		\
209 __PMC_EV(P6, MMX_INSTR_EXEC,		p6-mmx-instr-exec)		\
210 __PMC_EV(P6, MMX_SAT_INSTR_EXEC,	p6-mmx-sat-instr-exec)		\
211 __PMC_EV(P6, MMX_UOPS_EXEC,		p6-mmx-uops-exec)		\
212 __PMC_EV(P6, MMX_INSTR_TYPE_EXEC,	p6-mmx-instr-type-exec)		\
213 __PMC_EV(P6, FP_MMX_TRANS,		p6-fp-mmx-trans)		\
214 __PMC_EV(P6, MMX_ASSIST,		p6-mmx-assist)			\
215 __PMC_EV(P6, MMX_INSTR_RET,		p6-mmx-instr-ret)		\
216 __PMC_EV(P6, SEG_RENAME_STALLS,		p6-seg-rename-stalls)		\
217 __PMC_EV(P6, SEG_REG_RENAMES,		p6-seg-reg-renames)		\
218 __PMC_EV(P6, RET_SEG_RENAMES,		p6-ret-seg-renames)		\
219 __PMC_EV(P6, EMON_EST_TRANS,		p6-emon-est-trans)		\
220 __PMC_EV(P6, EMON_THERMAL_TRIP,		p6-emon-thermal-trip)		\
221 __PMC_EV(P6, BR_INST_EXEC,		p6-br-inst-exec)		\
222 __PMC_EV(P6, BR_MISSP_EXEC,		p6-br-missp-exec)		\
223 __PMC_EV(P6, BR_BAC_MISSP_EXEC,		p6-br-bac-missp-exec)		\
224 __PMC_EV(P6, BR_CND_EXEC,		p6-br-cnd-exec)			\
225 __PMC_EV(P6, BR_CND_MISSP_EXEC,		p6-br-cnd-missp-exec)		\
226 __PMC_EV(P6, BR_IND_EXEC,		p6-br-ind-exec)			\
227 __PMC_EV(P6, BR_IND_MISSP_EXEC,		p6-br-ind-missp-exec)		\
228 __PMC_EV(P6, BR_RET_EXEC,		p6-br-ret-exec)			\
229 __PMC_EV(P6, BR_RET_MISSP_EXEC,		p6-br-ret-missp-exec)		\
230 __PMC_EV(P6, BR_RET_BAC_MISSP_EXEC,	p6-br-ret-bac-missp-exec)	\
231 __PMC_EV(P6, BR_CALL_EXEC,		p6-br-call-exec)		\
232 __PMC_EV(P6, BR_CALL_MISSP_EXEC,	p6-br-call-missp-exec)		\
233 __PMC_EV(P6, BR_IND_CALL_EXEC,		p6-br-ind-call-exec)		\
234 __PMC_EV(P6, EMON_SIMD_INSTR_RETIRED,	p6-emon-simd-instr-retired)	\
235 __PMC_EV(P6, EMON_SYNCH_UOPS,		p6-emon-synch-uops)		\
236 __PMC_EV(P6, EMON_ESP_UOPS,		p6-emon-esp-uops)		\
237 __PMC_EV(P6, EMON_FUSED_UOPS_RET,	p6-emon-fused-uops-ret)		\
238 __PMC_EV(P6, EMON_UNFUSION,		p6-emon-unfusion)		\
239 __PMC_EV(P6, EMON_PREF_RQSTS_UP,	p6-emon-pref-rqsts-up)		\
240 __PMC_EV(P6, EMON_PREF_RQSTS_DN,	p6-emon-pref-rqsts-dn)		\
241 __PMC_EV(P6, EMON_SSE_SSE2_INST_RETIRED,				\
242 				p6-emon-sse-sse2-inst-retired)		\
243 __PMC_EV(P6, EMON_SSE_SSE2_COMP_INST_RETIRED,				\
244 				p6-emon-sse-sse2-comp-inst-retired)
245 
246 
247 #define	PMC_EV_P6_FIRST	PMC_EV_P6_DATA_MEM_REFS
248 #define	PMC_EV_P6_LAST	PMC_EV_P6_EMON_SSE_SSE2_COMP_INST_RETIRED
249 
250 /* AMD K8 PMCs */
251 
252 #define	__PMC_EV_K8()							\
253 __PMC_EV(K8, FP_DISPATCHED_FPU_OPS,	k8-fp-dispatched-fpu-ops)	\
254 __PMC_EV(K8, FP_CYCLES_WITH_NO_FPU_OPS_RETIRED,				\
255 		k8-fp-cycles-with-no-fpu-ops-retired)			\
256 __PMC_EV(K8, FP_DISPATCHED_FPU_FAST_FLAG_OPS,				\
257 		k8-fp-dispatched-fpu-fast-flag-ops)			\
258 __PMC_EV(K8, LS_SEGMENT_REGISTER_LOAD,	k8-ls-segment-register-load)	\
259 __PMC_EV(K8, LS_MICROARCHITECTURAL_RESYNC_BY_SELF_MODIFYING_CODE,	\
260 		k8-ls-microarchitectural-resync-by-self-modifying-code)	\
261 __PMC_EV(K8, LS_MICROARCHITECTURAL_RESYNC_BY_SNOOP,			\
262 		k8-ls-microarchitectural-resync-by-snoop)		\
263 __PMC_EV(K8, LS_BUFFER2_FULL,		k8-ls-buffer2-full)		\
264 __PMC_EV(K8, LS_LOCKED_OPERATION,	k8-ls-locked-operation)		\
265 __PMC_EV(K8, LS_MICROARCHITECTURAL_LATE_CANCEL,				\
266 		k8-ls-microarchitectural-late-cancel)			\
267 __PMC_EV(K8, LS_RETIRED_CFLUSH_INSTRUCTIONS,				\
268 		k8-ls-retired-cflush-instructions)			\
269 __PMC_EV(K8, LS_RETIRED_CPUID_INSTRUCTIONS,				\
270 		k8-ls-retired-cpuid-instructions)			\
271 __PMC_EV(K8, DC_ACCESS,			k8-dc-access)			\
272 __PMC_EV(K8, DC_MISS,			k8-dc-miss)			\
273 __PMC_EV(K8, DC_REFILL_FROM_L2,		k8-dc-refill-from-l2)		\
274 __PMC_EV(K8, DC_REFILL_FROM_SYSTEM,	k8-dc-refill-from-system)	\
275 __PMC_EV(K8, DC_COPYBACK,		k8-dc-copyback)			\
276 __PMC_EV(K8, DC_L1_DTLB_MISS_AND_L2_DTLB_HIT,				\
277 		k8-dc-l1-dtlb-miss-and-l2-dtlb-hit)			\
278 __PMC_EV(K8, DC_L1_DTLB_MISS_AND_L2_DTLB_MISS,				\
279 		k8-dc-l1-dtlb-miss-and-l2-dtlb-miss)			\
280 __PMC_EV(K8, DC_MISALIGNED_DATA_REFERENCE,				\
281 		k8-dc-misaligned-data-reference)			\
282 __PMC_EV(K8, DC_MICROARCHITECTURAL_LATE_CANCEL,				\
283 		k8-dc-microarchitectural-late-cancel-of-an-access)	\
284 __PMC_EV(K8, DC_MICROARCHITECTURAL_EARLY_CANCEL,			\
285 		k8-dc-microarchitectural-early-cancel-of-an-access)	\
286 __PMC_EV(K8, DC_ONE_BIT_ECC_ERROR,	k8-dc-one-bit-ecc-error)	\
287 __PMC_EV(K8, DC_DISPATCHED_PREFETCH_INSTRUCTIONS,			\
288 		k8-dc-dispatched-prefetch-instructions)			\
289 __PMC_EV(K8, DC_DCACHE_ACCESSES_BY_LOCKS,				\
290 		k8-dc-dcache-accesses-by-locks)				\
291 __PMC_EV(K8, BU_CPU_CLK_UNHALTED,	k8-bu-cpu-clk-unhalted)		\
292 __PMC_EV(K8, BU_INTERNAL_L2_REQUEST,	k8-bu-internal-l2-request)	\
293 __PMC_EV(K8, BU_FILL_REQUEST_L2_MISS,	k8-bu-fill-request-l2-miss)	\
294 __PMC_EV(K8, BU_FILL_INTO_L2,		k8-bu-fill-into-l2)		\
295 __PMC_EV(K8, IC_FETCH,			k8-ic-fetch)			\
296 __PMC_EV(K8, IC_MISS,			k8-ic-miss)			\
297 __PMC_EV(K8, IC_REFILL_FROM_L2,		k8-ic-refill-from-l2)		\
298 __PMC_EV(K8, IC_REFILL_FROM_SYSTEM,	k8-ic-refill-from-system)	\
299 __PMC_EV(K8, IC_L1_ITLB_MISS_AND_L2_ITLB_HIT,				\
300 		k8-ic-l1-itlb-miss-and-l2-itlb-hit)			\
301 __PMC_EV(K8, IC_L1_ITLB_MISS_AND_L2_ITLB_MISS,				\
302 		k8-ic-l1-itlb-miss-and-l2-itlb-miss)			\
303 __PMC_EV(K8, IC_MICROARCHITECTURAL_RESYNC_BY_SNOOP,			\
304 		k8-ic-microarchitectural-resync-by-snoop)		\
305 __PMC_EV(K8, IC_INSTRUCTION_FETCH_STALL,				\
306 		k8-ic-instruction-fetch-stall)				\
307 __PMC_EV(K8, IC_RETURN_STACK_HIT,	k8-ic-return-stack-hit)		\
308 __PMC_EV(K8, IC_RETURN_STACK_OVERFLOW,	k8-ic-return-stack-overflow)	\
309 __PMC_EV(K8, FR_RETIRED_X86_INSTRUCTIONS,				\
310 		k8-fr-retired-x86-instructions)				\
311 __PMC_EV(K8, FR_RETIRED_UOPS,		k8-fr-retired-uops)		\
312 __PMC_EV(K8, FR_RETIRED_BRANCHES,	k8-fr-retired-branches)		\
313 __PMC_EV(K8, FR_RETIRED_BRANCHES_MISPREDICTED,				\
314 		k8-fr-retired-branches-mispredicted)			\
315 __PMC_EV(K8, FR_RETIRED_TAKEN_BRANCHES,					\
316 		k8-fr-retired-taken-branches)				\
317 __PMC_EV(K8, FR_RETIRED_TAKEN_BRANCHES_MISPREDICTED,			\
318 		k8-fr-retired-taken-branches-mispredicted)		\
319 __PMC_EV(K8, FR_RETIRED_FAR_CONTROL_TRANSFERS,				\
320 		k8-fr-retired-far-control-transfers)			\
321 __PMC_EV(K8, FR_RETIRED_RESYNCS,	k8-fr-retired-resyncs)		\
322 __PMC_EV(K8, FR_RETIRED_NEAR_RETURNS,	k8-fr-retired-near-returns)	\
323 __PMC_EV(K8, FR_RETIRED_NEAR_RETURNS_MISPREDICTED,			\
324 		k8-fr-retired-near-returns-mispredicted)		\
325 __PMC_EV(K8,								\
326 	FR_RETIRED_TAKEN_BRANCHES_MISPREDICTED_BY_ADDR_MISCOMPARE,	\
327 	k8-fr-retired-taken-branches-mispredicted-by-addr-miscompare)	\
328 __PMC_EV(K8, FR_RETIRED_FPU_INSTRUCTIONS,				\
329 		k8-fr-retired-fpu-instructions)				\
330 __PMC_EV(K8, FR_RETIRED_FASTPATH_DOUBLE_OP_INSTRUCTIONS,		\
331 		k8-fr-retired-fastpath-double-op-instructions)		\
332 __PMC_EV(K8, FR_INTERRUPTS_MASKED_CYCLES,				\
333 		k8-fr-interrupts-masked-cycles)				\
334 __PMC_EV(K8, FR_INTERRUPTS_MASKED_WHILE_PENDING_CYCLES,			\
335 		k8-fr-interrupts-masked-while-pending-cycles)		\
336 __PMC_EV(K8, FR_TAKEN_HARDWARE_INTERRUPTS,				\
337 		k8-fr-taken-hardware-interrupts)			\
338 __PMC_EV(K8, FR_DECODER_EMPTY,		k8-fr-decoder-empty)		\
339 __PMC_EV(K8, FR_DISPATCH_STALLS,	k8-fr-dispatch-stalls)		\
340 __PMC_EV(K8, FR_DISPATCH_STALL_FROM_BRANCH_ABORT_TO_RETIRE,		\
341 		k8-fr-dispatch-stall-from-branch-abort-to-retire)	\
342 __PMC_EV(K8, FR_DISPATCH_STALL_FOR_SERIALIZATION,			\
343 		k8-fr-dispatch-stall-for-serialization)			\
344 __PMC_EV(K8, FR_DISPATCH_STALL_FOR_SEGMENT_LOAD,			\
345 		k8-fr-dispatch-stall-for-segment-load)			\
346 __PMC_EV(K8, FR_DISPATCH_STALL_WHEN_REORDER_BUFFER_IS_FULL,		\
347 		k8-fr-dispatch-stall-when-reorder-buffer-is-full)	\
348 __PMC_EV(K8,								\
349 	FR_DISPATCH_STALL_WHEN_RESERVATION_STATIONS_ARE_FULL,		\
350 	k8-fr-dispatch-stall-when-reservation-stations-are-full)	\
351 __PMC_EV(K8, FR_DISPATCH_STALL_WHEN_FPU_IS_FULL,			\
352 		k8-fr-dispatch-stall-when-fpu-is-full)			\
353 __PMC_EV(K8, FR_DISPATCH_STALL_WHEN_LS_IS_FULL,				\
354 		k8-fr-dispatch-stall-when-ls-is-full)			\
355 __PMC_EV(K8, FR_DISPATCH_STALL_WHEN_WAITING_FOR_ALL_TO_BE_QUIET,	\
356 		k8-fr-dispatch-stall-when-waiting-for-all-to-be-quiet)	\
357 __PMC_EV(K8,								\
358 	FR_DISPATCH_STALL_WHEN_FAR_XFER_OR_RESYNC_BRANCH_PENDING,	\
359 	k8-fr-dispatch-stall-when-far-xfer-or-resync-branch-pending)	\
360 __PMC_EV(K8, FR_FPU_EXCEPTIONS,		k8-fr-fpu-exceptions)		\
361 __PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR0,				\
362 		k8-fr-number-of-breakpoints-for-dr0)			\
363 __PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR1,				\
364 		k8-fr-number-of-breakpoints-for-dr1)			\
365 __PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR2,				\
366 		k8-fr-number-of-breakpoints-for-dr2)			\
367 __PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR3,				\
368 		k8-fr-number-of-breakpoints-for-dr3)			\
369 __PMC_EV(K8, NB_MEMORY_CONTROLLER_PAGE_ACCESS_EVENT,			\
370 		k8-nb-memory-controller-page-access-event)		\
371 __PMC_EV(K8, NB_MEMORY_CONTROLLER_PAGE_TABLE_OVERFLOW,			\
372 		k8-nb-memory-controller-page-table-overflow)		\
373 __PMC_EV(K8, NB_MEMORY_CONTROLLER_DRAM_COMMAND_SLOTS_MISSED,		\
374 		k8-nb-memory-controller-dram-slots-missed)		\
375 __PMC_EV(K8, NB_MEMORY_CONTROLLER_TURNAROUND,				\
376 		k8-nb-memory-controller-turnaround)			\
377 __PMC_EV(K8, NB_MEMORY_CONTROLLER_BYPASS_SATURATION,			\
378 		k8-nb-memory-controller-bypass-saturation)		\
379 __PMC_EV(K8, NB_SIZED_COMMANDS,		k8-nb-sized-commands)		\
380 __PMC_EV(K8, NB_PROBE_RESULT,		k8-nb-probe-result)		\
381 __PMC_EV(K8, NB_HT_BUS0_BANDWIDTH,	k8-nb-ht-bus0-bandwidth)	\
382 __PMC_EV(K8, NB_HT_BUS1_BANDWIDTH,	k8-nb-ht-bus1-bandwidth)	\
383 __PMC_EV(K8, NB_HT_BUS2_BANDWIDTH,	k8-nb-ht-bus2-bandwidth)
384 
385 #define	PMC_EV_K8_FIRST		PMC_EV_K8_FP_DISPATCHED_FPU_OPS
386 #define	PMC_EV_K8_LAST		PMC_EV_K8_NB_HT_BUS2_BANDWIDTH
387 
388 
389 /* Intel Pentium Events */
390 #define	__PMC_EV_P5()							\
391 __PMC_EV(P5, DATA_READ, p5-data-read)					\
392 __PMC_EV(P5, DATA_WRITE, p5-data-write)					\
393 __PMC_EV(P5, DATA_TLB_MISS, p5-data-tlb-miss)				\
394 __PMC_EV(P5, DATA_READ_MISS, p5-data-read-miss)				\
395 __PMC_EV(P5, DATA_WRITE_MISS, p5-data-write-miss)			\
396 __PMC_EV(P5, WRITE_HIT_TO_M_OR_E_STATE_LINES,				\
397     p5-write-hit-to-m-or-e-state-lines)					\
398 __PMC_EV(P5, DATA_CACHE_LINES_WRITTEN_BACK,				\
399     p4-data-cache-lines-written-back)					\
400 __PMC_EV(P5, EXTERNAL_SNOOPS, p5-external-snoops)			\
401 __PMC_EV(P5, EXTERNAL_DATA_CACHE_SNOOP_HITS,				\
402     p5-external-data-cache-snoop-hits)					\
403 __PMC_EV(P5, MEMORY_ACCESSES_IN_BOTH_PIPES,				\
404     p5-memory-accesses-in-both-pipes)					\
405 __PMC_EV(P5, BANK_CONFLICTS, p5-bank-conflicts)				\
406 __PMC_EV(P5, MISALIGNED_DATA_OR_IO_REFERENCES,				\
407     p5-misaligned-data-or-io-references)				\
408 __PMC_EV(P5, CODE_READ, p5-code-read)					\
409 __PMC_EV(P5, CODE_TLB_MISS, p5-code-tlb-miss)				\
410 __PMC_EV(P5, CODE_CACHE_MISS, p5-code-cache-miss)			\
411 __PMC_EV(P5, ANY_SEGMENT_REGISTER_LOADED,				\
412     p5-any-segment-register-loaded)					\
413 __PMC_EV(P5, BRANCHES, p5-branches)					\
414 __PMC_EV(P5, BTB_HITS, p5-btb-hits)					\
415 __PMC_EV(P5, TAKEN_BRANCH_OR_BTB_HIT,					\
416     p5-taken-branch-or-btb-hit)						\
417 __PMC_EV(P5, PIPELINE_FLUSHES, p5-pipeline-flushes)			\
418 __PMC_EV(P5, INSTRUCTIONS_EXECUTED, p5-instructions-executed)		\
419 __PMC_EV(P5, INSTRUCTIONS_EXECUTED_V_PIPE,				\
420     p5-instructions-executed-v-pipe)					\
421 __PMC_EV(P5, BUS_CYCLE_DURATION, p5-bus-cycle-duration)			\
422 __PMC_EV(P5, WRITE_BUFFER_FULL_STALL_DURATION,				\
423     p5-write-buffer-full-stall-duration)				\
424 __PMC_EV(P5, WAITING_FOR_DATA_MEMORY_READ_STALL_DURATION,		\
425     p5-waiting-for-data-memory-read-stall-duration)			\
426 __PMC_EV(P5, STALL_ON_WRITE_TO_AN_E_OR_M_STATE_LINE,			\
427     p5-stall-on-write-to-an-e-or-m-state-line)				\
428 __PMC_EV(P5, LOCKED_BUS_CYCLE, p5-locked-bus-cycle)			\
429 __PMC_EV(P5, IO_READ_OR_WRITE_CYCLE, p5-io-read-or-write-cycle)		\
430 __PMC_EV(P5, NONCACHEABLE_MEMORY_READS,					\
431     p5-noncacheable-memory-reads)					\
432 __PMC_EV(P5, PIPELINE_AGI_STALLS, p5-pipeline-agi-stalls)		\
433 __PMC_EV(P5, FLOPS, p5-flops)						\
434 __PMC_EV(P5, BREAKPOINT_MATCH_ON_DR0_REGISTER,				\
435     p5-breakpoint-match-on-dr0-register)				\
436 __PMC_EV(P5, BREAKPOINT_MATCH_ON_DR1_REGISTER,				\
437     p5-breakpoint-match-on-dr1-register)				\
438 __PMC_EV(P5, BREAKPOINT_MATCH_ON_DR2_REGISTER,				\
439     p5-breakpoint-match-on-dr2-register)				\
440 __PMC_EV(P5, BREAKPOINT_MATCH_ON_DR3_REGISTER,				\
441     p5-breakpoint-match-on-dr3-register)				\
442 __PMC_EV(P5, HARDWARE_INTERRUPTS, p5-hardware-interrupts)		\
443 __PMC_EV(P5, DATA_READ_OR_WRITE, p5-data-read-or-write)			\
444 __PMC_EV(P5, DATA_READ_MISS_OR_WRITE_MISS,				\
445     p5-data-read-miss-or-write-miss)					\
446 __PMC_EV(P5, BUS_OWNERSHIP_LATENCY, p5-bus-ownership-latency)		\
447 __PMC_EV(P5, BUS_OWNERSHIP_TRANSFERS, p5-bus-ownership-transfers)	\
448 __PMC_EV(P5, MMX_INSTRUCTIONS_EXECUTED_U_PIPE,				\
449     p5-mmx-instructions-executed-u-pipe)				\
450 __PMC_EV(P5, MMX_INSTRUCTIONS_EXECUTED_V_PIPE,				\
451     p5-mmx-instructions-executed-v-pipe)				\
452 __PMC_EV(P5, CACHE_M_LINE_SHARING, p5-cache-m-line-sharing)		\
453 __PMC_EV(P5, CACHE_LINE_SHARING, p5-cache-line-sharing)			\
454 __PMC_EV(P5, EMMS_INSTRUCTIONS_EXECUTED,				\
455     p5-emms-instructions-executed)					\
456 __PMC_EV(P5, TRANSITIONS_BETWEEN_MMX_AND_FP_INSTRUCTIONS,		\
457     p5-transitions-between-mmx-and-fp-instructions)			\
458 __PMC_EV(P5, BUS_UTILIZATION_DUE_TO_PROCESSOR_ACTIVITY,			\
459     p5-bus-utilization-due-to-processor-activity)			\
460 __PMC_EV(P5, WRITES_TO_NONCACHEABLE_MEMORY,				\
461     p5-writes-to-noncacheable-memory)					\
462 __PMC_EV(P5, SATURATING_MMX_INSTRUCTIONS_EXECUTED,			\
463     p5-saturating-mmx-instructions-executed)				\
464 __PMC_EV(P5, SATURATIONS_PERFORMED, p5-saturations-performed)		\
465 __PMC_EV(P5, NUMBER_OF_CYCLES_NOT_IN_HALT_STATE,			\
466     p5-number-of-cycles-not-in-halt-state)				\
467 __PMC_EV(P5, DATA_CACHE_TLB_MISS_STALL_DURATION,			\
468     p5-data-cache-tlb-miss-stall-duration)				\
469 __PMC_EV(P5, MMX_INSTRUCTION_DATA_READS,				\
470     p5-mmx-instruction-data-reads)					\
471 __PMC_EV(P5, MMX_INSTRUCTION_DATA_READ_MISSES,				\
472     p5-mmx-instruction-data-read-misses)				\
473 __PMC_EV(P5, FLOATING_POINT_STALLS_DURATION,				\
474     p5-floating-point-stalls-duration)					\
475 __PMC_EV(P5, TAKEN_BRANCHES, p5-taken-branches)				\
476 __PMC_EV(P5, D1_STARVATION_AND_FIFO_IS_EMPTY,				\
477     p5-d1-starvation-and-fifo-is-empty)					\
478 __PMC_EV(P5, D1_STARVATION_AND_ONLY_ONE_INSTRUCTION_IN_FIFO,		\
479     p5-d1-starvation-and-only-instruction-in-fifo)			\
480 __PMC_EV(P5, MMX_INSTRUCTION_DATA_WRITES,				\
481     p5-mmx-instruction-data-writes)					\
482 __PMC_EV(P5, MMX_INSTRUCTION_DATA_WRITE_MISSES,				\
483     p5-mmx-instruction-data-write-misses)				\
484 __PMC_EV(P5, PIPELINE_FLUSHES_DUE_TO_WRONG_BRANCH_PREDICTIONS,		\
485     p5-pipeline-flushes-due-to-wrong-branch-predictions)		\
486 __PMC_EV(P5,								\
487     PIPELINE_FLUSHES_DUE_TO_WRONG_BRANCH_PREDICTIONS_RESOLVED_IN_WB_STAGE, \
488     p5-pipeline-flushes-due-to-wrong-branch-predictions-resolved-in-wb-stage) \
489 __PMC_EV(P5, MISALIGNED_DATA_MEMORY_REFERENCE_ON_MMX_INSTRUCTIONS,	\
490     p5-misaligned-data-memory-reference-on-mmx-instructions)		\
491 __PMC_EV(P5, PIPELINE_STALL_FOR_MMX_INSTRUCTION_DATA_MEMORY_READS,	\
492     p5-pipeline-stall-for-mmx-instruction-data-memory-reads)		\
493 __PMC_EV(P5, MISPREDICTED_OR_UNPREDICTED_RETURNS,			\
494     p5-mispredicted-or-unpredicted-returns)				\
495 __PMC_EV(P5, PREDICTED_RETURNS, p5-predicted-returns)			\
496 __PMC_EV(P5, MMX_MULTIPLY_UNIT_INTERLOCK,				\
497     p5-mmx-multiply-unit-interlock)					\
498 __PMC_EV(P5, MOVD_MOVQ_STORE_STALL_DUE_TO_PREVIOUS_MMX_OPERATION,	\
499     p5-movd-movq-store-stall-due-to-previous-mmx-operation)		\
500 __PMC_EV(P5, RETURNS, p5-returns)					\
501 __PMC_EV(P5, BTB_FALSE_ENTRIES, p5-btb-false-entries)			\
502 __PMC_EV(P5, BTB_MISS_PREDICTION_ON_NOT_TAKEN_BRANCH,			\
503     p5-btb-miss-prediction-on-not-taken-branch)				\
504 __PMC_EV(P5,								\
505     FULL_WRITE_BUFFER_STALL_DURATION_WHILE_EXECUTING_MMX_INSTRUCTIONS,	\
506     p5-full-write-buffer-stall-duration-while-executing-mmx-instructions) \
507 __PMC_EV(P5, STALL_ON_MMX_INSTRUCTION_WRITE_TO_E_OR_M_STATE_LINE,	\
508     p5-stall-on-mmx-instruction-write-to-e-o-m-state-line)
509 
510 #define	PMC_EV_P5_FIRST		PMC_EV_P5_DATA_READ
511 #define	PMC_EV_P5_LAST	        \
512 	PMC_EV_P5_STALL_ON_MMX_INSTRUCTION_WRITE_TO_E_OR_M_STATE_LINE
513 
514 /* timestamp counters. */
515 #define	__PMC_EV_TSC()							\
516 	__PMC_EV(TSC, TSC, tsc)
517 
518 /* All known PMC events */
519 #define	__PMC_EVENTS()							\
520 	__PMC_EV_TSC()							\
521 	__PMC_EV_K7()							\
522 	__PMC_EV_P6()							\
523 	__PMC_EV_P4()							\
524 	__PMC_EV_K8()							\
525 	__PMC_EV_P5()							\
526 
527 #define	PMC_EVENT_FIRST	PMC_EV_TSC_TSC
528 #define	PMC_EVENT_LAST	PMC_EV_P5_LAST
529 
530 #endif /* _DEV_HWPMC_PMC_EVENTS_H_ */
531