| @@ -1,1108 +1,1110 @@ | | | @@ -1,1108 +1,1110 @@ |
1 | /* $NetBSD: tprof_x86.c,v 1.15 2022/12/08 05:29:27 msaitoh Exp $ */ | | 1 | /* $NetBSD: tprof_x86.c,v 1.16 2023/04/10 06:08:56 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Maxime Villard. | | 8 | * by Maxime Villard. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * | | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #include <stdio.h> | | 33 | #include <stdio.h> |
34 | #include <stdlib.h> | | 34 | #include <stdlib.h> |
35 | #include <stdbool.h> | | 35 | #include <stdbool.h> |
36 | #include <string.h> | | 36 | #include <string.h> |
37 | #include <unistd.h> | | 37 | #include <unistd.h> |
38 | #include <err.h> | | 38 | #include <err.h> |
39 | #include <machine/specialreg.h> | | 39 | #include <machine/specialreg.h> |
40 | #include <dev/tprof/tprof_ioctl.h> | | 40 | #include <dev/tprof/tprof_ioctl.h> |
41 | #include "../tprof.h" | | 41 | #include "../tprof.h" |
42 | | | 42 | |
43 | int tprof_event_init(uint32_t); | | 43 | int tprof_event_init(uint32_t); |
44 | void tprof_event_list(void); | | 44 | void tprof_event_list(void); |
45 | void tprof_event_lookup(const char *, struct tprof_param *); | | 45 | void tprof_event_lookup(const char *, struct tprof_param *); |
46 | | | 46 | |
47 | struct name_to_event { | | 47 | struct name_to_event { |
48 | const char *name; | | 48 | const char *name; |
49 | uint64_t event; | | 49 | uint64_t event; |
50 | uint64_t unit; | | 50 | uint64_t unit; |
51 | bool enabled; | | 51 | bool enabled; |
52 | }; | | 52 | }; |
53 | | | 53 | |
54 | struct event_table { | | 54 | struct event_table { |
55 | const char *tablename; | | 55 | const char *tablename; |
56 | struct name_to_event *names; | | 56 | struct name_to_event *names; |
57 | size_t nevents; | | 57 | size_t nevents; |
58 | struct event_table *next; | | 58 | struct event_table *next; |
59 | }; | | 59 | }; |
60 | | | 60 | |
61 | static struct event_table *cpuevents = NULL; | | 61 | static struct event_table *cpuevents = NULL; |
62 | | | 62 | |
63 | static void x86_cpuid(unsigned int *eax, unsigned int *ebx, | | 63 | static void x86_cpuid(unsigned int *eax, unsigned int *ebx, |
64 | unsigned int *ecx, unsigned int *edx) | | 64 | unsigned int *ecx, unsigned int *edx) |
65 | { | | 65 | { |
66 | asm volatile("cpuid" | | 66 | asm volatile("cpuid" |
67 | : "=a" (*eax), | | 67 | : "=a" (*eax), |
68 | "=b" (*ebx), | | 68 | "=b" (*ebx), |
69 | "=c" (*ecx), | | 69 | "=c" (*ecx), |
70 | "=d" (*edx) | | 70 | "=d" (*edx) |
71 | : "0" (*eax), "2" (*ecx)); | | 71 | : "0" (*eax), "2" (*ecx)); |
72 | } | | 72 | } |
73 | | | 73 | |
74 | /* ------------------------------------------------------------------------- */ | | 74 | /* ------------------------------------------------------------------------- */ |
75 | | | 75 | |
76 | /* | | 76 | /* |
77 | * Intel Architectural Version 1. | | 77 | * Intel Architectural Version 1. |
78 | */ | | 78 | */ |
79 | static struct name_to_event intel_arch1_names[] = { | | 79 | static struct name_to_event intel_arch1_names[] = { |
80 | /* Event Name - Event Select - UMask */ | | 80 | /* Event Name - Event Select - UMask */ |
81 | { "unhalted-core-cycles", 0x3c, 0x00, true }, | | 81 | { "unhalted-core-cycles", 0x3c, 0x00, true }, |
82 | { "instruction-retired", 0xc0, 0x00, true }, | | 82 | { "instruction-retired", 0xc0, 0x00, true }, |
83 | { "unhalted-reference-cycles", 0x3c, 0x01, true }, | | 83 | { "unhalted-reference-cycles", 0x3c, 0x01, true }, |
84 | { "llc-reference", 0x2e, 0x4f, true }, | | 84 | { "llc-reference", 0x2e, 0x4f, true }, |
85 | { "llc-misses", 0x2e, 0x41, true }, | | 85 | { "llc-misses", 0x2e, 0x41, true }, |
86 | { "branch-instruction-retired", 0xc4, 0x00, true }, | | 86 | { "branch-instruction-retired", 0xc4, 0x00, true }, |
87 | { "branch-misses-retired", 0xc5, 0x00, true }, | | 87 | { "branch-misses-retired", 0xc5, 0x00, true }, |
88 | { "topdown-slots", 0xa4, 0x01, true }, | | 88 | { "topdown-slots", 0xa4, 0x01, true }, |
89 | }; | | 89 | }; |
90 | | | 90 | |
91 | static struct event_table intel_arch1 = { | | 91 | static struct event_table intel_arch1 = { |
92 | .tablename = "Intel Architectural Version 1", | | 92 | .tablename = "Intel Architectural Version 1", |
93 | .names = intel_arch1_names, | | 93 | .names = intel_arch1_names, |
94 | .nevents = sizeof(intel_arch1_names) / | | 94 | .nevents = sizeof(intel_arch1_names) / |
95 | sizeof(struct name_to_event), | | 95 | sizeof(struct name_to_event), |
96 | .next = NULL | | 96 | .next = NULL |
97 | }; | | 97 | }; |
98 | | | 98 | |
99 | static struct event_table * | | 99 | static struct event_table * |
100 | init_intel_arch1(void) | | 100 | init_intel_arch1(void) |
101 | { | | 101 | { |
102 | unsigned int eax, ebx, ecx, edx, vectorlen; | | 102 | unsigned int eax, ebx, ecx, edx, vectorlen; |
103 | struct event_table *table; | | 103 | struct event_table *table; |
104 | size_t i; | | 104 | size_t i; |
105 | | | 105 | |
106 | eax = 0x0a; | | 106 | eax = 0x0a; |
107 | ebx = 0; | | 107 | ebx = 0; |
108 | ecx = 0; | | 108 | ecx = 0; |
109 | edx = 0; | | 109 | edx = 0; |
110 | x86_cpuid(&eax, &ebx, &ecx, &edx); | | 110 | x86_cpuid(&eax, &ebx, &ecx, &edx); |
111 | | | 111 | |
112 | vectorlen = __SHIFTOUT(eax, CPUID_PERF_BVECLEN); | | 112 | vectorlen = __SHIFTOUT(eax, CPUID_PERF_BVECLEN); |
113 | | | 113 | |
114 | table = &intel_arch1; | | 114 | table = &intel_arch1; |
115 | for (i = 0; i < table->nevents; i++) { | | 115 | for (i = 0; i < table->nevents; i++) { |
116 | /* | | 116 | /* |
117 | * Disable the unsupported events from: | | 117 | * Disable the unsupported events from: |
118 | * a) the bit vector length in EAX. | | 118 | * a) the bit vector length in EAX. |
119 | * b) the disable bit in EBX. | | 119 | * b) the disable bit in EBX. |
120 | */ | | 120 | */ |
121 | if (i >= vectorlen) | | 121 | if (i >= vectorlen) |
122 | table->names[i].enabled = false; | | 122 | table->names[i].enabled = false; |
123 | if ((ebx & (i << 1)) != 0) | | 123 | if ((ebx & (i << 1)) != 0) |
124 | table->names[i].enabled = false; | | 124 | table->names[i].enabled = false; |
125 | } | | 125 | } |
126 | | | 126 | |
127 | return table; | | 127 | return table; |
128 | } | | 128 | } |
129 | | | 129 | |
130 | /* | | 130 | /* |
131 | * Intel Silvermont/Airmont. | | 131 | * Intel Silvermont/Airmont. |
132 | */ | | 132 | */ |
133 | static struct name_to_event intel_silvermont_airmont_names[] = { | | 133 | static struct name_to_event intel_silvermont_airmont_names[] = { |
134 | { "REHABQ.LD_BLOCK_ST_FORWARD", 0x03, 0x01, true }, | | 134 | { "REHABQ.LD_BLOCK_ST_FORWARD", 0x03, 0x01, true }, |
135 | { "REHABQ.LD_BLOCK_STD_NOTREADY", 0x03, 0x02, true }, | | 135 | { "REHABQ.LD_BLOCK_STD_NOTREADY", 0x03, 0x02, true }, |
136 | { "REHABQ.ST_SPLITS", 0x03, 0x04, true }, | | 136 | { "REHABQ.ST_SPLITS", 0x03, 0x04, true }, |
137 | { "REHABQ.LD_SPLITS", 0x03, 0x08, true }, | | 137 | { "REHABQ.LD_SPLITS", 0x03, 0x08, true }, |
138 | { "REHABQ.LOCK", 0x03, 0x10, true }, | | 138 | { "REHABQ.LOCK", 0x03, 0x10, true }, |
139 | { "REHABQ.STA_FULL", 0x03, 0x20, true }, | | 139 | { "REHABQ.STA_FULL", 0x03, 0x20, true }, |
140 | { "REHABQ.ANY_LD", 0x03, 0x40, true }, | | 140 | { "REHABQ.ANY_LD", 0x03, 0x40, true }, |
141 | { "REHABQ.ANY_ST", 0x03, 0x80, true }, | | 141 | { "REHABQ.ANY_ST", 0x03, 0x80, true }, |
142 | { "MEM_UOPS_RETIRED.L1_MISS_LOADS", 0x04, 0x01, true }, | | 142 | { "MEM_UOPS_RETIRED.L1_MISS_LOADS", 0x04, 0x01, true }, |
143 | { "MEM_UOPS_RETIRED.L2_HIT_LOADS", 0x04, 0x02, true }, | | 143 | { "MEM_UOPS_RETIRED.L2_HIT_LOADS", 0x04, 0x02, true }, |
144 | { "MEM_UOPS_RETIRED.L2_MISS_LOADS", 0x04, 0x04, true }, | | 144 | { "MEM_UOPS_RETIRED.L2_MISS_LOADS", 0x04, 0x04, true }, |
145 | { "MEM_UOPS_RETIRED.DTLB_MISS_LOADS", 0x04, 0x08, true }, | | 145 | { "MEM_UOPS_RETIRED.DTLB_MISS_LOADS", 0x04, 0x08, true }, |
146 | { "MEM_UOPS_RETIRED.UTLB_MISS", 0x04, 0x10, true }, | | 146 | { "MEM_UOPS_RETIRED.UTLB_MISS", 0x04, 0x10, true }, |
147 | { "MEM_UOPS_RETIRED.HITM", 0x04, 0x20, true }, | | 147 | { "MEM_UOPS_RETIRED.HITM", 0x04, 0x20, true }, |
148 | { "MEM_UOPS_RETIRED.ALL_LOADS", 0x04, 0x40, true }, | | 148 | { "MEM_UOPS_RETIRED.ALL_LOADS", 0x04, 0x40, true }, |
149 | { "MEM_UOP_RETIRED.ALL_STORES", 0x04, 0x80, true }, | | 149 | { "MEM_UOP_RETIRED.ALL_STORES", 0x04, 0x80, true }, |
150 | { "PAGE_WALKS.D_SIDE_CYCLES", 0x05, 0x01, true }, | | 150 | { "PAGE_WALKS.D_SIDE_CYCLES", 0x05, 0x01, true }, |
151 | { "PAGE_WALKS.I_SIDE_CYCLES", 0x05, 0x02, true }, | | 151 | { "PAGE_WALKS.I_SIDE_CYCLES", 0x05, 0x02, true }, |
152 | { "PAGE_WALKS.WALKS", 0x05, 0x03, true }, | | 152 | { "PAGE_WALKS.WALKS", 0x05, 0x03, true }, |
153 | { "LONGEST_LAT_CACHE.MISS", 0x2e, 0x41, true }, | | 153 | { "LONGEST_LAT_CACHE.MISS", 0x2e, 0x41, true }, |
154 | { "LONGEST_LAT_CACHE.REFERENCE", 0x2e, 0x4f, true }, | | 154 | { "LONGEST_LAT_CACHE.REFERENCE", 0x2e, 0x4f, true }, |
155 | { "L2_REJECT_XQ.ALL", 0x30, 0x00, true }, | | 155 | { "L2_REJECT_XQ.ALL", 0x30, 0x00, true }, |
156 | { "CORE_REJECT_L2Q.ALL", 0x31, 0x00, true }, | | 156 | { "CORE_REJECT_L2Q.ALL", 0x31, 0x00, true }, |
157 | { "CPU_CLK_UNHALTED.CORE_P", 0x3c, 0x00, true }, | | 157 | { "CPU_CLK_UNHALTED.CORE_P", 0x3c, 0x00, true }, |
158 | { "CPU_CLK_UNHALTED.REF_P", 0x3c, 0x01, true }, | | 158 | { "CPU_CLK_UNHALTED.REF_P", 0x3c, 0x01, true }, |
159 | { "ICACHE.HIT", 0x80, 0x01, true }, | | 159 | { "ICACHE.HIT", 0x80, 0x01, true }, |
160 | { "ICACHE.MISSES", 0x80, 0x02, true }, | | 160 | { "ICACHE.MISSES", 0x80, 0x02, true }, |
161 | { "ICACHE.ACCESSES", 0x80, 0x03, true }, | | 161 | { "ICACHE.ACCESSES", 0x80, 0x03, true }, |
162 | { "OFFCORE_RESPONSE_0", 0xb7, 0x01, true }, | | 162 | { "OFFCORE_RESPONSE_0", 0xb7, 0x01, true }, |
163 | { "OFFCORE_RESPONSE_1", 0xb7, 0x02, true }, | | 163 | { "OFFCORE_RESPONSE_1", 0xb7, 0x02, true }, |
164 | { "INST_RETIRED.ANY_P", 0xc0, 0x00, true }, | | 164 | { "INST_RETIRED.ANY_P", 0xc0, 0x00, true }, |
165 | { "UOPS_RETIRED.MS", 0xc2, 0x01, true }, | | 165 | { "UOPS_RETIRED.MS", 0xc2, 0x01, true }, |
166 | { "UOPS_RETIRED.ALL", 0xc2, 0x10, true }, | | 166 | { "UOPS_RETIRED.ALL", 0xc2, 0x10, true }, |
167 | { "MACHINE_CLEARS.SMC", 0xc3, 0x01, true }, | | 167 | { "MACHINE_CLEARS.SMC", 0xc3, 0x01, true }, |
168 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, | | 168 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, |
169 | { "MACHINE_CLEARS.FP_ASSIST", 0xc3, 0x04, true }, | | 169 | { "MACHINE_CLEARS.FP_ASSIST", 0xc3, 0x04, true }, |
170 | { "MACHINE_CLEARS.ALL", 0xc3, 0x08, true }, | | 170 | { "MACHINE_CLEARS.ALL", 0xc3, 0x08, true }, |
171 | { "BR_INST_RETIRED.ALL_BRANCHES", 0xc4, 0x00, true }, | | 171 | { "BR_INST_RETIRED.ALL_BRANCHES", 0xc4, 0x00, true }, |
172 | { "BR_INST_RETIRED.JCC", 0xc4, 0x7e, true }, | | 172 | { "BR_INST_RETIRED.JCC", 0xc4, 0x7e, true }, |
173 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0xbf, true }, | | 173 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0xbf, true }, |
174 | { "BR_INST_RETIRED.NON_RETURN_IND", 0xc4, 0xeb, true }, | | 174 | { "BR_INST_RETIRED.NON_RETURN_IND", 0xc4, 0xeb, true }, |
175 | { "BR_INST_RETIRED.RETURN", 0xc4, 0xf7, true }, | | 175 | { "BR_INST_RETIRED.RETURN", 0xc4, 0xf7, true }, |
176 | { "BR_INST_RETIRED.CALL", 0xc4, 0xf9, true }, | | 176 | { "BR_INST_RETIRED.CALL", 0xc4, 0xf9, true }, |
177 | { "BR_INST_RETIRED.IND_CALL", 0xc4, 0xfb, true }, | | 177 | { "BR_INST_RETIRED.IND_CALL", 0xc4, 0xfb, true }, |
178 | { "BR_INST_RETIRED.REL_CALL", 0xc4, 0xfd, true }, | | 178 | { "BR_INST_RETIRED.REL_CALL", 0xc4, 0xfd, true }, |
179 | { "BR_INST_RETIRED.TAKEN_JCC", 0xc4, 0xfe, true }, | | 179 | { "BR_INST_RETIRED.TAKEN_JCC", 0xc4, 0xfe, true }, |
180 | { "BR_MISP_RETIRED.ALL_BRANCHES", 0xc5, 0x00, true }, | | 180 | { "BR_MISP_RETIRED.ALL_BRANCHES", 0xc5, 0x00, true }, |
181 | { "BR_MISP_RETIRED.JCC", 0xc5, 0x7e, true }, | | 181 | { "BR_MISP_RETIRED.JCC", 0xc5, 0x7e, true }, |
182 | { "BR_MISP_RETIRED.FAR", 0xc5, 0xbf, true }, | | 182 | { "BR_MISP_RETIRED.FAR", 0xc5, 0xbf, true }, |
183 | { "BR_MISP_RETIRED.NON_RETURN_IND", 0xc5, 0xeb, true }, | | 183 | { "BR_MISP_RETIRED.NON_RETURN_IND", 0xc5, 0xeb, true }, |
184 | { "BR_MISP_RETIRED.RETURN", 0xc5, 0xf7, true }, | | 184 | { "BR_MISP_RETIRED.RETURN", 0xc5, 0xf7, true }, |
185 | { "BR_MISP_RETIRED.CALL", 0xc5, 0xf9, true }, | | 185 | { "BR_MISP_RETIRED.CALL", 0xc5, 0xf9, true }, |
186 | { "BR_MISP_RETIRED.IND_CALL", 0xc5, 0xfb, true }, | | 186 | { "BR_MISP_RETIRED.IND_CALL", 0xc5, 0xfb, true }, |
187 | { "BR_MISP_RETIRED.REL_CALL", 0xc5, 0xfd, true }, | | 187 | { "BR_MISP_RETIRED.REL_CALL", 0xc5, 0xfd, true }, |
188 | { "BR_MISP_RETIRED.TAKEN_JCC", 0xc5, 0xfe, true }, | | 188 | { "BR_MISP_RETIRED.TAKEN_JCC", 0xc5, 0xfe, true }, |
189 | { "NO_ALLOC_CYCLES.ROB_FULL", 0xca, 0x01, true }, | | 189 | { "NO_ALLOC_CYCLES.ROB_FULL", 0xca, 0x01, true }, |
190 | { "NO_ALLOC_CYCLES.RAT_STALL", 0xca, 0x20, true }, | | 190 | { "NO_ALLOC_CYCLES.RAT_STALL", 0xca, 0x20, true }, |
191 | { "NO_ALLOC_CYCLES.ALL", 0xca, 0x3f, true }, | | 191 | { "NO_ALLOC_CYCLES.ALL", 0xca, 0x3f, true }, |
192 | { "NO_ALLOC_CYCLES.NOT_DELIVERED", 0xca, 0x50, true }, | | 192 | { "NO_ALLOC_CYCLES.NOT_DELIVERED", 0xca, 0x50, true }, |
193 | { "RS_FULL_STALL.MEC", 0xcb, 0x01, true }, | | 193 | { "RS_FULL_STALL.MEC", 0xcb, 0x01, true }, |
194 | { "RS_FULL_STALL.ALL", 0xcb, 0x1f, true }, | | 194 | { "RS_FULL_STALL.ALL", 0xcb, 0x1f, true }, |
195 | { "CYCLES_DIV_BUSY.ANY", 0xcd, 0x01, true }, | | 195 | { "CYCLES_DIV_BUSY.ANY", 0xcd, 0x01, true }, |
196 | { "BACLEARS.ALL", 0xe6, 0x01, true }, | | 196 | { "BACLEARS.ALL", 0xe6, 0x01, true }, |
197 | { "BACLEARS.RETURN", 0xe6, 0x08, true }, | | 197 | { "BACLEARS.RETURN", 0xe6, 0x08, true }, |
198 | { "BACLEARS.COND", 0xe6, 0x10, true }, | | 198 | { "BACLEARS.COND", 0xe6, 0x10, true }, |
199 | { "MS_DECODED.MS_ENTRY", 0xe7, 0x01, true }, | | 199 | { "MS_DECODED.MS_ENTRY", 0xe7, 0x01, true }, |
200 | }; | | 200 | }; |
201 | | | 201 | |
202 | static struct event_table intel_silvermont_airmont = { | | 202 | static struct event_table intel_silvermont_airmont = { |
203 | .tablename = "Intel Silvermont/Airmont", | | 203 | .tablename = "Intel Silvermont/Airmont", |
204 | .names = intel_silvermont_airmont_names, | | 204 | .names = intel_silvermont_airmont_names, |
205 | .nevents = sizeof(intel_silvermont_airmont_names) / | | 205 | .nevents = sizeof(intel_silvermont_airmont_names) / |
206 | sizeof(struct name_to_event), | | 206 | sizeof(struct name_to_event), |
207 | .next = NULL | | 207 | .next = NULL |
208 | }; | | 208 | }; |
209 | | | 209 | |
210 | static struct event_table * | | 210 | static struct event_table * |
211 | init_intel_silvermont_airmont(void) | | 211 | init_intel_silvermont_airmont(void) |
212 | { | | 212 | { |
213 | | | 213 | |
214 | return &intel_silvermont_airmont; | | 214 | return &intel_silvermont_airmont; |
215 | } | | 215 | } |
216 | | | 216 | |
217 | /* | | 217 | /* |
218 | * Intel Goldmont | | 218 | * Intel Goldmont |
219 | */ | | 219 | */ |
220 | static struct name_to_event intel_goldmont_names[] = { | | 220 | static struct name_to_event intel_goldmont_names[] = { |
221 | { "LD_BLOCKS.ALL_BLOCK", 0x03, 0x10, true }, | | 221 | { "LD_BLOCKS.ALL_BLOCK", 0x03, 0x10, true }, |
222 | { "LD_BLOCKS.UTLB_MISS", 0x03, 0x08, true }, | | 222 | { "LD_BLOCKS.UTLB_MISS", 0x03, 0x08, true }, |
223 | { "LD_BLOCKS.STORE_FORWARD", 0x03, 0x02, true }, | | 223 | { "LD_BLOCKS.STORE_FORWARD", 0x03, 0x02, true }, |
224 | { "LD_BLOCKS.DATA_UNKNOWN", 0x03, 0x01, true }, | | 224 | { "LD_BLOCKS.DATA_UNKNOWN", 0x03, 0x01, true }, |
225 | { "LD_BLOCKS.4K_ALIAS", 0x03, 0x04, true }, | | 225 | { "LD_BLOCKS.4K_ALIAS", 0x03, 0x04, true }, |
226 | { "PAGE_WALKS.D_SIDE_CYCLES", 0x05, 0x01, true }, | | 226 | { "PAGE_WALKS.D_SIDE_CYCLES", 0x05, 0x01, true }, |
227 | { "PAGE_WALKS.I_SIDE_CYCLES", 0x05, 0x02, true }, | | 227 | { "PAGE_WALKS.I_SIDE_CYCLES", 0x05, 0x02, true }, |
228 | { "PAGE_WALKS.CYCLES", 0x05, 0x03, true }, | | 228 | { "PAGE_WALKS.CYCLES", 0x05, 0x03, true }, |
229 | { "UOPS_ISSUED.ANY", 0x0e, 0x00, true }, | | 229 | { "UOPS_ISSUED.ANY", 0x0e, 0x00, true }, |
230 | { "MISALIGN_MEM_REF.LOAD_PAGE_SPLIT", 0x13, 0x02, true }, | | 230 | { "MISALIGN_MEM_REF.LOAD_PAGE_SPLIT", 0x13, 0x02, true }, |
231 | { "MISALIGN_MEM_REF.STORE_PAGE_SPLIT", 0x13, 0x04, true }, | | 231 | { "MISALIGN_MEM_REF.STORE_PAGE_SPLIT", 0x13, 0x04, true }, |
232 | { "LONGEST_LAT_CACHE.REFERENCE", 0x2e, 0x4f, true }, | | 232 | { "LONGEST_LAT_CACHE.REFERENCE", 0x2e, 0x4f, true }, |
233 | { "LONGEST_LAT_CACHE.MISS", 0x2e, 0x41, true }, | | 233 | { "LONGEST_LAT_CACHE.MISS", 0x2e, 0x41, true }, |
234 | { "L2_REJECT_XQ.ALL", 0x30, 0x00, true }, | | 234 | { "L2_REJECT_XQ.ALL", 0x30, 0x00, true }, |
235 | { "CORE_REJECT_L2Q.ALL", 0x31, 0x00, true }, | | 235 | { "CORE_REJECT_L2Q.ALL", 0x31, 0x00, true }, |
236 | { "CPU_CLK_UNHALTED.CORE_P", 0x3c, 0x00, true }, | | 236 | { "CPU_CLK_UNHALTED.CORE_P", 0x3c, 0x00, true }, |
237 | { "CPU_CLK_UNHALTED.REF", 0x3c, 0x01, true }, | | 237 | { "CPU_CLK_UNHALTED.REF", 0x3c, 0x01, true }, |
238 | { "DL1.DIRTY_EVICTION", 0x51, 0x01, true }, | | 238 | { "DL1.DIRTY_EVICTION", 0x51, 0x01, true }, |
239 | { "ICACHE.HIT", 0x80, 0x01, true }, | | 239 | { "ICACHE.HIT", 0x80, 0x01, true }, |
240 | { "ICACHE.MISSES", 0x80, 0x02, true }, | | 240 | { "ICACHE.MISSES", 0x80, 0x02, true }, |
241 | { "ICACHE.ACCESSES", 0x80, 0x03, true }, | | 241 | { "ICACHE.ACCESSES", 0x80, 0x03, true }, |
242 | { "ITLB.MISS", 0x81, 0x04, true }, | | 242 | { "ITLB.MISS", 0x81, 0x04, true }, |
243 | { "FETCH_STALL.ALL", 0x86, 0x00, true }, | | 243 | { "FETCH_STALL.ALL", 0x86, 0x00, true }, |
244 | { "FETCH_STALL.ITLB_FILL_PENDING_CYCLES", 0x86, 0x01, true }, | | 244 | { "FETCH_STALL.ITLB_FILL_PENDING_CYCLES", 0x86, 0x01, true }, |
245 | { "FETCH_STALL.ICACHE_FILL_PENDING_CYCLES", 0x86, 0x02, true }, | | 245 | { "FETCH_STALL.ICACHE_FILL_PENDING_CYCLES", 0x86, 0x02, true }, |
246 | { "UOPS_NOT_DELIVERED.ANY", 0x9c, 0x00, true }, | | 246 | { "UOPS_NOT_DELIVERED.ANY", 0x9c, 0x00, true }, |
247 | { "OFFCORE_RESPONSE.0", 0xb7, 0x01, true }, | | 247 | { "OFFCORE_RESPONSE.0", 0xb7, 0x01, true }, |
248 | { "OFFCORE_RESPONSE.1", 0xb7, 0x02, true }, | | 248 | { "OFFCORE_RESPONSE.1", 0xb7, 0x02, true }, |
249 | { "INST_RETIRED.ANY_P", 0xc0, 0x00, true }, | | 249 | { "INST_RETIRED.ANY_P", 0xc0, 0x00, true }, |
250 | { "UOPS_RETIRED.ANY", 0xc2, 0x00, true }, | | 250 | { "UOPS_RETIRED.ANY", 0xc2, 0x00, true }, |
251 | { "UOPS_RETIRED.MS", 0xc2, 0x01, true }, | | 251 | { "UOPS_RETIRED.MS", 0xc2, 0x01, true }, |
252 | { "UOPS_RETIRED.FPDIV", 0xc2, 0x08, true }, | | 252 | { "UOPS_RETIRED.FPDIV", 0xc2, 0x08, true }, |
253 | { "UOPS_RETIRED.IDIV", 0xc2, 0x10, true }, | | 253 | { "UOPS_RETIRED.IDIV", 0xc2, 0x10, true }, |
254 | { "MACHINE_CLEARS.SMC", 0xc3, 0x01, true }, | | 254 | { "MACHINE_CLEARS.SMC", 0xc3, 0x01, true }, |
255 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, | | 255 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, |
256 | { "MACHINE_CLEARS.FP_ASSIST", 0xc3, 0x04, true }, | | 256 | { "MACHINE_CLEARS.FP_ASSIST", 0xc3, 0x04, true }, |
257 | { "MACHINE_CLEARS.DISAMBIGUATION", 0xc3, 0x08, true }, | | 257 | { "MACHINE_CLEARS.DISAMBIGUATION", 0xc3, 0x08, true }, |
258 | { "MACHINE_CLEARS.ALL", 0xc3, 0x00, true }, | | 258 | { "MACHINE_CLEARS.ALL", 0xc3, 0x00, true }, |
259 | { "BR_INST_RETIRED.ALL_BRANCHES", 0xc4, 0x00, true }, | | 259 | { "BR_INST_RETIRED.ALL_BRANCHES", 0xc4, 0x00, true }, |
260 | { "BR_INST_RETIRED.JCC", 0xc4, 0x7e, true }, | | 260 | { "BR_INST_RETIRED.JCC", 0xc4, 0x7e, true }, |
261 | { "BR_INST_RETIRED.ALL_TAKEN_BRANCHES", 0xc4, 0x80, true }, | | 261 | { "BR_INST_RETIRED.ALL_TAKEN_BRANCHES", 0xc4, 0x80, true }, |
262 | { "BR_INST_RETIRED.TAKEN_JCC", 0xc4, 0xfe, true }, | | 262 | { "BR_INST_RETIRED.TAKEN_JCC", 0xc4, 0xfe, true }, |
263 | { "BR_INST_RETIRED.CALL", 0xc4, 0xf9, true }, | | 263 | { "BR_INST_RETIRED.CALL", 0xc4, 0xf9, true }, |
264 | { "BR_INST_RETIRED.REL_CALL", 0xc4, 0xfd, true }, | | 264 | { "BR_INST_RETIRED.REL_CALL", 0xc4, 0xfd, true }, |
265 | { "BR_INST_RETIRED.IND_CALL", 0xc4, 0xfb, true }, | | 265 | { "BR_INST_RETIRED.IND_CALL", 0xc4, 0xfb, true }, |
266 | { "BR_INST_RETIRED.RETURN", 0xc4, 0xf7, true }, | | 266 | { "BR_INST_RETIRED.RETURN", 0xc4, 0xf7, true }, |
267 | { "BR_INST_RETIRED.NON_RETURN_IND", 0xc4, 0xeb, true }, | | 267 | { "BR_INST_RETIRED.NON_RETURN_IND", 0xc4, 0xeb, true }, |
268 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0xbf, true }, | | 268 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0xbf, true }, |
269 | { "BR_MISP_RETIRED.ALL_BRANCHES", 0xc5, 0x00, true }, | | 269 | { "BR_MISP_RETIRED.ALL_BRANCHES", 0xc5, 0x00, true }, |
270 | { "BR_MISP_RETIRED.JCC", 0xc5, 0x7e, true }, | | 270 | { "BR_MISP_RETIRED.JCC", 0xc5, 0x7e, true }, |
271 | { "BR_MISP_RETIRED.TAKEN_JCC", 0xc5, 0xfe, true }, | | 271 | { "BR_MISP_RETIRED.TAKEN_JCC", 0xc5, 0xfe, true }, |
272 | { "BR_MISP_RETIRED.IND_CALL", 0xc5, 0xfb, true }, | | 272 | { "BR_MISP_RETIRED.IND_CALL", 0xc5, 0xfb, true }, |
273 | { "BR_MISP_RETIRED.RETURN", 0xc5, 0xf7, true }, | | 273 | { "BR_MISP_RETIRED.RETURN", 0xc5, 0xf7, true }, |
274 | { "BR_MISP_RETIRED.NON_RETURN_IND", 0xc5, 0xeb, true }, | | 274 | { "BR_MISP_RETIRED.NON_RETURN_IND", 0xc5, 0xeb, true }, |
275 | { "ISSUE_SLOTS_NOT_CONSUMED.RESOURCE_FULL", 0xca, 0x01, true }, | | 275 | { "ISSUE_SLOTS_NOT_CONSUMED.RESOURCE_FULL", 0xca, 0x01, true }, |
276 | { "ISSUE_SLOTS_NOT_CONSUMED.RECOVERY", 0xca, 0x02, true }, | | 276 | { "ISSUE_SLOTS_NOT_CONSUMED.RECOVERY", 0xca, 0x02, true }, |
277 | { "ISSUE_SLOTS_NOT_CONSUMED.ANY", 0xca, 0x00, true }, | | 277 | { "ISSUE_SLOTS_NOT_CONSUMED.ANY", 0xca, 0x00, true }, |
278 | { "HW_INTERRUPTS.RECEIVED", 0xcb, 0x01, true }, | | 278 | { "HW_INTERRUPTS.RECEIVED", 0xcb, 0x01, true }, |
279 | { "HW_INTERRUPTS.MASKED", 0xcb, 0x02, true }, | | 279 | { "HW_INTERRUPTS.MASKED", 0xcb, 0x02, true }, |
280 | { "HW_INTERRUPTS.PENDING_AND_MASKED", 0xcb, 0x04, true }, | | 280 | { "HW_INTERRUPTS.PENDING_AND_MASKED", 0xcb, 0x04, true }, |
281 | { "CYCLES_DIV_BUSY.ALL", 0xcd, 0x00, true }, | | 281 | { "CYCLES_DIV_BUSY.ALL", 0xcd, 0x00, true }, |
282 | { "CYCLES_DIV_BUSY.IDIV", 0xcd, 0x01, true }, | | 282 | { "CYCLES_DIV_BUSY.IDIV", 0xcd, 0x01, true }, |
283 | { "CYCLES_DIV_BUSY.FPDIV", 0xcd, 0x02, true }, | | 283 | { "CYCLES_DIV_BUSY.FPDIV", 0xcd, 0x02, true }, |
284 | { "MEM_UOPS_RETIRED.ALL_LOADS", 0xd0, 0x81, true }, | | 284 | { "MEM_UOPS_RETIRED.ALL_LOADS", 0xd0, 0x81, true }, |
285 | { "MEM_UOPS_RETIRED.ALL_STORES", 0xd0, 0x82, true }, | | 285 | { "MEM_UOPS_RETIRED.ALL_STORES", 0xd0, 0x82, true }, |
286 | { "MEM_UOPS_RETIRED.ALL", 0xd0, 0x83, true }, | | 286 | { "MEM_UOPS_RETIRED.ALL", 0xd0, 0x83, true }, |
287 | { "MEM_UOPS_RETIRED.DTLB_MISS_LOADS", 0xd0, 0x11, true }, | | 287 | { "MEM_UOPS_RETIRED.DTLB_MISS_LOADS", 0xd0, 0x11, true }, |
288 | { "MEM_UOPS_RETIRED.DTLB_MISS_STORES", 0xd0, 0x12, true }, | | 288 | { "MEM_UOPS_RETIRED.DTLB_MISS_STORES", 0xd0, 0x12, true }, |
289 | { "MEM_UOPS_RETIRED.DTLB_MISS", 0xd0, 0x13, true }, | | 289 | { "MEM_UOPS_RETIRED.DTLB_MISS", 0xd0, 0x13, true }, |
290 | { "MEM_UOPS_RETIRED.LOCK_LOADS", 0xd0, 0x21, true }, | | 290 | { "MEM_UOPS_RETIRED.LOCK_LOADS", 0xd0, 0x21, true }, |
291 | { "MEM_UOPS_RETIRED.SPLIT_LOADS", 0xd0, 0x41, true }, | | 291 | { "MEM_UOPS_RETIRED.SPLIT_LOADS", 0xd0, 0x41, true }, |
292 | { "MEM_UOPS_RETIRED.SPLIT_STORES", 0xd0, 0x42, true }, | | 292 | { "MEM_UOPS_RETIRED.SPLIT_STORES", 0xd0, 0x42, true }, |
293 | { "MEM_UOPS_RETIRED.SPLIT", 0xd0, 0x43, true }, | | 293 | { "MEM_UOPS_RETIRED.SPLIT", 0xd0, 0x43, true }, |
294 | { "MEM_LOAD_UOPS_RETIRED.L1_HIT", 0xd1, 0x01, true }, | | 294 | { "MEM_LOAD_UOPS_RETIRED.L1_HIT", 0xd1, 0x01, true }, |
295 | { "MEM_LOAD_UOPS_RETIRED.L1_MISS", 0xd1, 0x08, true }, | | 295 | { "MEM_LOAD_UOPS_RETIRED.L1_MISS", 0xd1, 0x08, true }, |
296 | { "MEM_LOAD_UOPS_RETIRED.L2_HIT", 0xd1, 0x02, true }, | | 296 | { "MEM_LOAD_UOPS_RETIRED.L2_HIT", 0xd1, 0x02, true }, |
297 | { "MEM_LOAD_UOPS_RETIRED.L2_MISS", 0xd1, 0x10, true }, | | 297 | { "MEM_LOAD_UOPS_RETIRED.L2_MISS", 0xd1, 0x10, true }, |
298 | { "MEM_LOAD_UOPS_RETIRED.HITM", 0xd1, 0x20, true }, | | 298 | { "MEM_LOAD_UOPS_RETIRED.HITM", 0xd1, 0x20, true }, |
299 | { "MEM_LOAD_UOPS_RETIRED.WCB_HIT", 0xd1, 0x40, true }, | | 299 | { "MEM_LOAD_UOPS_RETIRED.WCB_HIT", 0xd1, 0x40, true }, |
300 | { "MEM_LOAD_UOPS_RETIRED.DRAM_HIT", 0xd1, 0x80, true }, | | 300 | { "MEM_LOAD_UOPS_RETIRED.DRAM_HIT", 0xd1, 0x80, true }, |
301 | { "BACLEARS.ALL", 0xe6, 0x01, true }, | | 301 | { "BACLEARS.ALL", 0xe6, 0x01, true }, |
302 | { "BACLEARS.RETURN", 0xe6, 0x08, true }, | | 302 | { "BACLEARS.RETURN", 0xe6, 0x08, true }, |
303 | { "BACLEAR.CONDS", 0xe6, 0x10, true }, | | 303 | { "BACLEAR.CONDS", 0xe6, 0x10, true }, |
304 | { "MS_DECODED.MS_ENTRY", 0xe7, 0x01, true }, | | 304 | { "MS_DECODED.MS_ENTRY", 0xe7, 0x01, true }, |
305 | { "DECODED_RESTRICTION.PREDECODE_WRONG", 0xe9, 0x01, true }, | | 305 | { "DECODED_RESTRICTION.PREDECODE_WRONG", 0xe9, 0x01, true }, |
306 | }; | | 306 | }; |
307 | | | 307 | |
308 | static struct event_table intel_goldmont = { | | 308 | static struct event_table intel_goldmont = { |
309 | .tablename = "Intel Goldmont", | | 309 | .tablename = "Intel Goldmont", |
310 | .names = intel_goldmont_names, | | 310 | .names = intel_goldmont_names, |
311 | .nevents = sizeof(intel_goldmont_names) / | | 311 | .nevents = sizeof(intel_goldmont_names) / |
312 | sizeof(struct name_to_event), | | 312 | sizeof(struct name_to_event), |
313 | .next = NULL | | 313 | .next = NULL |
314 | }; | | 314 | }; |
315 | | | 315 | |
316 | static struct event_table * | | 316 | static struct event_table * |
317 | init_intel_goldmont(void) | | 317 | init_intel_goldmont(void) |
318 | { | | 318 | { |
319 | | | 319 | |
320 | return &intel_goldmont; | | 320 | return &intel_goldmont; |
321 | } | | 321 | } |
322 | | | 322 | |
323 | /* | | 323 | /* |
324 | * Intel Goldmont Plus (Additions from Goldmont) | | 324 | * Intel Goldmont Plus (Additions from Goldmont) |
325 | */ | | 325 | */ |
326 | static struct name_to_event intel_goldmontplus_names[] = { | | 326 | static struct name_to_event intel_goldmontplus_names[] = { |
327 | { "INST_RETIRED.ANY", 0x00, 0x01, true }, | | 327 | { "INST_RETIRED.ANY", 0x00, 0x01, true }, |
328 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_4K", 0x08, 0x02, true }, | | 328 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_4K", 0x08, 0x02, true }, |
329 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4M", 0x08, 0x04, true }, | | 329 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4M", 0x08, 0x04, true }, |
330 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_1GB", 0x08, 0x08, true }, | | 330 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_1GB", 0x08, 0x08, true }, |
331 | { "DTLB_LOAD_MISSES.WALK_PENDING", 0x08, 0x10, true }, | | 331 | { "DTLB_LOAD_MISSES.WALK_PENDING", 0x08, 0x10, true }, |
332 | { "DTLB_STORE_MISSES.WALK_COMPLETED_4K", 0x49, 0x02, true }, | | 332 | { "DTLB_STORE_MISSES.WALK_COMPLETED_4K", 0x49, 0x02, true }, |
333 | { "DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", 0x49, 0x04, true }, | | 333 | { "DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", 0x49, 0x04, true }, |
334 | { "DTLB_STORE_MISSES.WALK_COMPLETED_1GB", 0x49, 0x08, true }, | | 334 | { "DTLB_STORE_MISSES.WALK_COMPLETED_1GB", 0x49, 0x08, true }, |
335 | { "DTLB_STORE_MISSES.WALK_PENDING", 0x49, 0x10, true }, | | 335 | { "DTLB_STORE_MISSES.WALK_PENDING", 0x49, 0x10, true }, |
336 | { "EPT.WALK_PENDING", 0x4f, 0x10, true }, | | 336 | { "EPT.WALK_PENDING", 0x4f, 0x10, true }, |
337 | { "ITLB_MISSES.WALK_COMPLETED_4K", 0x85, 0x08, true }, | | 337 | { "ITLB_MISSES.WALK_COMPLETED_4K", 0x85, 0x08, true }, |
338 | { "ITLB_MISSES.WALK_COMPLETED_2M_4M", 0x85, 0x04, true }, | | 338 | { "ITLB_MISSES.WALK_COMPLETED_2M_4M", 0x85, 0x04, true }, |
339 | { "ITLB_MISSES.WALK_COMPLETED_1GB", 0x85, 0x08, true }, | | 339 | { "ITLB_MISSES.WALK_COMPLETED_1GB", 0x85, 0x08, true }, |
340 | { "ITLB_MISSES.WALK_PENDING", 0x85, 0x10, true }, | | 340 | { "ITLB_MISSES.WALK_PENDING", 0x85, 0x10, true }, |
341 | { "TLB_FLUSHES.STLB_ANY", 0xbd, 0x20, true }, | | 341 | { "TLB_FLUSHES.STLB_ANY", 0xbd, 0x20, true }, |
342 | { "MACHINE_CLEARS.PAGE_FAULT", 0xc3, 0x20, true }, | | 342 | { "MACHINE_CLEARS.PAGE_FAULT", 0xc3, 0x20, true }, |
343 | }; | | 343 | }; |
344 | | | 344 | |
345 | static struct event_table intel_goldmontplus = { | | 345 | static struct event_table intel_goldmontplus = { |
346 | .tablename = "Intel Goldmont Plus", | | 346 | .tablename = "Intel Goldmont Plus", |
347 | .names = intel_goldmontplus_names, | | 347 | .names = intel_goldmontplus_names, |
348 | .nevents = sizeof(intel_goldmontplus_names) / | | 348 | .nevents = sizeof(intel_goldmontplus_names) / |
349 | sizeof(struct name_to_event), | | 349 | sizeof(struct name_to_event), |
350 | .next = NULL | | 350 | .next = NULL |
351 | }; | | 351 | }; |
352 | | | 352 | |
353 | static struct event_table * | | 353 | static struct event_table * |
354 | init_intel_goldmontplus(void) | | 354 | init_intel_goldmontplus(void) |
355 | { | | 355 | { |
356 | | | 356 | |
357 | intel_goldmont.next = &intel_goldmontplus; | | 357 | intel_goldmont.next = &intel_goldmontplus; |
358 | | | 358 | |
359 | return &intel_goldmont; | | 359 | return &intel_goldmont; |
360 | } | | 360 | } |
361 | | | 361 | |
362 | /* | | 362 | /* |
363 | * Intel Skylake/Kabylake. | | 363 | * Intel Skylake/Kabylake. |
364 | * | | 364 | * |
365 | * The events that are not listed, because they are of little interest or | | 365 | * The events that are not listed, because they are of little interest or |
366 | * require extra configuration: | | 366 | * require extra configuration: |
367 | * TX_* | | 367 | * TX_* |
368 | * FRONTEND_RETIRED.* | | 368 | * FRONTEND_RETIRED.* |
369 | * FP_ARITH_INST_RETIRED.* | | 369 | * FP_ARITH_INST_RETIRED.* |
370 | * HLE_RETIRED.* | | 370 | * HLE_RETIRED.* |
371 | * RTM_RETIRED.* | | 371 | * RTM_RETIRED.* |
372 | * MEM_TRANS_RETIRED.* | | 372 | * MEM_TRANS_RETIRED.* |
373 | * UOPS_DISPATCHED_PORT.* | | 373 | * UOPS_DISPATCHED_PORT.* |
374 | */ | | 374 | */ |
375 | static struct name_to_event intel_skylake_kabylake_names[] = { | | 375 | static struct name_to_event intel_skylake_kabylake_names[] = { |
376 | /* Event Name - Event Select - UMask */ | | 376 | /* Event Name - Event Select - UMask */ |
377 | { "LD_BLOCKS.STORE_FORWARD", 0x03, 0x02, true }, | | 377 | { "LD_BLOCKS.STORE_FORWARD", 0x03, 0x02, true }, |
378 | { "LD_BLOCKS.NO_SR", 0x03, 0x08, true }, | | 378 | { "LD_BLOCKS.NO_SR", 0x03, 0x08, true }, |
379 | { "LD_BLOCKS_PARTIAL.ADDRESS_ALIAS", 0x07, 0x01, true }, | | 379 | { "LD_BLOCKS_PARTIAL.ADDRESS_ALIAS", 0x07, 0x01, true }, |
380 | { "DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK", 0x08, 0x01, true }, | | 380 | { "DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK", 0x08, 0x01, true }, |
381 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_4K", 0x08, 0x02, true }, | | 381 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_4K", 0x08, 0x02, true }, |
382 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4M", 0x08, 0x04, true }, | | 382 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4M", 0x08, 0x04, true }, |
383 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_1G", 0x08, 0x08, true }, | | 383 | { "DTLB_LOAD_MISSES.WALK_COMPLETED_1G", 0x08, 0x08, true }, |
384 | { "DTLB_LOAD_MISSES.WALK_COMPLETED", 0x08, 0x0e, true }, | | 384 | { "DTLB_LOAD_MISSES.WALK_COMPLETED", 0x08, 0x0e, true }, |
385 | { "DTLB_LOAD_MISSES.WALK_PENDING", 0x08, 0x10, true }, | | 385 | { "DTLB_LOAD_MISSES.WALK_PENDING", 0x08, 0x10, true }, |
386 | { "DTLB_LOAD_MISSES.STLB_HIT", 0x08, 0x20, true }, | | 386 | { "DTLB_LOAD_MISSES.STLB_HIT", 0x08, 0x20, true }, |
387 | { "INT_MISC.RECOVERY_CYCLES", 0x0d, 0x01, true }, | | 387 | { "INT_MISC.RECOVERY_CYCLES", 0x0d, 0x01, true }, |
388 | { "INT_MISC.CLEAR_RESTEER_CYCLES", 0x0d, 0x80, true }, | | 388 | { "INT_MISC.CLEAR_RESTEER_CYCLES", 0x0d, 0x80, true }, |
389 | { "UOPS_ISSUED.ANY", 0x0e, 0x01, true }, | | 389 | { "UOPS_ISSUED.ANY", 0x0e, 0x01, true }, |
390 | { "UOPS_ISSUED.VECTOR_WIDTH_MISMATCH", 0x0e, 0x02, true }, | | 390 | { "UOPS_ISSUED.VECTOR_WIDTH_MISMATCH", 0x0e, 0x02, true }, |
391 | { "UOPS_ISSUED.SLOW_LEA", 0x0e, 0x20, true }, | | 391 | { "UOPS_ISSUED.SLOW_LEA", 0x0e, 0x20, true }, |
392 | { "L2_RQSTS.DEMAND_DATA_RD_MISS", 0x24, 0x21, true }, | | 392 | { "L2_RQSTS.DEMAND_DATA_RD_MISS", 0x24, 0x21, true }, |
393 | { "L2_RQSTS.RFO_MISS", 0x24, 0x22, true }, | | 393 | { "L2_RQSTS.RFO_MISS", 0x24, 0x22, true }, |
394 | { "L2_RQSTS.CODE_RD_MISS", 0x24, 0x24, true }, | | 394 | { "L2_RQSTS.CODE_RD_MISS", 0x24, 0x24, true }, |
395 | { "L2_RQSTS.ALL_DEMAND_MISS", 0x24, 0x27, true }, | | 395 | { "L2_RQSTS.ALL_DEMAND_MISS", 0x24, 0x27, true }, |
396 | { "L2_RQSTS.PF_MISS", 0x24, 0x38, true }, | | 396 | { "L2_RQSTS.PF_MISS", 0x24, 0x38, true }, |
397 | { "L2_RQSTS.MISS", 0x24, 0x3f, true }, | | 397 | { "L2_RQSTS.MISS", 0x24, 0x3f, true }, |
398 | { "L2_RQSTS.DEMAND_DATA_RD_HIT", 0x24, 0x41, true }, | | 398 | { "L2_RQSTS.DEMAND_DATA_RD_HIT", 0x24, 0x41, true }, |
399 | { "L2_RQSTS.RFO_HIT", 0x24, 0x42, true }, | | 399 | { "L2_RQSTS.RFO_HIT", 0x24, 0x42, true }, |
400 | { "L2_RQSTS.CODE_RD_HIT", 0x24, 0x44, true }, | | 400 | { "L2_RQSTS.CODE_RD_HIT", 0x24, 0x44, true }, |
401 | { "L2_RQSTS.PF_HIT", 0x24, 0xd8, true }, | | 401 | { "L2_RQSTS.PF_HIT", 0x24, 0xd8, true }, |
402 | { "L2_RQSTS.ALL_DEMAND_DATA_RD", 0x24, 0xe1, true }, | | 402 | { "L2_RQSTS.ALL_DEMAND_DATA_RD", 0x24, 0xe1, true }, |
403 | { "L2_RQSTS.ALL_RFO", 0x24, 0xe2, true }, | | 403 | { "L2_RQSTS.ALL_RFO", 0x24, 0xe2, true }, |
404 | { "L2_RQSTS.ALL_CODE_RD", 0x24, 0xe4, true }, | | 404 | { "L2_RQSTS.ALL_CODE_RD", 0x24, 0xe4, true }, |
405 | { "L2_RQSTS.ALL_DEMAND_REFERENCES", 0x24, 0xe7, true }, | | 405 | { "L2_RQSTS.ALL_DEMAND_REFERENCES", 0x24, 0xe7, true }, |
406 | { "L2_RQSTS.ALL_PF", 0x24, 0xf8, true }, | | 406 | { "L2_RQSTS.ALL_PF", 0x24, 0xf8, true }, |
407 | { "L2_RQSTS.REFERENCES", 0x24, 0xff, true }, | | 407 | { "L2_RQSTS.REFERENCES", 0x24, 0xff, true }, |
408 | { "SW_PREFETCH_ACCESS.NTA", 0x32, 0x01, true }, | | 408 | { "SW_PREFETCH_ACCESS.NTA", 0x32, 0x01, true }, |
409 | { "SW_PREFETCH_ACCESS.T0", 0x32, 0x02, true }, | | 409 | { "SW_PREFETCH_ACCESS.T0", 0x32, 0x02, true }, |
410 | { "SW_PREFETCH_ACCESS.T1_T2", 0x32, 0x04, true }, | | 410 | { "SW_PREFETCH_ACCESS.T1_T2", 0x32, 0x04, true }, |
411 | { "SW_PREFETCH_ACCESS.PREFETCHW", 0x32, 0x08, true }, | | 411 | { "SW_PREFETCH_ACCESS.PREFETCHW", 0x32, 0x08, true }, |
412 | { "CPU_CLK_THREAD_UNHALTED.ONE_THREAD_ACTIVE", 0x3c, 0x02, true }, | | 412 | { "CPU_CLK_THREAD_UNHALTED.ONE_THREAD_ACTIVE", 0x3c, 0x02, true }, |
413 | { "CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE", 0x3c, 0x02, true }, | | 413 | { "CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE", 0x3c, 0x02, true }, |
414 | { "L1D_PEND_MISS.PENDING", 0x48, 0x01, true }, | | 414 | { "L1D_PEND_MISS.PENDING", 0x48, 0x01, true }, |
415 | { "L1D_PEND_MISS.FB_FULL", 0x48, 0x02, true }, | | 415 | { "L1D_PEND_MISS.FB_FULL", 0x48, 0x02, true }, |
416 | { "DTLB_STORE_MISSES.MISS_CAUSES_A_WALK", 0x49, 0x01, true }, | | 416 | { "DTLB_STORE_MISSES.MISS_CAUSES_A_WALK", 0x49, 0x01, true }, |
417 | { "DTLB_STORE_MISSES.WALK_COMPLETED_4K", 0x49, 0x02, true }, | | 417 | { "DTLB_STORE_MISSES.WALK_COMPLETED_4K", 0x49, 0x02, true }, |
418 | { "DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", 0x49, 0x04, true }, | | 418 | { "DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", 0x49, 0x04, true }, |
419 | { "DTLB_STORE_MISSES.WALK_COMPLETED_1G", 0x49, 0x08, true }, | | 419 | { "DTLB_STORE_MISSES.WALK_COMPLETED_1G", 0x49, 0x08, true }, |
420 | { "DTLB_STORE_MISSES.WALK_COMPLETED", 0x49, 0x0e, true }, | | 420 | { "DTLB_STORE_MISSES.WALK_COMPLETED", 0x49, 0x0e, true }, |
421 | { "DTLB_STORE_MISSES.WALK_PENDING", 0x49, 0x10, true }, | | 421 | { "DTLB_STORE_MISSES.WALK_PENDING", 0x49, 0x10, true }, |
422 | { "DTLB_STORE_MISSES.STLB_HIT", 0x49, 0x20, true }, | | 422 | { "DTLB_STORE_MISSES.STLB_HIT", 0x49, 0x20, true }, |
423 | { "LOAD_HIT_PRE.SW_PF", 0x4c, 0x01, true }, | | 423 | { "LOAD_HIT_PRE.SW_PF", 0x4c, 0x01, true }, |
424 | { "EPT.WALK_PENDING", 0x4f, 0x10, true }, | | 424 | { "EPT.WALK_PENDING", 0x4f, 0x10, true }, |
425 | { "L1D.REPLACEMENT", 0x51, 0x01, true }, | | 425 | { "L1D.REPLACEMENT", 0x51, 0x01, true }, |
426 | { "RS_EVENTS.EMPTY_CYCLES", 0x5e, 0x01, true }, | | 426 | { "RS_EVENTS.EMPTY_CYCLES", 0x5e, 0x01, true }, |
427 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD", 0x60, 0x01, true }, | | 427 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD", 0x60, 0x01, true }, |
428 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD", 0x60, 0x02, true }, | | 428 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD", 0x60, 0x02, true }, |
429 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO", 0x60, 0x04, true }, | | 429 | { "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO", 0x60, 0x04, true }, |
430 | { "OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD", 0x60, 0x08, true }, | | 430 | { "OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD", 0x60, 0x08, true }, |
431 | { "OFFCORE_REQUESTS_OUTSTANDING.L3_MISS_DEMAND_DATA_RD", | | 431 | { "OFFCORE_REQUESTS_OUTSTANDING.L3_MISS_DEMAND_DATA_RD", |
432 | 0x60, 0x10, true }, | | 432 | 0x60, 0x10, true }, |
433 | { "IDQ.MITE_UOPS", 0x79, 0x04, true }, | | 433 | { "IDQ.MITE_UOPS", 0x79, 0x04, true }, |
434 | { "IDQ.DSB_UOPS", 0x79, 0x08, true }, | | 434 | { "IDQ.DSB_UOPS", 0x79, 0x08, true }, |
435 | { "IDQ.MS_MITE_UOPS", 0x79, 0x20, true }, | | 435 | { "IDQ.MS_MITE_UOPS", 0x79, 0x20, true }, |
436 | { "IDQ.MS_UOPS", 0x79, 0x30, true }, | | 436 | { "IDQ.MS_UOPS", 0x79, 0x30, true }, |
437 | { "ICACHE_16B.IFDATA_STALL", 0x80, 0x04, true }, | | 437 | { "ICACHE_16B.IFDATA_STALL", 0x80, 0x04, true }, |
438 | { "ICACHE_64B.IFTAG_HIT", 0x83, 0x01, true }, | | 438 | { "ICACHE_64B.IFTAG_HIT", 0x83, 0x01, true }, |
439 | { "ICACHE_64B.IFTAG_MISS", 0x83, 0x02, true }, | | 439 | { "ICACHE_64B.IFTAG_MISS", 0x83, 0x02, true }, |
440 | { "ICACHE_64B.IFTAG_STALL", 0x83, 0x04, true }, | | 440 | { "ICACHE_64B.IFTAG_STALL", 0x83, 0x04, true }, |
441 | { "ITLB_MISSES.MISS_CAUSES_A_WALK", 0x85, 0x01, true }, | | 441 | { "ITLB_MISSES.MISS_CAUSES_A_WALK", 0x85, 0x01, true }, |
442 | { "ITLB_MISSES.WALK_COMPLETED_4K", 0x85, 0x02, true }, | | 442 | { "ITLB_MISSES.WALK_COMPLETED_4K", 0x85, 0x02, true }, |
443 | { "ITLB_MISSES.WALK_COMPLETED_2M_4M", 0x85, 0x04, true }, | | 443 | { "ITLB_MISSES.WALK_COMPLETED_2M_4M", 0x85, 0x04, true }, |
444 | { "ITLB_MISSES.WALK_COMPLETED_1G", 0x85, 0x08, true }, | | 444 | { "ITLB_MISSES.WALK_COMPLETED_1G", 0x85, 0x08, true }, |
445 | { "ITLB_MISSES.WALK_COMPLETED", 0x85, 0x0e, true }, | | 445 | { "ITLB_MISSES.WALK_COMPLETED", 0x85, 0x0e, true }, |
446 | { "ITLB_MISSES.WALK_PENDING", 0x85, 0x10, true }, | | 446 | { "ITLB_MISSES.WALK_PENDING", 0x85, 0x10, true }, |
447 | { "ITLB_MISSES.STLB_HIT", 0x85, 0x20, true }, | | 447 | { "ITLB_MISSES.STLB_HIT", 0x85, 0x20, true }, |
448 | { "ILD_STALL.LCP", 0x87, 0x01, true }, | | 448 | { "ILD_STALL.LCP", 0x87, 0x01, true }, |
449 | { "IDQ_UOPS_NOT_DELIVERED.CORE", 0x9c, 0x01, true }, | | 449 | { "IDQ_UOPS_NOT_DELIVERED.CORE", 0x9c, 0x01, true }, |
450 | { "RESOURCE_STALLS.ANY", 0xa2, 0x01, true }, | | 450 | { "RESOURCE_STALLS.ANY", 0xa2, 0x01, true }, |
451 | { "RESOURCE_STALLS.SB", 0xa2, 0x08, true }, | | 451 | { "RESOURCE_STALLS.SB", 0xa2, 0x08, true }, |
452 | { "EXE_ACTIVITY.EXE_BOUND_0_PORTS", 0xa6, 0x01, true }, | | 452 | { "EXE_ACTIVITY.EXE_BOUND_0_PORTS", 0xa6, 0x01, true }, |
453 | { "EXE_ACTIVITY.1_PORTS_UTIL", 0xa6, 0x02, true }, | | 453 | { "EXE_ACTIVITY.1_PORTS_UTIL", 0xa6, 0x02, true }, |
454 | { "EXE_ACTIVITY.2_PORTS_UTIL", 0xa6, 0x04, true }, | | 454 | { "EXE_ACTIVITY.2_PORTS_UTIL", 0xa6, 0x04, true }, |
455 | { "EXE_ACTIVITY.3_PORTS_UTIL", 0xa6, 0x08, true }, | | 455 | { "EXE_ACTIVITY.3_PORTS_UTIL", 0xa6, 0x08, true }, |
456 | { "EXE_ACTIVITY.4_PORTS_UTIL", 0xa6, 0x10, true }, | | 456 | { "EXE_ACTIVITY.4_PORTS_UTIL", 0xa6, 0x10, true }, |
457 | { "EXE_ACTIVITY.BOUND_ON_STORES", 0xa6, 0x40, true }, | | 457 | { "EXE_ACTIVITY.BOUND_ON_STORES", 0xa6, 0x40, true }, |
458 | { "LSD.UOPS", 0xa8, 0x01, true }, | | 458 | { "LSD.UOPS", 0xa8, 0x01, true }, |
459 | { "DSB2MITE_SWITCHES.PENALTY_CYCLES", 0xab, 0x02, true }, | | 459 | { "DSB2MITE_SWITCHES.PENALTY_CYCLES", 0xab, 0x02, true }, |
460 | { "ITLB.ITLB_FLUSH", 0xae, 0x01, true }, | | 460 | { "ITLB.ITLB_FLUSH", 0xae, 0x01, true }, |
461 | { "OFFCORE_REQUESTS.DEMAND_DATA_RD", 0xb0, 0x01, true }, | | 461 | { "OFFCORE_REQUESTS.DEMAND_DATA_RD", 0xb0, 0x01, true }, |
462 | { "OFFCORE_REQUESTS.DEMAND_CODE_RD", 0xb0, 0x02, true }, | | 462 | { "OFFCORE_REQUESTS.DEMAND_CODE_RD", 0xb0, 0x02, true }, |
463 | { "OFFCORE_REQUESTS.DEMAND_RFO", 0xb0, 0x04, true }, | | 463 | { "OFFCORE_REQUESTS.DEMAND_RFO", 0xb0, 0x04, true }, |
464 | { "OFFCORE_REQUESTS.ALL_DATA_RD", 0xb0, 0x08, true }, | | 464 | { "OFFCORE_REQUESTS.ALL_DATA_RD", 0xb0, 0x08, true }, |
465 | { "OFFCORE_REQUESTS.L3_MISS_DEMAND_DATA_RD", 0xb0, 0x10, true }, | | 465 | { "OFFCORE_REQUESTS.L3_MISS_DEMAND_DATA_RD", 0xb0, 0x10, true }, |
466 | { "OFFCORE_REQUESTS.ALL_REQUESTS", 0xb0, 0x80, true }, | | 466 | { "OFFCORE_REQUESTS.ALL_REQUESTS", 0xb0, 0x80, true }, |
467 | { "UOPS_EXECUTED.THREAD", 0xb1, 0x01, true }, | | 467 | { "UOPS_EXECUTED.THREAD", 0xb1, 0x01, true }, |
468 | { "UOPS_EXECUTED.CORE", 0xb1, 0x02, true }, | | 468 | { "UOPS_EXECUTED.CORE", 0xb1, 0x02, true }, |
469 | { "UOPS_EXECUTED.X87", 0xb1, 0x10, true }, | | 469 | { "UOPS_EXECUTED.X87", 0xb1, 0x10, true }, |
470 | { "OFFCORE_REQUESTS_BUFFER.SQ_FULL", 0xb2, 0x01, true }, | | 470 | { "OFFCORE_REQUESTS_BUFFER.SQ_FULL", 0xb2, 0x01, true }, |
471 | { "TLB_FLUSH.DTLB_THREAD", 0xbd, 0x01, true }, | | 471 | { "TLB_FLUSH.DTLB_THREAD", 0xbd, 0x01, true }, |
472 | { "TLB_FLUSH.STLB_ANY", 0xbd, 0x20, true }, | | 472 | { "TLB_FLUSH.STLB_ANY", 0xbd, 0x20, true }, |
473 | { "INST_RETIRED.PREC_DIST", 0xc0, 0x01, true }, | | 473 | { "INST_RETIRED.PREC_DIST", 0xc0, 0x01, true }, |
474 | { "OTHER_ASSISTS.ANY", 0xc1, 0x3f, true }, | | 474 | { "OTHER_ASSISTS.ANY", 0xc1, 0x3f, true }, |
475 | { "UOPS_RETIRED.RETIRE_SLOTS", 0xc2, 0x02, true }, | | 475 | { "UOPS_RETIRED.RETIRE_SLOTS", 0xc2, 0x02, true }, |
476 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, | | 476 | { "MACHINE_CLEARS.MEMORY_ORDERING", 0xc3, 0x02, true }, |
477 | { "MACHINE_CLEARS.SMC", 0xc3, 0x04, true }, | | 477 | { "MACHINE_CLEARS.SMC", 0xc3, 0x04, true }, |
478 | { "BR_INST_RETIRED.CONDITIONAL", 0xc4, 0x01, true }, | | 478 | { "BR_INST_RETIRED.CONDITIONAL", 0xc4, 0x01, true }, |
479 | { "BR_INST_RETIRED.NEAR_CALL", 0xc4, 0x02, true }, | | 479 | { "BR_INST_RETIRED.NEAR_CALL", 0xc4, 0x02, true }, |
480 | { "BR_INST_RETIRED.NEAR_RETURN", 0xc4, 0x08, true }, | | 480 | { "BR_INST_RETIRED.NEAR_RETURN", 0xc4, 0x08, true }, |
481 | { "BR_INST_RETIRED.NOT_TAKEN", 0xc4, 0x10, true }, | | 481 | { "BR_INST_RETIRED.NOT_TAKEN", 0xc4, 0x10, true }, |
482 | { "BR_INST_RETIRED.NEAR_TAKEN", 0xc4, 0x20, true }, | | 482 | { "BR_INST_RETIRED.NEAR_TAKEN", 0xc4, 0x20, true }, |
483 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0x40, true }, | | 483 | { "BR_INST_RETIRED.FAR_BRANCH", 0xc4, 0x40, true }, |
484 | { "BR_MISP_RETIRED.CONDITIONAL", 0xc5, 0x01, true }, | | 484 | { "BR_MISP_RETIRED.CONDITIONAL", 0xc5, 0x01, true }, |
485 | { "BR_MISP_RETIRED.NEAR_CALL", 0xc5, 0x02, true }, | | 485 | { "BR_MISP_RETIRED.NEAR_CALL", 0xc5, 0x02, true }, |
486 | { "BR_MISP_RETIRED.NEAR_TAKEN", 0xc5, 0x20, true }, | | 486 | { "BR_MISP_RETIRED.NEAR_TAKEN", 0xc5, 0x20, true }, |
487 | { "HW_INTERRUPTS.RECEIVED", 0xcb, 0x01, true }, | | 487 | { "HW_INTERRUPTS.RECEIVED", 0xcb, 0x01, true }, |
488 | { "MEM_INST_RETIRED.STLB_MISS_LOADS", 0xd0, 0x11, true }, | | 488 | { "MEM_INST_RETIRED.STLB_MISS_LOADS", 0xd0, 0x11, true }, |
489 | { "MEM_INST_RETIRED.STLB_MISS_STORES", 0xd0, 0x12, true }, | | 489 | { "MEM_INST_RETIRED.STLB_MISS_STORES", 0xd0, 0x12, true }, |
490 | { "MEM_INST_RETIRED.LOCK_LOADS", 0xd0, 0x21, true }, | | 490 | { "MEM_INST_RETIRED.LOCK_LOADS", 0xd0, 0x21, true }, |
491 | { "MEM_INST_RETIRED.SPLIT_LOADS", 0xd0, 0x41, true }, | | 491 | { "MEM_INST_RETIRED.SPLIT_LOADS", 0xd0, 0x41, true }, |
492 | { "MEM_INST_RETIRED.SPLIT_STORES", 0xd0, 0x42, true }, | | 492 | { "MEM_INST_RETIRED.SPLIT_STORES", 0xd0, 0x42, true }, |
493 | { "MEM_INST_RETIRED.ALL_LOADS", 0xd0, 0x81, true }, | | 493 | { "MEM_INST_RETIRED.ALL_LOADS", 0xd0, 0x81, true }, |
494 | { "MEM_INST_RETIRED.ALL_STORES", 0xd0, 0x82, true }, | | 494 | { "MEM_INST_RETIRED.ALL_STORES", 0xd0, 0x82, true }, |
495 | { "MEM_LOAD_RETIRED.L1_HIT", 0xd1, 0x01, true }, | | 495 | { "MEM_LOAD_RETIRED.L1_HIT", 0xd1, 0x01, true }, |
496 | { "MEM_LOAD_RETIRED.L2_HIT", 0xd1, 0x02, true }, | | 496 | { "MEM_LOAD_RETIRED.L2_HIT", 0xd1, 0x02, true }, |
497 | { "MEM_LOAD_RETIRED.L3_HIT", 0xd1, 0x04, true }, | | 497 | { "MEM_LOAD_RETIRED.L3_HIT", 0xd1, 0x04, true }, |
498 | { "MEM_LOAD_RETIRED.L1_MISS", 0xd1, 0x08, true }, | | 498 | { "MEM_LOAD_RETIRED.L1_MISS", 0xd1, 0x08, true }, |
499 | { "MEM_LOAD_RETIRED.L2_MISS", 0xd1, 0x10, true }, | | 499 | { "MEM_LOAD_RETIRED.L2_MISS", 0xd1, 0x10, true }, |
500 | { "MEM_LOAD_RETIRED.L3_MISS", 0xd1, 0x20, true }, | | 500 | { "MEM_LOAD_RETIRED.L3_MISS", 0xd1, 0x20, true }, |
501 | { "MEM_LOAD_RETIRED.FB_HIT", 0xd1, 0x40, true }, | | 501 | { "MEM_LOAD_RETIRED.FB_HIT", 0xd1, 0x40, true }, |
502 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_MISS", 0xd2, 0x01, true }, | | 502 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_MISS", 0xd2, 0x01, true }, |
503 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_HIT", 0xd2, 0x02, true }, | | 503 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_HIT", 0xd2, 0x02, true }, |
504 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_HITM", 0xd2, 0x04, true }, | | 504 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_HITM", 0xd2, 0x04, true }, |
505 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_NONE", 0xd2, 0x08, true }, | | 505 | { "MEM_LOAD_L3_HIT_RETIRED.XSNP_NONE", 0xd2, 0x08, true }, |
506 | { "MEM_LOAD_MISC_RETIRED.UC", 0xd4, 0x04, true }, | | 506 | { "MEM_LOAD_MISC_RETIRED.UC", 0xd4, 0x04, true }, |
507 | { "BACLEARS.ANY", 0xe6, 0x01, true }, | | 507 | { "BACLEARS.ANY", 0xe6, 0x01, true }, |
508 | { "L2_TRANS.L2_WB", 0xf0, 0x40, true }, | | 508 | { "L2_TRANS.L2_WB", 0xf0, 0x40, true }, |
509 | { "L2_LINES_IN.ALL", 0xf1, 0x1f, true }, | | 509 | { "L2_LINES_IN.ALL", 0xf1, 0x1f, true }, |
510 | { "L2_LINES_OUT.SILENT", 0xf2, 0x01, true }, | | 510 | { "L2_LINES_OUT.SILENT", 0xf2, 0x01, true }, |
511 | { "L2_LINES_OUT.NON_SILENT", 0xf2, 0x02, true }, | | 511 | { "L2_LINES_OUT.NON_SILENT", 0xf2, 0x02, true }, |
512 | { "L2_LINES_OUT.USELESS_HWPF", 0xf2, 0x04, true }, | | 512 | { "L2_LINES_OUT.USELESS_HWPF", 0xf2, 0x04, true }, |
513 | { "SQ_MISC.SPLIT_LOCK", 0xf4, 0x10, true }, | | 513 | { "SQ_MISC.SPLIT_LOCK", 0xf4, 0x10, true }, |
514 | }; | | 514 | }; |
515 | | | 515 | |
516 | static struct event_table intel_skylake_kabylake = { | | 516 | static struct event_table intel_skylake_kabylake = { |
517 | .tablename = "Intel Skylake/Kabylake", | | 517 | .tablename = "Intel Skylake/Kabylake", |
518 | .names = intel_skylake_kabylake_names, | | 518 | .names = intel_skylake_kabylake_names, |
519 | .nevents = sizeof(intel_skylake_kabylake_names) / | | 519 | .nevents = sizeof(intel_skylake_kabylake_names) / |
520 | sizeof(struct name_to_event), | | 520 | sizeof(struct name_to_event), |
521 | .next = NULL | | 521 | .next = NULL |
522 | }; | | 522 | }; |
523 | | | 523 | |
524 | static struct event_table * | | 524 | static struct event_table * |
525 | init_intel_skylake_kabylake(void) | | 525 | init_intel_skylake_kabylake(void) |
526 | { | | 526 | { |
527 | | | 527 | |
528 | return &intel_skylake_kabylake; | | 528 | return &intel_skylake_kabylake; |
529 | } | | 529 | } |
530 | | | 530 | |
531 | static struct event_table * | | 531 | static struct event_table * |
532 | init_intel_generic(void) | | 532 | init_intel_generic(void) |
533 | { | | 533 | { |
534 | unsigned int eax, ebx, ecx, edx; | | 534 | unsigned int eax, ebx, ecx, edx; |
535 | struct event_table *table; | | 535 | struct event_table *table; |
536 | | | 536 | |
537 | /* | | 537 | /* |
538 | * The kernel made sure the Architectural Version 1 PMCs were | | 538 | * The kernel made sure the Architectural Version 1 PMCs were |
539 | * present. | | 539 | * present. |
540 | */ | | 540 | */ |
541 | table = init_intel_arch1(); | | 541 | table = init_intel_arch1(); |
542 | | | 542 | |
543 | /* | | 543 | /* |
544 | * Now query the additional (non-architectural) events. They | | 544 | * Now query the additional (non-architectural) events. They |
545 | * depend on the CPU model. | | 545 | * depend on the CPU model. |
546 | */ | | 546 | */ |
547 | eax = 0x01; | | 547 | eax = 0x01; |
548 | ebx = 0; | | 548 | ebx = 0; |
549 | ecx = 0; | | 549 | ecx = 0; |
550 | edx = 0; | | 550 | edx = 0; |
551 | x86_cpuid(&eax, &ebx, &ecx, &edx); | | 551 | x86_cpuid(&eax, &ebx, &ecx, &edx); |
552 | | | 552 | |
553 | if (CPUID_TO_FAMILY(eax) == 6) { | | 553 | if (CPUID_TO_FAMILY(eax) == 6) { |
554 | switch (CPUID_TO_MODEL(eax)) { | | 554 | switch (CPUID_TO_MODEL(eax)) { |
555 | case 0x37: /* Silvermont (Bay Trail) */ | | 555 | case 0x37: /* Silvermont (Bay Trail) */ |
556 | case 0x4a: /* Silvermont (Tangier) */ | | 556 | case 0x4a: /* Silvermont (Tangier) */ |
557 | case 0x4c: /* Airmont (Braswell, Cherry Trail) */ | | 557 | case 0x4c: /* Airmont (Braswell, Cherry Trail) */ |
558 | case 0x4d: /* Silvermont (Avoton, Rangeley) */ | | 558 | case 0x4d: /* Silvermont (Avoton, Rangeley) */ |
559 | case 0x5a: /* Silvermont (Anniedale) */ | | 559 | case 0x5a: /* Silvermont (Anniedale) */ |
560 | case 0x5d: /* Silvermont (SoFIA) */ | | 560 | case 0x5d: /* Silvermont (SoFIA) */ |
561 | table->next = init_intel_silvermont_airmont(); | | 561 | table->next = init_intel_silvermont_airmont(); |
562 | break; | | 562 | break; |
563 | case 0x5c: /* Goldmont (Apollo Lake) */ | | 563 | case 0x5c: /* Goldmont (Apollo Lake) */ |
564 | case 0x5f: /* Goldmont (Denverton) */ | | 564 | case 0x5f: /* Goldmont (Denverton) */ |
565 | table->next = init_intel_goldmont(); | | 565 | table->next = init_intel_goldmont(); |
566 | break; | | 566 | break; |
567 | case 0x7a: /* Goldmont Plus (Gemini Lake) */ | | 567 | case 0x7a: /* Goldmont Plus (Gemini Lake) */ |
568 | table->next = init_intel_goldmontplus(); | | 568 | table->next = init_intel_goldmontplus(); |
569 | break; | | 569 | break; |
570 | case 0x4e: /* Skylake */ | | 570 | case 0x4e: /* Skylake */ |
571 | case 0x5e: /* Skylake */ | | 571 | case 0x5e: /* Skylake */ |
572 | case 0x8e: /* Kabylake */ | | 572 | case 0x8e: /* Kabylake */ |
573 | case 0x9e: /* Kabylake */ | | 573 | case 0x9e: /* Kabylake */ |
| | | 574 | case 0xa5: /* Cometlake */ |
| | | 575 | case 0xa6: /* Cometlake */ |
574 | table->next = init_intel_skylake_kabylake(); | | 576 | table->next = init_intel_skylake_kabylake(); |
575 | break; | | 577 | break; |
576 | } | | 578 | } |
577 | } | | 579 | } |
578 | | | 580 | |
579 | return table; | | 581 | return table; |
580 | } | | 582 | } |
581 | | | 583 | |
582 | /* ------------------------------------------------------------------------- */ | | 584 | /* ------------------------------------------------------------------------- */ |
583 | | | 585 | |
584 | /* | | 586 | /* |
585 | * AMD Family 10h | | 587 | * AMD Family 10h |
586 | */ | | 588 | */ |
587 | static struct name_to_event amd_f10h_names[] = { | | 589 | static struct name_to_event amd_f10h_names[] = { |
588 | { "seg-load-all", 0x20, 0x7f, true }, | | 590 | { "seg-load-all", 0x20, 0x7f, true }, |
589 | { "seg-load-es", 0x20, 0x01, true }, | | 591 | { "seg-load-es", 0x20, 0x01, true }, |
590 | { "seg-load-cs", 0x20, 0x02, true }, | | 592 | { "seg-load-cs", 0x20, 0x02, true }, |
591 | { "seg-load-ss", 0x20, 0x04, true }, | | 593 | { "seg-load-ss", 0x20, 0x04, true }, |
592 | { "seg-load-ds", 0x20, 0x08, true }, | | 594 | { "seg-load-ds", 0x20, 0x08, true }, |
593 | { "seg-load-fs", 0x20, 0x10, true }, | | 595 | { "seg-load-fs", 0x20, 0x10, true }, |
594 | { "seg-load-gs", 0x20, 0x20, true }, | | 596 | { "seg-load-gs", 0x20, 0x20, true }, |
595 | { "seg-load-hs", 0x20, 0x40, true }, | | 597 | { "seg-load-hs", 0x20, 0x40, true }, |
596 | { "l1cache-access", 0x40, 0x00, true }, | | 598 | { "l1cache-access", 0x40, 0x00, true }, |
597 | { "l1cache-miss", 0x41, 0x00, true }, | | 599 | { "l1cache-miss", 0x41, 0x00, true }, |
598 | { "l1cache-refill", 0x42, 0x1f, true }, | | 600 | { "l1cache-refill", 0x42, 0x1f, true }, |
599 | { "l1cache-refill-invalid", 0x42, 0x01, true }, | | 601 | { "l1cache-refill-invalid", 0x42, 0x01, true }, |
600 | { "l1cache-refill-shared", 0x42, 0x02, true }, | | 602 | { "l1cache-refill-shared", 0x42, 0x02, true }, |
601 | { "l1cache-refill-exclusive", 0x42, 0x04, true }, | | 603 | { "l1cache-refill-exclusive", 0x42, 0x04, true }, |
602 | { "l1cache-refill-owner", 0x42, 0x08, true }, | | 604 | { "l1cache-refill-owner", 0x42, 0x08, true }, |
603 | { "l1cache-refill-modified", 0x42, 0x10, true }, | | 605 | { "l1cache-refill-modified", 0x42, 0x10, true }, |
604 | { "l1cache-load", 0x43, 0x1f, true }, | | 606 | { "l1cache-load", 0x43, 0x1f, true }, |
605 | { "l1cache-load-invalid", 0x43, 0x01, true }, | | 607 | { "l1cache-load-invalid", 0x43, 0x01, true }, |
606 | { "l1cache-load-shared", 0x43, 0x02, true }, | | 608 | { "l1cache-load-shared", 0x43, 0x02, true }, |
607 | { "l1cache-load-exclusive", 0x43, 0x04, true }, | | 609 | { "l1cache-load-exclusive", 0x43, 0x04, true }, |
608 | { "l1cache-load-owner", 0x43, 0x08, true }, | | 610 | { "l1cache-load-owner", 0x43, 0x08, true }, |
609 | { "l1cache-load-modified", 0x43, 0x10, true }, | | 611 | { "l1cache-load-modified", 0x43, 0x10, true }, |
610 | { "l1cache-writeback", 0x44, 0x1f, true }, | | 612 | { "l1cache-writeback", 0x44, 0x1f, true }, |
611 | { "l1cache-writeback-invalid", 0x44, 0x01, true }, | | 613 | { "l1cache-writeback-invalid", 0x44, 0x01, true }, |
612 | { "l1cache-writeback-shared", 0x44, 0x02, true }, | | 614 | { "l1cache-writeback-shared", 0x44, 0x02, true }, |
613 | { "l1cache-writeback-exclusive",0x44, 0x04, true }, | | 615 | { "l1cache-writeback-exclusive",0x44, 0x04, true }, |
614 | { "l1cache-writeback-owner", 0x44, 0x08, true }, | | 616 | { "l1cache-writeback-owner", 0x44, 0x08, true }, |
615 | { "l1cache-writeback-modified", 0x44, 0x10, true }, | | 617 | { "l1cache-writeback-modified", 0x44, 0x10, true }, |
616 | { "l1DTLB-hit-all", 0x4d, 0x07, true }, | | 618 | { "l1DTLB-hit-all", 0x4d, 0x07, true }, |
617 | { "l1DTLB-hit-4Kpage", 0x4d, 0x01, true }, | | 619 | { "l1DTLB-hit-4Kpage", 0x4d, 0x01, true }, |
618 | { "l1DTLB-hit-2Mpage", 0x4d, 0x02, true }, | | 620 | { "l1DTLB-hit-2Mpage", 0x4d, 0x02, true }, |
619 | { "l1DTLB-hit-1Gpage", 0x4d, 0x04, true }, | | 621 | { "l1DTLB-hit-1Gpage", 0x4d, 0x04, true }, |
620 | { "l1DTLB-miss-all", 0x45, 0x07, true }, | | 622 | { "l1DTLB-miss-all", 0x45, 0x07, true }, |
621 | { "l1DTLB-miss-4Kpage", 0x45, 0x01, true }, | | 623 | { "l1DTLB-miss-4Kpage", 0x45, 0x01, true }, |
622 | { "l1DTLB-miss-2Mpage", 0x45, 0x02, true }, | | 624 | { "l1DTLB-miss-2Mpage", 0x45, 0x02, true }, |
623 | { "l1DTLB-miss-1Gpage", 0x45, 0x04, true }, | | 625 | { "l1DTLB-miss-1Gpage", 0x45, 0x04, true }, |
624 | { "l2DTLB-miss-all", 0x46, 0x03, true }, | | 626 | { "l2DTLB-miss-all", 0x46, 0x03, true }, |
625 | { "l2DTLB-miss-4Kpage", 0x46, 0x01, true }, | | 627 | { "l2DTLB-miss-4Kpage", 0x46, 0x01, true }, |
626 | { "l2DTLB-miss-2Mpage", 0x46, 0x02, true }, | | 628 | { "l2DTLB-miss-2Mpage", 0x46, 0x02, true }, |
627 | /* l2DTLB-miss-1Gpage: reserved on some revisions, so disabled */ | | 629 | /* l2DTLB-miss-1Gpage: reserved on some revisions, so disabled */ |
628 | { "l1ITLB-miss", 0x84, 0x00, true }, | | 630 | { "l1ITLB-miss", 0x84, 0x00, true }, |
629 | { "l2ITLB-miss-all", 0x85, 0x03, true }, | | 631 | { "l2ITLB-miss-all", 0x85, 0x03, true }, |
630 | { "l2ITLB-miss-4Kpage", 0x85, 0x01, true }, | | 632 | { "l2ITLB-miss-4Kpage", 0x85, 0x01, true }, |
631 | { "l2ITLB-miss-2Mpage", 0x85, 0x02, true }, | | 633 | { "l2ITLB-miss-2Mpage", 0x85, 0x02, true }, |
632 | { "mem-misalign-ref", 0x47, 0x00, true }, | | 634 | { "mem-misalign-ref", 0x47, 0x00, true }, |
633 | { "ins-fetch", 0x80, 0x00, true }, | | 635 | { "ins-fetch", 0x80, 0x00, true }, |
634 | { "ins-fetch-miss", 0x81, 0x00, true }, | | 636 | { "ins-fetch-miss", 0x81, 0x00, true }, |
635 | { "ins-refill-l2", 0x82, 0x00, true }, | | 637 | { "ins-refill-l2", 0x82, 0x00, true }, |
636 | { "ins-refill-sys", 0x83, 0x00, true }, | | 638 | { "ins-refill-sys", 0x83, 0x00, true }, |
637 | { "ins-fetch-stall", 0x87, 0x00, true }, | | 639 | { "ins-fetch-stall", 0x87, 0x00, true }, |
638 | { "ins-retired", 0xc0, 0x00, true }, | | 640 | { "ins-retired", 0xc0, 0x00, true }, |
639 | { "ins-empty", 0xd0, 0x00, true }, | | 641 | { "ins-empty", 0xd0, 0x00, true }, |
640 | { "ops-retired", 0xc1, 0x00, true }, | | 642 | { "ops-retired", 0xc1, 0x00, true }, |
641 | { "branch-retired", 0xc2, 0x00, true }, | | 643 | { "branch-retired", 0xc2, 0x00, true }, |
642 | { "branch-miss-retired", 0xc3, 0x00, true }, | | 644 | { "branch-miss-retired", 0xc3, 0x00, true }, |
643 | { "branch-taken-retired", 0xc4, 0x00, true }, | | 645 | { "branch-taken-retired", 0xc4, 0x00, true }, |
644 | { "branch-taken-miss-retired", 0xc5, 0x00, true }, | | 646 | { "branch-taken-miss-retired", 0xc5, 0x00, true }, |
645 | { "branch-far-retired", 0xc6, 0x00, true }, | | 647 | { "branch-far-retired", 0xc6, 0x00, true }, |
646 | { "branch-resync-retired", 0xc7, 0x00, true }, | | 648 | { "branch-resync-retired", 0xc7, 0x00, true }, |
647 | { "branch-near-retired", 0xc8, 0x00, true }, | | 649 | { "branch-near-retired", 0xc8, 0x00, true }, |
648 | { "branch-near-miss-retired", 0xc9, 0x00, true }, | | 650 | { "branch-near-miss-retired", 0xc9, 0x00, true }, |
649 | { "branch-indirect-miss-retired", 0xca, 0x00, true }, | | 651 | { "branch-indirect-miss-retired", 0xca, 0x00, true }, |
650 | { "int-hw", 0xcf, 0x00, true }, | | 652 | { "int-hw", 0xcf, 0x00, true }, |
651 | { "int-cycles-masked", 0xcd, 0x00, true }, | | 653 | { "int-cycles-masked", 0xcd, 0x00, true }, |
652 | { "int-cycles-masked-pending", 0xce, 0x00, true }, | | 654 | { "int-cycles-masked-pending", 0xce, 0x00, true }, |
653 | { "fpu-exceptions", 0xdb, 0x00, true }, | | 655 | { "fpu-exceptions", 0xdb, 0x00, true }, |
654 | { "break-match0", 0xdc, 0x00, true }, | | 656 | { "break-match0", 0xdc, 0x00, true }, |
655 | { "break-match1", 0xdd, 0x00, true }, | | 657 | { "break-match1", 0xdd, 0x00, true }, |
656 | { "break-match2", 0xde, 0x00, true }, | | 658 | { "break-match2", 0xde, 0x00, true }, |
657 | { "break-match3", 0xdf, 0x00, true }, | | 659 | { "break-match3", 0xdf, 0x00, true }, |
658 | }; | | 660 | }; |
659 | | | 661 | |
660 | static struct event_table amd_f10h = { | | 662 | static struct event_table amd_f10h = { |
661 | .tablename = "AMD Family 10h", | | 663 | .tablename = "AMD Family 10h", |
662 | .names = amd_f10h_names, | | 664 | .names = amd_f10h_names, |
663 | .nevents = sizeof(amd_f10h_names) / | | 665 | .nevents = sizeof(amd_f10h_names) / |
664 | sizeof(struct name_to_event), | | 666 | sizeof(struct name_to_event), |
665 | .next = NULL | | 667 | .next = NULL |
666 | }; | | 668 | }; |
667 | | | 669 | |
668 | /* | | 670 | /* |
669 | * AMD Family 15h | | 671 | * AMD Family 15h |
670 | */ | | 672 | */ |
671 | static struct name_to_event amd_f15h_names[] = { | | 673 | static struct name_to_event amd_f15h_names[] = { |
672 | { "FpPipeAssignment", 0x000, 0x77, true }, | | 674 | { "FpPipeAssignment", 0x000, 0x77, true }, |
673 | { "FpSchedulerEmpty", 0x001, 0x00, true }, | | 675 | { "FpSchedulerEmpty", 0x001, 0x00, true }, |
674 | { "FpRetSseAvxOps", 0x003, 0xff, true }, | | 676 | { "FpRetSseAvxOps", 0x003, 0xff, true }, |
675 | { "FpNumMovElim", 0x004, 0x0f, true }, | | 677 | { "FpNumMovElim", 0x004, 0x0f, true }, |
676 | { "FpRetiredSerOps", 0x005, 0x0f, true }, | | 678 | { "FpRetiredSerOps", 0x005, 0x0f, true }, |
677 | { "LsSegRegLoads", 0x020, 0x7f, true }, | | 679 | { "LsSegRegLoads", 0x020, 0x7f, true }, |
678 | { "LsPipeRestartSelfMod", 0x021, 0x00, true }, | | 680 | { "LsPipeRestartSelfMod", 0x021, 0x00, true }, |
679 | { "LsPipeRestartVarious", 0x022, 0x1f, true }, | | 681 | { "LsPipeRestartVarious", 0x022, 0x1f, true }, |
680 | { "LsLoadQueueStoreQFull", 0x023, 0x03, true }, | | 682 | { "LsLoadQueueStoreQFull", 0x023, 0x03, true }, |
681 | { "LsLockedOps", 0x024, 0x00, true }, | | 683 | { "LsLockedOps", 0x024, 0x00, true }, |
682 | { "LsRetClflushInstr", 0x026, 0x00, true }, | | 684 | { "LsRetClflushInstr", 0x026, 0x00, true }, |
683 | { "LsRetCpuidInstr", 0x027, 0x00, true }, | | 685 | { "LsRetCpuidInstr", 0x027, 0x00, true }, |
684 | { "LsDispatch", 0x029, 0x07, true }, | | 686 | { "LsDispatch", 0x029, 0x07, true }, |
685 | { "LsCanStoreToLoadFwOps", 0x02a, 0x03, true }, | | 687 | { "LsCanStoreToLoadFwOps", 0x02a, 0x03, true }, |
686 | { "LsSmisReceived", 0x02b, 0x00, true }, | | 688 | { "LsSmisReceived", 0x02b, 0x00, true }, |
687 | { "LsExecClflushInstr", 0x030, 0x00, true }, | | 689 | { "LsExecClflushInstr", 0x030, 0x00, true }, |
688 | { "LsMisalignStore", 0x032, 0x00, true }, | | 690 | { "LsMisalignStore", 0x032, 0x00, true }, |
689 | { "LsFpLoadBufStall", 0x034, 0x00, true }, | | 691 | { "LsFpLoadBufStall", 0x034, 0x00, true }, |
690 | { "LsStlf", 0x035, 0x00, true }, | | 692 | { "LsStlf", 0x035, 0x00, true }, |
691 | { "DcCacheAccess", 0x040, 0x00, true }, | | 693 | { "DcCacheAccess", 0x040, 0x00, true }, |
692 | { "DcCacheMiss", 0x041, 0x00, true }, | | 694 | { "DcCacheMiss", 0x041, 0x00, true }, |
693 | { "DcCacheFillL2Sys", 0x042, 0x1f, true }, | | 695 | { "DcCacheFillL2Sys", 0x042, 0x1f, true }, |
694 | { "DcCacheFillSys", 0x043, 0x00, true }, | | 696 | { "DcCacheFillSys", 0x043, 0x00, true }, |
695 | { "DcUnifiedTlbHit", 0x045, 0x77, true }, | | 697 | { "DcUnifiedTlbHit", 0x045, 0x77, true }, |
696 | { "DcUnifiedTlbMiss", 0x046, 0x77, true }, | | 698 | { "DcUnifiedTlbMiss", 0x046, 0x77, true }, |
697 | { "DcMisalignAccess", 0x047, 0x00, true }, | | 699 | { "DcMisalignAccess", 0x047, 0x00, true }, |
698 | { "DcPrefetchInstrDisp", 0x04b, 0x07, true }, | | 700 | { "DcPrefetchInstrDisp", 0x04b, 0x07, true }, |
699 | { "DcIneffSwPrefetch", 0x052, 0x09, true }, | | 701 | { "DcIneffSwPrefetch", 0x052, 0x09, true }, |
700 | { "CuCmdVictimBuf", 0x060, 0x98, true }, | | 702 | { "CuCmdVictimBuf", 0x060, 0x98, true }, |
701 | { "CuCmdMaskedOps", 0x061, 0x65, true }, | | 703 | { "CuCmdMaskedOps", 0x061, 0x65, true }, |
702 | { "CuCmdReadBlkOps", 0x062, 0x77, true }, | | 704 | { "CuCmdReadBlkOps", 0x062, 0x77, true }, |
703 | { "CuCmdChgDirtyOps", 0x063, 0x08, true }, | | 705 | { "CuCmdChgDirtyOps", 0x063, 0x08, true }, |
704 | { "CuDramSysReq", 0x064, 0x00, true }, | | 706 | { "CuDramSysReq", 0x064, 0x00, true }, |
705 | { "CuMemReqByType", 0x065, 0x83, true }, | | 707 | { "CuMemReqByType", 0x065, 0x83, true }, |
706 | { "CuDataCachePrefetch", 0x067, 0x03, true }, | | 708 | { "CuDataCachePrefetch", 0x067, 0x03, true }, |
707 | { "CuMabReq", 0x068, 0xff, true }, | | 709 | { "CuMabReq", 0x068, 0xff, true }, |
708 | { "CuMabWaitCyc", 0x069, 0xff, true }, | | 710 | { "CuMabWaitCyc", 0x069, 0xff, true }, |
709 | { "CuSysRespCacheFill", 0x06c, 0x3f, true }, | | 711 | { "CuSysRespCacheFill", 0x06c, 0x3f, true }, |
710 | { "CuOctwordsWritten", 0x06d, 0x01, true }, | | 712 | { "CuOctwordsWritten", 0x06d, 0x01, true }, |
711 | { "CuCacheXInv", 0x075, 0x0f, true }, | | 713 | { "CuCacheXInv", 0x075, 0x0f, true }, |
712 | { "CuCpuClkNotHalted", 0x076, 0x00, true }, | | 714 | { "CuCpuClkNotHalted", 0x076, 0x00, true }, |
713 | { "CuL2Req", 0x07d, 0x5f, true }, | | 715 | { "CuL2Req", 0x07d, 0x5f, true }, |
714 | { "CuL2Miss", 0x07e, 0x17, true }, | | 716 | { "CuL2Miss", 0x07e, 0x17, true }, |
715 | { "CuL2FillWb", 0x07f, 0x07, true }, | | 717 | { "CuL2FillWb", 0x07f, 0x07, true }, |
716 | { "CuPageSplintering", 0x165, 0x07, true }, | | 718 | { "CuPageSplintering", 0x165, 0x07, true }, |
717 | { "CuL2PrefetchTrigEv", 0x16c, 0x03, true }, | | 719 | { "CuL2PrefetchTrigEv", 0x16c, 0x03, true }, |
718 | { "CuXabAllocStall", 0x177, 0x03, true }, | | 720 | { "CuXabAllocStall", 0x177, 0x03, true }, |
719 | { "CuFreeXabEntries", 0x17f, 0x01, true }, | | 721 | { "CuFreeXabEntries", 0x17f, 0x01, true }, |
720 | { "IcCacheFetch", 0x080, 0x00, true }, | | 722 | { "IcCacheFetch", 0x080, 0x00, true }, |
721 | { "IcCacheMiss", 0x081, 0x00, true }, | | 723 | { "IcCacheMiss", 0x081, 0x00, true }, |
722 | { "IcCacheFillL2", 0x082, 0x00, true }, | | 724 | { "IcCacheFillL2", 0x082, 0x00, true }, |
723 | { "IcCacheFillSys", 0x083, 0x00, true }, | | 725 | { "IcCacheFillSys", 0x083, 0x00, true }, |
724 | { "IcL1TlbMissL2Hit", 0x084, 0x00, true }, | | 726 | { "IcL1TlbMissL2Hit", 0x084, 0x00, true }, |
725 | { "IcL1TlbMissL2Miss", 0x085, 0x07, true }, | | 727 | { "IcL1TlbMissL2Miss", 0x085, 0x07, true }, |
726 | { "IcPipeRestartInstrStrProbe", 0x086, 0x00, true }, | | 728 | { "IcPipeRestartInstrStrProbe", 0x086, 0x00, true }, |
727 | { "IcFetchStall", 0x087, 0x00, true }, | | 729 | { "IcFetchStall", 0x087, 0x00, true }, |
728 | { "IcRetStackHits", 0x088, 0x00, true }, | | 730 | { "IcRetStackHits", 0x088, 0x00, true }, |
729 | { "IcRetStackOver", 0x089, 0x00, true }, | | 731 | { "IcRetStackOver", 0x089, 0x00, true }, |
730 | { "IcCacheVictims", 0x08b, 0x00, true }, | | 732 | { "IcCacheVictims", 0x08b, 0x00, true }, |
731 | { "IcCacheLinesInv", 0x08c, 0x0f, true }, | | 733 | { "IcCacheLinesInv", 0x08c, 0x0f, true }, |
732 | { "IcTlbReload", 0x099, 0x00, true }, | | 734 | { "IcTlbReload", 0x099, 0x00, true }, |
733 | { "IcTlbReloadAbort", 0x09a, 0x00, true }, | | 735 | { "IcTlbReloadAbort", 0x09a, 0x00, true }, |
734 | { "IcUopsDispatched", 0x186, 0x01, true }, | | 736 | { "IcUopsDispatched", 0x186, 0x01, true }, |
735 | { "ExRetInstr", 0x0c0, 0x00, true }, | | 737 | { "ExRetInstr", 0x0c0, 0x00, true }, |
736 | { "ExRetCops", 0x0c1, 0x00, true }, | | 738 | { "ExRetCops", 0x0c1, 0x00, true }, |
737 | { "ExRetBrn", 0x0c2, 0x00, true }, | | 739 | { "ExRetBrn", 0x0c2, 0x00, true }, |
738 | { "ExRetBrnMisp", 0x0c3, 0x00, true }, | | 740 | { "ExRetBrnMisp", 0x0c3, 0x00, true }, |
739 | { "ExRetBrnTkn", 0x0c4, 0x00, true }, | | 741 | { "ExRetBrnTkn", 0x0c4, 0x00, true }, |
740 | { "ExRetBrnTknMisp", 0x0c5, 0x00, true }, | | 742 | { "ExRetBrnTknMisp", 0x0c5, 0x00, true }, |
741 | { "ExRetBrnFar", 0x0c6, 0x00, true }, | | 743 | { "ExRetBrnFar", 0x0c6, 0x00, true }, |
742 | { "ExRetBrnResync", 0x0c7, 0x00, true }, | | 744 | { "ExRetBrnResync", 0x0c7, 0x00, true }, |
743 | { "ExRetNearRet", 0x0c8, 0x00, true }, | | 745 | { "ExRetNearRet", 0x0c8, 0x00, true }, |
744 | { "ExRetNearRetMispred", 0x0c9, 0x00, true }, | | 746 | { "ExRetNearRetMispred", 0x0c9, 0x00, true }, |
745 | { "ExRetBrnIndMisp", 0x0ca, 0x00, true }, | | 747 | { "ExRetBrnIndMisp", 0x0ca, 0x00, true }, |
746 | { "ExRetMmxFpInstr@X87", 0x0cb, 0x01, true }, | | 748 | { "ExRetMmxFpInstr@X87", 0x0cb, 0x01, true }, |
747 | { "ExRetMmxFpInstr@Mmx", 0x0cb, 0x02, true }, | | 749 | { "ExRetMmxFpInstr@Mmx", 0x0cb, 0x02, true }, |
748 | { "ExRetMmxFpInstr@Sse", 0x0cb, 0x04, true }, | | 750 | { "ExRetMmxFpInstr@Sse", 0x0cb, 0x04, true }, |
749 | { "ExIntMaskedCyc", 0x0cd, 0x00, true }, | | 751 | { "ExIntMaskedCyc", 0x0cd, 0x00, true }, |
750 | { "ExIntMaskedCycIntPend", 0x0ce, 0x00, true }, | | 752 | { "ExIntMaskedCycIntPend", 0x0ce, 0x00, true }, |
751 | { "ExIntTaken", 0x0cf, 0x00, true }, | | 753 | { "ExIntTaken", 0x0cf, 0x00, true }, |
752 | { "ExDecEmpty", 0x0d0, 0x00, true }, | | 754 | { "ExDecEmpty", 0x0d0, 0x00, true }, |
753 | { "ExDispStall", 0x0d1, 0x00, true }, | | 755 | { "ExDispStall", 0x0d1, 0x00, true }, |
754 | { "ExUseqStallSer", 0x0d2, 0x00, true }, | | 756 | { "ExUseqStallSer", 0x0d2, 0x00, true }, |
755 | { "ExDispStallInstrRetQFull", 0x0d5, 0x00, true }, | | 757 | { "ExDispStallInstrRetQFull", 0x0d5, 0x00, true }, |
756 | { "ExDispStallIntSchedQFull", 0x0d6, 0x00, true }, | | 758 | { "ExDispStallIntSchedQFull", 0x0d6, 0x00, true }, |
757 | { "ExDispStallFpSchedQFull", 0x0d7, 0x00, true }, | | 759 | { "ExDispStallFpSchedQFull", 0x0d7, 0x00, true }, |
758 | { "ExDispStallLdqFull", 0x0d8, 0x00, true }, | | 760 | { "ExDispStallLdqFull", 0x0d8, 0x00, true }, |
759 | { "ExUseqStallAllQuiet", 0x0d9, 0x00, true }, | | 761 | { "ExUseqStallAllQuiet", 0x0d9, 0x00, true }, |
760 | { "ExFpuEx", 0x0db, 0x1f, true }, | | 762 | { "ExFpuEx", 0x0db, 0x1f, true }, |
761 | { "ExBpDr0", 0x0dc, 0x8f, true }, | | 763 | { "ExBpDr0", 0x0dc, 0x8f, true }, |
762 | { "ExBpDr1", 0x0dd, 0x8f, true }, | | 764 | { "ExBpDr1", 0x0dd, 0x8f, true }, |
763 | { "ExBpDr2", 0x0de, 0x8f, true }, | | 765 | { "ExBpDr2", 0x0de, 0x8f, true }, |
764 | { "ExBpDr3", 0x0df, 0x8f, true }, | | 766 | { "ExBpDr3", 0x0df, 0x8f, true }, |
765 | { "ExRetx87FpOps", 0x1c0, 0x07, true }, | | 767 | { "ExRetx87FpOps", 0x1c0, 0x07, true }, |
766 | { "ExTaggedIbsOps", 0x1cf, 0x07, true }, | | 768 | { "ExTaggedIbsOps", 0x1cf, 0x07, true }, |
767 | { "ExRetFusBrInstr", 0x1d0, 0x00, true }, | | 769 | { "ExRetFusBrInstr", 0x1d0, 0x00, true }, |
768 | { "ExDispStallStqFull", 0x1d8, 0x00, true }, | | 770 | { "ExDispStallStqFull", 0x1d8, 0x00, true }, |
769 | { "ExCycNoDispIntPrfTok", 0x1dd, 0x00, true }, | | 771 | { "ExCycNoDispIntPrfTok", 0x1dd, 0x00, true }, |
770 | { "ExCycNoDispfpPrfTok", 0x1de, 0x00, true }, | | 772 | { "ExCycNoDispfpPrfTok", 0x1de, 0x00, true }, |
771 | { "ExFpDispContention", 0x1df, 0x0f, true }, | | 773 | { "ExFpDispContention", 0x1df, 0x0f, true }, |
772 | }; | | 774 | }; |
773 | | | 775 | |
774 | static struct event_table amd_f15h = { | | 776 | static struct event_table amd_f15h = { |
775 | .tablename = "AMD Family 15h", | | 777 | .tablename = "AMD Family 15h", |
776 | .names = amd_f15h_names, | | 778 | .names = amd_f15h_names, |
777 | .nevents = sizeof(amd_f15h_names) / | | 779 | .nevents = sizeof(amd_f15h_names) / |
778 | sizeof(struct name_to_event), | | 780 | sizeof(struct name_to_event), |
779 | .next = NULL | | 781 | .next = NULL |
780 | }; | | 782 | }; |
781 | | | 783 | |
782 | /* | | 784 | /* |
783 | * AMD Family 17h | | 785 | * AMD Family 17h |
784 | */ | | 786 | */ |
785 | static struct name_to_event amd_f17h_names[] = { | | 787 | static struct name_to_event amd_f17h_names[] = { |
786 | { "FpRetx87FpOps", 0x02, __BITS(2,0), true }, | | 788 | { "FpRetx87FpOps", 0x02, __BITS(2,0), true }, |
787 | { "FpRetSseAvxOps", 0x03, __BITS(7,0), true }, | | 789 | { "FpRetSseAvxOps", 0x03, __BITS(7,0), true }, |
788 | { "FpRetiredSerOps", 0x05, __BITS(3,0), true }, | | 790 | { "FpRetiredSerOps", 0x05, __BITS(3,0), true }, |
789 | { "LsL1DTlbMiss", 0x45, __BITS(7,0), true }, | | 791 | { "LsL1DTlbMiss", 0x45, __BITS(7,0), true }, |
790 | { "LsTableWalker", 0x46, __BITS(3,0), true }, | | 792 | { "LsTableWalker", 0x46, __BITS(3,0), true }, |
791 | { "LsMisalAccesses", 0x47, 0x00, true }, | | 793 | { "LsMisalAccesses", 0x47, 0x00, true }, |
792 | { "LsInefSwPref", 0x52, __BITS(1,0), true }, | | 794 | { "LsInefSwPref", 0x52, __BITS(1,0), true }, |
793 | { "LsNotHaltedCyc", 0x76, 0x00, true }, | | 795 | { "LsNotHaltedCyc", 0x76, 0x00, true }, |
794 | { "IcFw32", 0x80, 0x00, true }, | | 796 | { "IcFw32", 0x80, 0x00, true }, |
795 | { "IcFw32Miss", 0x81, 0x00, true }, | | 797 | { "IcFw32Miss", 0x81, 0x00, true }, |
796 | { "IcCacheFillL2", 0x82, 0x00, true }, | | 798 | { "IcCacheFillL2", 0x82, 0x00, true }, |
797 | { "IcCacheFillSys", 0x83, 0x00, true }, | | 799 | { "IcCacheFillSys", 0x83, 0x00, true }, |
798 | { "IcFetchStall", 0x87, __BITS(2,0), true }, | | 800 | { "IcFetchStall", 0x87, __BITS(2,0), true }, |
799 | { "IcCacheInval", 0x8c, __BITS(1,0), true }, | | 801 | { "IcCacheInval", 0x8c, __BITS(1,0), true }, |
800 | { "BpL1TlbMissL2Hit", 0x84, 0x00, true }, | | 802 | { "BpL1TlbMissL2Hit", 0x84, 0x00, true }, |
801 | { "BpL1TlbMissL2Miss", 0x85, 0x00, true }, | | 803 | { "BpL1TlbMissL2Miss", 0x85, 0x00, true }, |
802 | { "BpSnpReSync", 0x86, 0x00, true }, | | 804 | { "BpSnpReSync", 0x86, 0x00, true }, |
803 | { "BpL1BTBCorrect", 0x8a, 0x00, true }, | | 805 | { "BpL1BTBCorrect", 0x8a, 0x00, true }, |
804 | { "BpL2BTBCorrect", 0x8b, 0x00, true }, | | 806 | { "BpL2BTBCorrect", 0x8b, 0x00, true }, |
805 | { "BpTlbRel", 0x99, 0x00, true }, | | 807 | { "BpTlbRel", 0x99, 0x00, true }, |
806 | { "ExRetInstr", 0xc0, 0x00, true }, | | 808 | { "ExRetInstr", 0xc0, 0x00, true }, |
807 | { "ExRetCops", 0xc1, 0x00, true }, | | 809 | { "ExRetCops", 0xc1, 0x00, true }, |
808 | { "ExRetBrn", 0xc2, 0x00, true }, | | 810 | { "ExRetBrn", 0xc2, 0x00, true }, |
809 | { "ExRetBrnMisp", 0xc3, 0x00, true }, | | 811 | { "ExRetBrnMisp", 0xc3, 0x00, true }, |
810 | { "ExRetBrnTkn", 0xc4, 0x00, true }, | | 812 | { "ExRetBrnTkn", 0xc4, 0x00, true }, |
811 | { "ExRetBrnTknMisp", 0xc5, 0x00, true }, | | 813 | { "ExRetBrnTknMisp", 0xc5, 0x00, true }, |
812 | { "ExRetBrnFar", 0xc6, 0x00, true }, | | 814 | { "ExRetBrnFar", 0xc6, 0x00, true }, |
813 | { "ExRetBrnResync", 0xc7, 0x00, true }, | | 815 | { "ExRetBrnResync", 0xc7, 0x00, true }, |
814 | { "ExRetBrnIndMisp", 0xca, 0x00, true }, | | 816 | { "ExRetBrnIndMisp", 0xca, 0x00, true }, |
815 | { "ExRetNearRet", 0xc8, 0x00, true }, | | 817 | { "ExRetNearRet", 0xc8, 0x00, true }, |
816 | { "ExRetNearRetMispred", 0xc9, 0x00, true }, | | 818 | { "ExRetNearRetMispred", 0xc9, 0x00, true }, |
817 | { "ExRetMmxFpInstr@X87", 0xcb, __BIT(0), true }, | | 819 | { "ExRetMmxFpInstr@X87", 0xcb, __BIT(0), true }, |
818 | { "ExRetMmxFpInstr@Mmx", 0xcb, __BIT(1), true }, | | 820 | { "ExRetMmxFpInstr@Mmx", 0xcb, __BIT(1), true }, |
819 | { "ExRetMmxFpInstr@Sse", 0xcb, __BIT(2), true }, | | 821 | { "ExRetMmxFpInstr@Sse", 0xcb, __BIT(2), true }, |
820 | { "ExRetCond", 0xd1, 0x00, true }, | | 822 | { "ExRetCond", 0xd1, 0x00, true }, |
821 | { "ExRetCondMisp", 0xd2, 0x00, true }, | | 823 | { "ExRetCondMisp", 0xd2, 0x00, true }, |
822 | { "ExDivBusy", 0xd3, 0x00, true }, | | 824 | { "ExDivBusy", 0xd3, 0x00, true }, |
823 | { "ExDivCount", 0xd4, 0x00, true }, | | 825 | { "ExDivCount", 0xd4, 0x00, true }, |
824 | }; | | 826 | }; |
825 | | | 827 | |
826 | static struct event_table amd_f17h = { | | 828 | static struct event_table amd_f17h = { |
827 | .tablename = "AMD Family 17h", | | 829 | .tablename = "AMD Family 17h", |
828 | .names = amd_f17h_names, | | 830 | .names = amd_f17h_names, |
829 | .nevents = sizeof(amd_f17h_names) / | | 831 | .nevents = sizeof(amd_f17h_names) / |
830 | sizeof(struct name_to_event), | | 832 | sizeof(struct name_to_event), |
831 | .next = NULL | | 833 | .next = NULL |
832 | }; | | 834 | }; |
833 | | | 835 | |
834 | /* | | 836 | /* |
835 | * AMD Family 19h | | 837 | * AMD Family 19h |
836 | * From PPR: | | 838 | * From PPR: |
837 | * - f19h model 01h B1 (zen3) | | 839 | * - f19h model 01h B1 (zen3) |
838 | * - f19h model 11h B1 (zen4) | | 840 | * - f19h model 11h B1 (zen4) |
839 | * - f19h model 21h B1 (zen3) | | 841 | * - f19h model 21h B1 (zen3) |
840 | * - f19h model 51h A1 (zen3) | | 842 | * - f19h model 51h A1 (zen3) |
841 | */ | | 843 | */ |
842 | static struct name_to_event amd_f19h_names[] = { | | 844 | static struct name_to_event amd_f19h_names[] = { |
843 | /* Model 1x only */ | | 845 | /* Model 1x only */ |
844 | { "FpRetx87FpOps", 0x02, __BITS(2,0), true }, | | 846 | { "FpRetx87FpOps", 0x02, __BITS(2,0), true }, |
845 | | | 847 | |
846 | /* Only model 1x has bit 4 */ | | 848 | /* Only model 1x has bit 4 */ |
847 | { "FpRetSseAvxOps", 0x03, __BITS(4,0), true }, | | 849 | { "FpRetSseAvxOps", 0x03, __BITS(4,0), true }, |
848 | | | 850 | |
849 | { "FpRetiredSerOps", 0x05, __BITS(3,0), true }, | | 851 | { "FpRetiredSerOps", 0x05, __BITS(3,0), true }, |
850 | | | 852 | |
851 | /* Model 1x only */ | | 853 | /* Model 1x only */ |
852 | { "FpOpsRetiredByWidth", 0x08, __BITS(5,0), true }, | | 854 | { "FpOpsRetiredByWidth", 0x08, __BITS(5,0), true }, |
853 | { "FpOpsRetiredByType", 0x0a, __BITS(7,0), true }, | | 855 | { "FpOpsRetiredByType", 0x0a, __BITS(7,0), true }, |
854 | { "SseAvxOpsRetired", 0x0b, __BITS(7,0), true }, | | 856 | { "SseAvxOpsRetired", 0x0b, __BITS(7,0), true }, |
855 | { "FpPackOpsRetired", 0x0c, __BITS(7,0), true }, | | 857 | { "FpPackOpsRetired", 0x0c, __BITS(7,0), true }, |
856 | { "PackedIntOpType", 0x0d, __BITS(7,0), true }, | | 858 | { "PackedIntOpType", 0x0d, __BITS(7,0), true }, |
857 | | | 859 | |
858 | { "FpDispFaults", 0x0e, __BITS(3,0), true }, | | 860 | { "FpDispFaults", 0x0e, __BITS(3,0), true }, |
859 | { "LsBadStatus2", 0x24, __BIT(1), true }, | | 861 | { "LsBadStatus2", 0x24, __BIT(1), true }, |
860 | { "LsLocks", 0x25, __BIT(0), true }, | | 862 | { "LsLocks", 0x25, __BIT(0), true }, |
861 | { "LsRetClClush", 0x26, 0x00, true }, | | 863 | { "LsRetClClush", 0x26, 0x00, true }, |
862 | { "LsRetCpuid", 0x27, 0x00, true }, | | 864 | { "LsRetCpuid", 0x27, 0x00, true }, |
863 | { "LsDispatch", 0x29, __BITS(2,0), true }, | | 865 | { "LsDispatch", 0x29, __BITS(2,0), true }, |
864 | { "LsSmiRx", 0x2b, 0x00, true }, | | 866 | { "LsSmiRx", 0x2b, 0x00, true }, |
865 | { "LsIntTaken", 0x2c, 0x00, true }, | | 867 | { "LsIntTaken", 0x2c, 0x00, true }, |
866 | { "LsSTLF", 0x35, 0x00, true }, | | 868 | { "LsSTLF", 0x35, 0x00, true }, |
867 | { "LsStCommitCancel2", 0x37, __BIT(0), true }, | | 869 | { "LsStCommitCancel2", 0x37, __BIT(0), true }, |
868 | { "LsMabAlloc-ls", 0x41, 0x3f, true }, | | 870 | { "LsMabAlloc-ls", 0x41, 0x3f, true }, |
869 | { "LsMabAlloc-hp", 0x41, 0x40, true }, | | 871 | { "LsMabAlloc-hp", 0x41, 0x40, true }, |
870 | { "LsMabAlloc-all", 0x41, 0x7f, true }, | | 872 | { "LsMabAlloc-all", 0x41, 0x7f, true }, |
871 | { "LsDmndFillsFromSys", 0x43, 0x5f, true }, | | 873 | { "LsDmndFillsFromSys", 0x43, 0x5f, true }, |
872 | | | 874 | |
873 | /* Only model 1x has bit 7 */ | | 875 | /* Only model 1x has bit 7 */ |
874 | { "LsAnyFillsFromSys", 0x44, 0xdf, true }, | | 876 | { "LsAnyFillsFromSys", 0x44, 0xdf, true }, |
875 | | | 877 | |
876 | { "LsL1DTlbMiss", 0x45, __BITS(7,0), true }, | | 878 | { "LsL1DTlbMiss", 0x45, __BITS(7,0), true }, |
877 | { "LsMisalLoads-MA64", 0x47, __BIT(0), true }, | | 879 | { "LsMisalLoads-MA64", 0x47, __BIT(0), true }, |
878 | { "LsMisalLoads-MA4K", 0x47, __BIT(1), true }, | | 880 | { "LsMisalLoads-MA4K", 0x47, __BIT(1), true }, |
879 | { "LsMisalLoads-all", 0x47, __BITS(1,0), true }, | | 881 | { "LsMisalLoads-all", 0x47, __BITS(1,0), true }, |
880 | { "LsPrefInstrDisp", 0x4b, __BITS(2,0), true }, | | 882 | { "LsPrefInstrDisp", 0x4b, __BITS(2,0), true }, |
881 | { "LsInefSwPref", 0x52, __BITS(1,0), true }, | | 883 | { "LsInefSwPref", 0x52, __BITS(1,0), true }, |
882 | | | 884 | |
883 | /* Only model 1x has bit 7 */ | | 885 | /* Only model 1x has bit 7 */ |
884 | { "LsSwPfDcFills", 0x59, 0xdf, true }, | | 886 | { "LsSwPfDcFills", 0x59, 0xdf, true }, |
885 | { "LsHwPfDcFills", 0x5a, 0xdf, true }, | | 887 | { "LsHwPfDcFills", 0x5a, 0xdf, true }, |
886 | | | 888 | |
887 | { "LsAllocMabCount", 0x5f, 0x00, true }, | | 889 | { "LsAllocMabCount", 0x5f, 0x00, true }, |
888 | { "LsNotHaltedCyc", 0x76, 0x00, true }, | | 890 | { "LsNotHaltedCyc", 0x76, 0x00, true }, |
889 | | | 891 | |
890 | /* Model 0x, 1x and 2x only */ | | 892 | /* Model 0x, 1x and 2x only */ |
891 | { "LsTlbFlush", 0x78, 0xff, true }, | | 893 | { "LsTlbFlush", 0x78, 0xff, true }, |
892 | | | 894 | |
893 | /* Model 1x only */ | | 895 | /* Model 1x only */ |
894 | { "LsNotHaltedP0Cyc", 0x120, __BIT(0), true }, | | 896 | { "LsNotHaltedP0Cyc", 0x120, __BIT(0), true }, |
895 | | | 897 | |
896 | { "IcCacheFillL2", 0x82, 0x00, true }, | | 898 | { "IcCacheFillL2", 0x82, 0x00, true }, |
897 | { "IcCacheFillSys", 0x83, 0x00, true }, | | 899 | { "IcCacheFillSys", 0x83, 0x00, true }, |
898 | { "BpL1TlbMissL2TlbHit", 0x84, 0x00, true }, | | 900 | { "BpL1TlbMissL2TlbHit", 0x84, 0x00, true }, |
899 | { "BpL1TlbMissL2TlbMiss-IF4K", 0x85, __BIT(0), true }, | | 901 | { "BpL1TlbMissL2TlbMiss-IF4K", 0x85, __BIT(0), true }, |
900 | { "BpL1TlbMissL2TlbMiss-IF2M", 0x85, __BIT(1), true }, | | 902 | { "BpL1TlbMissL2TlbMiss-IF2M", 0x85, __BIT(1), true }, |
901 | { "BpL1TlbMissL2TlbMiss-IF1G", 0x85, __BIT(2), true }, | | 903 | { "BpL1TlbMissL2TlbMiss-IF1G", 0x85, __BIT(2), true }, |
902 | { "BpL1TlbMissL2TlbMiss-Coalesced4K", 0x85, __BIT(3), true }, | | 904 | { "BpL1TlbMissL2TlbMiss-Coalesced4K", 0x85, __BIT(3), true }, |
903 | { "BpL1TlbMissL2TlbMiss-all", 0x85, __BITS(3,0), true }, | | 905 | { "BpL1TlbMissL2TlbMiss-all", 0x85, __BITS(3,0), true }, |
904 | | | 906 | |
905 | { "BpL2BTBCorrect", 0x8b, 0x00, true }, | | 907 | { "BpL2BTBCorrect", 0x8b, 0x00, true }, |
906 | { "BpDynIndPred", 0x8e, 0x00, true }, | | 908 | { "BpDynIndPred", 0x8e, 0x00, true }, |
907 | { "BpDeReDirect", 0x91, 0x00, true }, | | 909 | { "BpDeReDirect", 0x91, 0x00, true }, |
908 | { "BpL1TlbFetchHit-IF4K", 0x94, __BIT(0), true }, | | 910 | { "BpL1TlbFetchHit-IF4K", 0x94, __BIT(0), true }, |
909 | { "BpL1TlbFetchHit-IF2M", 0x94, __BIT(1), true }, | | 911 | { "BpL1TlbFetchHit-IF2M", 0x94, __BIT(1), true }, |
910 | { "BpL1TlbFetchHit-IF1G", 0x94, __BIT(2), true }, | | 912 | { "BpL1TlbFetchHit-IF1G", 0x94, __BIT(2), true }, |
911 | { "BpL1TlbFetchHit-all", 0x94, __BITS(2,0), true }, | | 913 | { "BpL1TlbFetchHit-all", 0x94, __BITS(2,0), true }, |
912 | | | 914 | |
913 | /* Model 1x only */ | | 915 | /* Model 1x only */ |
914 | { "ResyncsOrNcRedirects", 0x96, 0x00, true }, | | 916 | { "ResyncsOrNcRedirects", 0x96, 0x00, true }, |
915 | | | 917 | |
916 | { "IcTagHitMiss-hit", 0x18e, 0x07, true }, | | 918 | { "IcTagHitMiss-hit", 0x18e, 0x07, true }, |
917 | { "IcTagHitMiss-miss", 0x18e, 0x18, true }, | | 919 | { "IcTagHitMiss-miss", 0x18e, 0x18, true }, |
918 | { "IcTagHitMiss-all", 0x18e, 0x1f, true }, | | 920 | { "IcTagHitMiss-all", 0x18e, 0x1f, true }, |
919 | { "OpCacheHitMiss-hit", 0x28f, 0x03, true }, | | 921 | { "OpCacheHitMiss-hit", 0x28f, 0x03, true }, |
920 | { "OpCacheHitMiss-miss", 0x28f, 0x04, true }, | | 922 | { "OpCacheHitMiss-miss", 0x28f, 0x04, true }, |
921 | { "OpCacheHitMiss-all", 0x28f, 0x07, true }, | | 923 | { "OpCacheHitMiss-all", 0x28f, 0x07, true }, |
922 | { "DeOpQueueEmpty", 0xa9, 0x00, true }, | | 924 | { "DeOpQueueEmpty", 0xa9, 0x00, true }, |
923 | | | 925 | |
924 | /* | | 926 | /* |
925 | * Model 0x and 1x only. | | 927 | * Model 0x and 1x only. |
926 | * Only model 1x has bit 2. | | 928 | * Only model 1x has bit 2. |
927 | */ | | 929 | */ |
928 | { "DeSrcOpDisp", 0xaa, __BITS(2,0), true }, | | 930 | { "DeSrcOpDisp", 0xaa, __BITS(2,0), true }, |
929 | | | 931 | |
930 | { "DeDisOpsFromDecoder-Fp-Ibs", 0xab, 0x04, true }, | | 932 | { "DeDisOpsFromDecoder-Fp-Ibs", 0xab, 0x04, true }, |
931 | { "DeDisOpsFromDecoder-Int-Ibs", 0xab, 0x08, true }, | | 933 | { "DeDisOpsFromDecoder-Int-Ibs", 0xab, 0x08, true }, |
932 | | | 934 | |
933 | /* Model 0x, 2x and newer */ | | 935 | /* Model 0x, 2x and newer */ |
934 | { "DeDisOpsFromDecoder-Fp-Ret", 0xab, 0x84, true }, | | 936 | { "DeDisOpsFromDecoder-Fp-Ret", 0xab, 0x84, true }, |
935 | { "DeDisOpsFromDecoder-Int-Ret", 0xab, 0x88, true }, | | 937 | { "DeDisOpsFromDecoder-Int-Ret", 0xab, 0x88, true }, |
936 | | | 938 | |
937 | { "DeDisDispatchTokenStalls1", 0xae, 0xf7, true }, | | 939 | { "DeDisDispatchTokenStalls1", 0xae, 0xf7, true }, |
938 | { "DeDisDispatchTokenStalls2", 0xaf, 0x2f, true }, | | 940 | { "DeDisDispatchTokenStalls2", 0xaf, 0x2f, true }, |
939 | | | 941 | |
940 | /* Model 1x only */ | | 942 | /* Model 1x only */ |
941 | { "DeNoDispatchPerSolt-empty", 0x1a0, 0x01, true }, | | 943 | { "DeNoDispatchPerSolt-empty", 0x1a0, 0x01, true }, |
942 | { "DeNoDispatchPerSolt-backend", 0x1a0, 0x1e, true }, | | 944 | { "DeNoDispatchPerSolt-backend", 0x1a0, 0x1e, true }, |
943 | { "DeNoDispatchPerSolt-otherSMT", 0x1a0, 0x60, true }, | | 945 | { "DeNoDispatchPerSolt-otherSMT", 0x1a0, 0x60, true }, |
944 | { "DeAdditionalResourceStalls", 0x1a2, 0x30, true }, | | 946 | { "DeAdditionalResourceStalls", 0x1a2, 0x30, true }, |
945 | | | 947 | |
946 | { "ExRetInstr", 0xc0, 0x00, true }, | | 948 | { "ExRetInstr", 0xc0, 0x00, true }, |
947 | { "ExRetCops", 0xc1, 0x00, true }, | | 949 | { "ExRetCops", 0xc1, 0x00, true }, |
948 | { "ExRetBrn", 0xc2, 0x00, true }, | | 950 | { "ExRetBrn", 0xc2, 0x00, true }, |
949 | { "ExRetBrnMisp", 0xc3, 0x00, true }, | | 951 | { "ExRetBrnMisp", 0xc3, 0x00, true }, |
950 | { "ExRetBrnTkn", 0xc4, 0x00, true }, | | 952 | { "ExRetBrnTkn", 0xc4, 0x00, true }, |
951 | { "ExRetBrnTknMisp", 0xc5, 0x00, true }, | | 953 | { "ExRetBrnTknMisp", 0xc5, 0x00, true }, |
952 | { "ExRetBrnFar", 0xc6, 0x00, true }, | | 954 | { "ExRetBrnFar", 0xc6, 0x00, true }, |
953 | { "ExRetBrnIndMisp", 0xca, 0x00, true }, | | 955 | { "ExRetBrnIndMisp", 0xca, 0x00, true }, |
954 | { "ExRetNearRet", 0xc8, 0x00, true }, | | 956 | { "ExRetNearRet", 0xc8, 0x00, true }, |
955 | { "ExRetNearRetMispred", 0xc9, 0x00, true }, | | 957 | { "ExRetNearRetMispred", 0xc9, 0x00, true }, |
956 | { "ExRetMmxFpInstr@X87", 0xcb, __BIT(0), true }, | | 958 | { "ExRetMmxFpInstr@X87", 0xcb, __BIT(0), true }, |
957 | { "ExRetMmxFpInstr@Mmx", 0xcb, __BIT(1), true }, | | 959 | { "ExRetMmxFpInstr@Mmx", 0xcb, __BIT(1), true }, |
958 | { "ExRetMmxFpInstr@Sse", 0xcb, __BIT(2), true }, | | 960 | { "ExRetMmxFpInstr@Sse", 0xcb, __BIT(2), true }, |
959 | { "ExRetIndBrchInstr", 0xcc, 0x00, true }, | | 961 | { "ExRetIndBrchInstr", 0xcc, 0x00, true }, |
960 | { "ExRetCond", 0xd1, 0x00, true }, | | 962 | { "ExRetCond", 0xd1, 0x00, true }, |
961 | { "ExDivBusy", 0xd3, 0x00, true }, | | 963 | { "ExDivBusy", 0xd3, 0x00, true }, |
962 | { "ExDivCount", 0xd4, 0x00, true }, | | 964 | { "ExDivCount", 0xd4, 0x00, true }, |
963 | | | 965 | |
964 | /* Model 1x only */ | | 966 | /* Model 1x only */ |
965 | { "ExDivCount-LoadAndALU", 0xd6, 0x1f, true }, | | 967 | { "ExDivCount-LoadAndALU", 0xd6, 0x1f, true }, |
966 | { "ExDivCount-Load", 0xd6, 0xbf, true }, | | 968 | { "ExDivCount-Load", 0xd6, 0xbf, true }, |
967 | { "ExRetUcodeInstr", 0x1c1, 0x00, true }, | | 969 | { "ExRetUcodeInstr", 0x1c1, 0x00, true }, |
968 | { "ExRetUcodeOps", 0x1c2, 0x00, true }, | | 970 | { "ExRetUcodeOps", 0x1c2, 0x00, true }, |
969 | | | 971 | |
970 | { "ExRetMsprdBrnchInstrDirMsmtch", 0x1c7, 0x00, true }, | | 972 | { "ExRetMsprdBrnchInstrDirMsmtch", 0x1c7, 0x00, true }, |
971 | | | 973 | |
972 | /* Model 1x only */ | | 974 | /* Model 1x only */ |
973 | { "ExRetUncondBrnchInstrMspred", 0x1c8, 0x00, true }, | | 975 | { "ExRetUncondBrnchInstrMspred", 0x1c8, 0x00, true }, |
974 | { "ExRetUncondBrnchInstr", 0x1c8, 0x00, true }, | | 976 | { "ExRetUncondBrnchInstr", 0x1c8, 0x00, true }, |
975 | | | 977 | |
976 | { "ExTaggedIbsOps", 0x1cf, __BITS(2,0), true }, | | 978 | { "ExTaggedIbsOps", 0x1cf, __BITS(2,0), true }, |
977 | { "ExRetFusedInstr", 0x1d0, 0x00, true }, | | 979 | { "ExRetFusedInstr", 0x1d0, 0x00, true }, |
978 | | | 980 | |
979 | /* Only model 1x has bit 0 */ | | 981 | /* Only model 1x has bit 0 */ |
980 | { "L2RequestG1", 0x60, __BITS(7,1), true }, | | 982 | { "L2RequestG1", 0x60, __BITS(7,1), true }, |
981 | | | 983 | |
982 | { "L2CacheReqStart", 0x64, __BITS(7,0), true }, | | 984 | { "L2CacheReqStart", 0x64, __BITS(7,0), true }, |
983 | { "L2PfHitL2-L2", 0x70, __BITS(4,0), true }, | | 985 | { "L2PfHitL2-L2", 0x70, __BITS(4,0), true }, |
984 | { "L2PfHitL2-L1", 0x70, __BITS(7,5), true }, | | 986 | { "L2PfHitL2-L1", 0x70, __BITS(7,5), true }, |
985 | { "L2PfHitL2-all", 0x70, __BITS(7,0), true }, | | 987 | { "L2PfHitL2-all", 0x70, __BITS(7,0), true }, |
986 | { "L2PfMissL2HitL3-L2", 0x71, __BITS(4,0), true }, | | 988 | { "L2PfMissL2HitL3-L2", 0x71, __BITS(4,0), true }, |
987 | { "L2PfMissL2HitL3-L1", 0x71, __BITS(7,5), true }, | | 989 | { "L2PfMissL2HitL3-L1", 0x71, __BITS(7,5), true }, |
988 | { "L2PfMIssL2HitL3-all", 0x71, __BITS(7,0), true }, | | 990 | { "L2PfMIssL2HitL3-all", 0x71, __BITS(7,0), true }, |
989 | { "L2PfMissL2L3-L2", 0x72, __BITS(4,0), true }, | | 991 | { "L2PfMissL2L3-L2", 0x72, __BITS(4,0), true }, |
990 | { "L2PfMissL2L3-L1", 0x72, __BITS(7,5), true }, | | 992 | { "L2PfMissL2L3-L1", 0x72, __BITS(7,5), true }, |
991 | { "L2PfMIssL2L3-all", 0x72, __BITS(7,0), true }, | | 993 | { "L2PfMIssL2L3-all", 0x72, __BITS(7,0), true }, |
992 | | | 994 | |
993 | { "L3LookupState-L3Miss", 0x04, __BIT(0), true }, | | 995 | { "L3LookupState-L3Miss", 0x04, __BIT(0), true }, |
994 | { "L3LookupState-L3Hit", 0x04, __BITS(7,1), true }, | | 996 | { "L3LookupState-L3Hit", 0x04, __BITS(7,1), true }, |
995 | { "L3LookupState-all", 0x04, __BITS(7,0), true }, | | 997 | { "L3LookupState-all", 0x04, __BITS(7,0), true }, |
996 | | | 998 | |
997 | /* Model 0x, 2x and newer */ | | 999 | /* Model 0x, 2x and newer */ |
998 | { "XiSysFillLatency", 0x90, 0x00, true }, | | 1000 | { "XiSysFillLatency", 0x90, 0x00, true }, |
999 | { "XiCcxSdpReq1", 0x9a, 0x00, true }, | | 1001 | { "XiCcxSdpReq1", 0x9a, 0x00, true }, |
1000 | | | 1002 | |
1001 | /* Model 1x only */ | | 1003 | /* Model 1x only */ |
1002 | { "XiSampledLatency", 0xac, 0x00, true }, | | 1004 | { "XiSampledLatency", 0xac, 0x00, true }, |
1003 | { "XiSampledLatencyRequests", 0xad, 0x00, true }, | | 1005 | { "XiSampledLatencyRequests", 0xad, 0x00, true }, |
1004 | }; | | 1006 | }; |
1005 | | | 1007 | |
1006 | static struct event_table amd_f19h = { | | 1008 | static struct event_table amd_f19h = { |
1007 | .tablename = "AMD Family 19h", | | 1009 | .tablename = "AMD Family 19h", |
1008 | .names = amd_f19h_names, | | 1010 | .names = amd_f19h_names, |
1009 | .nevents = sizeof(amd_f19h_names) / | | 1011 | .nevents = sizeof(amd_f19h_names) / |
1010 | sizeof(struct name_to_event), | | 1012 | sizeof(struct name_to_event), |
1011 | .next = NULL | | 1013 | .next = NULL |
1012 | }; | | 1014 | }; |
1013 | | | 1015 | |
1014 | static struct event_table * | | 1016 | static struct event_table * |
1015 | init_amd_generic(void) | | 1017 | init_amd_generic(void) |
1016 | { | | 1018 | { |
1017 | unsigned int eax, ebx, ecx, edx; | | 1019 | unsigned int eax, ebx, ecx, edx; |
1018 | | | 1020 | |
1019 | eax = 0x01; | | 1021 | eax = 0x01; |
1020 | ebx = 0; | | 1022 | ebx = 0; |
1021 | ecx = 0; | | 1023 | ecx = 0; |
1022 | edx = 0; | | 1024 | edx = 0; |
1023 | x86_cpuid(&eax, &ebx, &ecx, &edx); | | 1025 | x86_cpuid(&eax, &ebx, &ecx, &edx); |
1024 | | | 1026 | |
1025 | switch (CPUID_TO_FAMILY(eax)) { | | 1027 | switch (CPUID_TO_FAMILY(eax)) { |
1026 | case 0x10: | | 1028 | case 0x10: |
1027 | return &amd_f10h; | | 1029 | return &amd_f10h; |
1028 | case 0x15: | | 1030 | case 0x15: |
1029 | return &amd_f15h; | | 1031 | return &amd_f15h; |
1030 | case 0x17: | | 1032 | case 0x17: |
1031 | return &amd_f17h; | | 1033 | return &amd_f17h; |
1032 | case 0x19: | | 1034 | case 0x19: |
1033 | return &amd_f19h; | | 1035 | return &amd_f19h; |
1034 | } | | 1036 | } |
1035 | | | 1037 | |
1036 | return NULL; | | 1038 | return NULL; |
1037 | } | | 1039 | } |
1038 | | | 1040 | |
1039 | /* ------------------------------------------------------------------------- */ | | 1041 | /* ------------------------------------------------------------------------- */ |
1040 | | | 1042 | |
1041 | int | | 1043 | int |
1042 | tprof_event_init(uint32_t ident) | | 1044 | tprof_event_init(uint32_t ident) |
1043 | { | | 1045 | { |
1044 | | | 1046 | |
1045 | switch (ident) { | | 1047 | switch (ident) { |
1046 | case TPROF_IDENT_NONE: | | 1048 | case TPROF_IDENT_NONE: |
1047 | return -1; | | 1049 | return -1; |
1048 | case TPROF_IDENT_INTEL_GENERIC: | | 1050 | case TPROF_IDENT_INTEL_GENERIC: |
1049 | cpuevents = init_intel_generic(); | | 1051 | cpuevents = init_intel_generic(); |
1050 | break; | | 1052 | break; |
1051 | case TPROF_IDENT_AMD_GENERIC: | | 1053 | case TPROF_IDENT_AMD_GENERIC: |
1052 | cpuevents = init_amd_generic(); | | 1054 | cpuevents = init_amd_generic(); |
1053 | break; | | 1055 | break; |
1054 | } | | 1056 | } |
1055 | return (cpuevents == NULL) ? -1 : 0; | | 1057 | return (cpuevents == NULL) ? -1 : 0; |
1056 | } | | 1058 | } |
1057 | | | 1059 | |
1058 | static void | | 1060 | static void |
1059 | recursive_event_list(struct event_table *table) | | 1061 | recursive_event_list(struct event_table *table) |
1060 | { | | 1062 | { |
1061 | size_t i; | | 1063 | size_t i; |
1062 | | | 1064 | |
1063 | printf("%s:\n", table->tablename); | | 1065 | printf("%s:\n", table->tablename); |
1064 | for (i = 0; i < table->nevents; i++) { | | 1066 | for (i = 0; i < table->nevents; i++) { |
1065 | if (!table->names[i].enabled) | | 1067 | if (!table->names[i].enabled) |
1066 | continue; | | 1068 | continue; |
1067 | printf("\t%s\n", table->names[i].name); | | 1069 | printf("\t%s\n", table->names[i].name); |
1068 | } | | 1070 | } |
1069 | | | 1071 | |
1070 | if (table->next != NULL) | | 1072 | if (table->next != NULL) |
1071 | recursive_event_list(table->next); | | 1073 | recursive_event_list(table->next); |
1072 | } | | 1074 | } |
1073 | | | 1075 | |
1074 | void | | 1076 | void |
1075 | tprof_event_list(void) | | 1077 | tprof_event_list(void) |
1076 | { | | 1078 | { |
1077 | | | 1079 | |
1078 | recursive_event_list(cpuevents); | | 1080 | recursive_event_list(cpuevents); |
1079 | } | | 1081 | } |
1080 | | | 1082 | |
1081 | static void | | 1083 | static void |
1082 | recursive_event_lookup(struct event_table *table, const char *name, | | 1084 | recursive_event_lookup(struct event_table *table, const char *name, |
1083 | struct tprof_param *param) | | 1085 | struct tprof_param *param) |
1084 | { | | 1086 | { |
1085 | size_t i; | | 1087 | size_t i; |
1086 | | | 1088 | |
1087 | for (i = 0; i < table->nevents; i++) { | | 1089 | for (i = 0; i < table->nevents; i++) { |
1088 | if (!table->names[i].enabled) | | 1090 | if (!table->names[i].enabled) |
1089 | continue; | | 1091 | continue; |
1090 | if (!strcmp(table->names[i].name, name)) { | | 1092 | if (!strcmp(table->names[i].name, name)) { |
1091 | param->p_event = table->names[i].event; | | 1093 | param->p_event = table->names[i].event; |
1092 | param->p_unit = table->names[i].unit; | | 1094 | param->p_unit = table->names[i].unit; |
1093 | return; | | 1095 | return; |
1094 | } | | 1096 | } |
1095 | } | | 1097 | } |
1096 | | | 1098 | |
1097 | if (table->next != NULL) | | 1099 | if (table->next != NULL) |
1098 | recursive_event_lookup(table->next, name, param); | | 1100 | recursive_event_lookup(table->next, name, param); |
1099 | else | | 1101 | else |
1100 | errx(EXIT_FAILURE, "event '%s' unknown", name); | | 1102 | errx(EXIT_FAILURE, "event '%s' unknown", name); |
1101 | } | | 1103 | } |
1102 | | | 1104 | |
1103 | void | | 1105 | void |
1104 | tprof_event_lookup(const char *name, struct tprof_param *param) | | 1106 | tprof_event_lookup(const char *name, struct tprof_param *param) |
1105 | { | | 1107 | { |
1106 | | | 1108 | |
1107 | recursive_event_lookup(cpuevents, name, param); | | 1109 | recursive_event_lookup(cpuevents, name, param); |
1108 | } | | 1110 | } |