hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/perf/tests/parse-events.c
....@@ -5,7 +5,7 @@
55 #include <api/fs/fs.h>
66 #include "tests.h"
77 #include "debug.h"
8
-#include "util.h"
8
+#include "pmu.h"
99 #include <dirent.h>
1010 #include <errno.h>
1111 #include <sys/types.h>
....@@ -44,549 +44,552 @@
4444 }
4545 #endif
4646
47
-static int test__checkevent_tracepoint(struct perf_evlist *evlist)
47
+static int test__checkevent_tracepoint(struct evlist *evlist)
4848 {
49
- struct perf_evsel *evsel = perf_evlist__first(evlist);
49
+ struct evsel *evsel = evlist__first(evlist);
5050
51
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
51
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
5252 TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
53
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
53
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
5454 TEST_ASSERT_VAL("wrong sample_type",
55
- PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
56
- TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
55
+ PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
56
+ TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
5757 return 0;
5858 }
5959
60
-static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist)
60
+static int test__checkevent_tracepoint_multi(struct evlist *evlist)
6161 {
62
- struct perf_evsel *evsel;
62
+ struct evsel *evsel;
6363
64
- TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
64
+ TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries > 1);
6565 TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
6666
6767 evlist__for_each_entry(evlist, evsel) {
6868 TEST_ASSERT_VAL("wrong type",
69
- PERF_TYPE_TRACEPOINT == evsel->attr.type);
69
+ PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
7070 TEST_ASSERT_VAL("wrong sample_type",
71
- PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
71
+ PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
7272 TEST_ASSERT_VAL("wrong sample_period",
73
- 1 == evsel->attr.sample_period);
73
+ 1 == evsel->core.attr.sample_period);
7474 }
7575 return 0;
7676 }
7777
78
-static int test__checkevent_raw(struct perf_evlist *evlist)
78
+static int test__checkevent_raw(struct evlist *evlist)
7979 {
80
- struct perf_evsel *evsel = perf_evlist__first(evlist);
80
+ struct evsel *evsel = evlist__first(evlist);
8181
82
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
83
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
84
- TEST_ASSERT_VAL("wrong config", 0x1a == evsel->attr.config);
82
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
83
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
84
+ TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
8585 return 0;
8686 }
8787
88
-static int test__checkevent_numeric(struct perf_evlist *evlist)
88
+static int test__checkevent_numeric(struct evlist *evlist)
8989 {
90
- struct perf_evsel *evsel = perf_evlist__first(evlist);
90
+ struct evsel *evsel = evlist__first(evlist);
9191
92
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
93
- TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type);
94
- TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
92
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
93
+ TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
94
+ TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
9595 return 0;
9696 }
9797
98
-static int test__checkevent_symbolic_name(struct perf_evlist *evlist)
98
+static int test__checkevent_symbolic_name(struct evlist *evlist)
9999 {
100
- struct perf_evsel *evsel = perf_evlist__first(evlist);
100
+ struct evsel *evsel = evlist__first(evlist);
101101
102
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
103
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
102
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
103
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
104104 TEST_ASSERT_VAL("wrong config",
105
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
105
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
106106 return 0;
107107 }
108108
109
-static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist)
109
+static int test__checkevent_symbolic_name_config(struct evlist *evlist)
110110 {
111
- struct perf_evsel *evsel = perf_evlist__first(evlist);
111
+ struct evsel *evsel = evlist__first(evlist);
112112
113
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
114
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
113
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
114
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
115115 TEST_ASSERT_VAL("wrong config",
116
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
116
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
117117 /*
118118 * The period value gets configured within perf_evlist__config,
119119 * while this test executes only parse events method.
120120 */
121121 TEST_ASSERT_VAL("wrong period",
122
- 0 == evsel->attr.sample_period);
122
+ 0 == evsel->core.attr.sample_period);
123123 TEST_ASSERT_VAL("wrong config1",
124
- 0 == evsel->attr.config1);
124
+ 0 == evsel->core.attr.config1);
125125 TEST_ASSERT_VAL("wrong config2",
126
- 1 == evsel->attr.config2);
126
+ 1 == evsel->core.attr.config2);
127127 return 0;
128128 }
129129
130
-static int test__checkevent_symbolic_alias(struct perf_evlist *evlist)
130
+static int test__checkevent_symbolic_alias(struct evlist *evlist)
131131 {
132
- struct perf_evsel *evsel = perf_evlist__first(evlist);
132
+ struct evsel *evsel = evlist__first(evlist);
133133
134
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
135
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
134
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
135
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
136136 TEST_ASSERT_VAL("wrong config",
137
- PERF_COUNT_SW_PAGE_FAULTS == evsel->attr.config);
137
+ PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
138138 return 0;
139139 }
140140
141
-static int test__checkevent_genhw(struct perf_evlist *evlist)
141
+static int test__checkevent_genhw(struct evlist *evlist)
142142 {
143
- struct perf_evsel *evsel = perf_evlist__first(evlist);
143
+ struct evsel *evsel = evlist__first(evlist);
144144
145
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
146
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->attr.type);
147
- TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->attr.config);
145
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
146
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
147
+ TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->core.attr.config);
148148 return 0;
149149 }
150150
151
-static int test__checkevent_breakpoint(struct perf_evlist *evlist)
151
+static int test__checkevent_breakpoint(struct evlist *evlist)
152152 {
153
- struct perf_evsel *evsel = perf_evlist__first(evlist);
153
+ struct evsel *evsel = evlist__first(evlist);
154154
155
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
156
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
157
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
155
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
156
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
157
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
158158 TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
159
- evsel->attr.bp_type);
159
+ evsel->core.attr.bp_type);
160160 TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 ==
161
- evsel->attr.bp_len);
161
+ evsel->core.attr.bp_len);
162162 return 0;
163163 }
164164
165
-static int test__checkevent_breakpoint_x(struct perf_evlist *evlist)
165
+static int test__checkevent_breakpoint_x(struct evlist *evlist)
166166 {
167
- struct perf_evsel *evsel = perf_evlist__first(evlist);
167
+ struct evsel *evsel = evlist__first(evlist);
168168
169
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
170
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
171
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
169
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
170
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
171
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
172172 TEST_ASSERT_VAL("wrong bp_type",
173
- HW_BREAKPOINT_X == evsel->attr.bp_type);
174
- TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->attr.bp_len);
173
+ HW_BREAKPOINT_X == evsel->core.attr.bp_type);
174
+ TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->core.attr.bp_len);
175175 return 0;
176176 }
177177
178
-static int test__checkevent_breakpoint_r(struct perf_evlist *evlist)
178
+static int test__checkevent_breakpoint_r(struct evlist *evlist)
179179 {
180
- struct perf_evsel *evsel = perf_evlist__first(evlist);
180
+ struct evsel *evsel = evlist__first(evlist);
181181
182
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
182
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
183183 TEST_ASSERT_VAL("wrong type",
184
- PERF_TYPE_BREAKPOINT == evsel->attr.type);
185
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
184
+ PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
185
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
186186 TEST_ASSERT_VAL("wrong bp_type",
187
- HW_BREAKPOINT_R == evsel->attr.bp_type);
187
+ HW_BREAKPOINT_R == evsel->core.attr.bp_type);
188188 TEST_ASSERT_VAL("wrong bp_len",
189
- HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len);
189
+ HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
190190 return 0;
191191 }
192192
193
-static int test__checkevent_breakpoint_w(struct perf_evlist *evlist)
193
+static int test__checkevent_breakpoint_w(struct evlist *evlist)
194194 {
195
- struct perf_evsel *evsel = perf_evlist__first(evlist);
195
+ struct evsel *evsel = evlist__first(evlist);
196196
197
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
197
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
198198 TEST_ASSERT_VAL("wrong type",
199
- PERF_TYPE_BREAKPOINT == evsel->attr.type);
200
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
199
+ PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
200
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
201201 TEST_ASSERT_VAL("wrong bp_type",
202
- HW_BREAKPOINT_W == evsel->attr.bp_type);
202
+ HW_BREAKPOINT_W == evsel->core.attr.bp_type);
203203 TEST_ASSERT_VAL("wrong bp_len",
204
- HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len);
204
+ HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
205205 return 0;
206206 }
207207
208
-static int test__checkevent_breakpoint_rw(struct perf_evlist *evlist)
208
+static int test__checkevent_breakpoint_rw(struct evlist *evlist)
209209 {
210
- struct perf_evsel *evsel = perf_evlist__first(evlist);
210
+ struct evsel *evsel = evlist__first(evlist);
211211
212
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
212
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
213213 TEST_ASSERT_VAL("wrong type",
214
- PERF_TYPE_BREAKPOINT == evsel->attr.type);
215
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
214
+ PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
215
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
216216 TEST_ASSERT_VAL("wrong bp_type",
217
- (HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->attr.bp_type);
217
+ (HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->core.attr.bp_type);
218218 TEST_ASSERT_VAL("wrong bp_len",
219
- HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len);
219
+ HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
220220 return 0;
221221 }
222222
223
-static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist)
223
+static int test__checkevent_tracepoint_modifier(struct evlist *evlist)
224224 {
225
- struct perf_evsel *evsel = perf_evlist__first(evlist);
225
+ struct evsel *evsel = evlist__first(evlist);
226226
227
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
228
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
229
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
230
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
227
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
228
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
229
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
230
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
231231
232232 return test__checkevent_tracepoint(evlist);
233233 }
234234
235235 static int
236
-test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist)
236
+test__checkevent_tracepoint_multi_modifier(struct evlist *evlist)
237237 {
238
- struct perf_evsel *evsel;
238
+ struct evsel *evsel;
239239
240
- TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
240
+ TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries > 1);
241241
242242 evlist__for_each_entry(evlist, evsel) {
243243 TEST_ASSERT_VAL("wrong exclude_user",
244
- !evsel->attr.exclude_user);
244
+ !evsel->core.attr.exclude_user);
245245 TEST_ASSERT_VAL("wrong exclude_kernel",
246
- evsel->attr.exclude_kernel);
247
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
248
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
246
+ evsel->core.attr.exclude_kernel);
247
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
248
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
249249 }
250250
251251 return test__checkevent_tracepoint_multi(evlist);
252252 }
253253
254
-static int test__checkevent_raw_modifier(struct perf_evlist *evlist)
254
+static int test__checkevent_raw_modifier(struct evlist *evlist)
255255 {
256
- struct perf_evsel *evsel = perf_evlist__first(evlist);
256
+ struct evsel *evsel = evlist__first(evlist);
257257
258
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
259
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
260
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
261
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
258
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
259
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
260
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
261
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
262262
263263 return test__checkevent_raw(evlist);
264264 }
265265
266
-static int test__checkevent_numeric_modifier(struct perf_evlist *evlist)
266
+static int test__checkevent_numeric_modifier(struct evlist *evlist)
267267 {
268
- struct perf_evsel *evsel = perf_evlist__first(evlist);
268
+ struct evsel *evsel = evlist__first(evlist);
269269
270
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
271
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
272
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
273
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
270
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
271
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
272
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
273
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
274274
275275 return test__checkevent_numeric(evlist);
276276 }
277277
278
-static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
278
+static int test__checkevent_symbolic_name_modifier(struct evlist *evlist)
279279 {
280
- struct perf_evsel *evsel = perf_evlist__first(evlist);
280
+ struct evsel *evsel = evlist__first(evlist);
281281
282
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
283
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
284
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
285
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
282
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
283
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
284
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
285
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
286286
287287 return test__checkevent_symbolic_name(evlist);
288288 }
289289
290
-static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist)
290
+static int test__checkevent_exclude_host_modifier(struct evlist *evlist)
291291 {
292
- struct perf_evsel *evsel = perf_evlist__first(evlist);
292
+ struct evsel *evsel = evlist__first(evlist);
293293
294
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
295
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
294
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
295
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
296296
297297 return test__checkevent_symbolic_name(evlist);
298298 }
299299
300
-static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist)
300
+static int test__checkevent_exclude_guest_modifier(struct evlist *evlist)
301301 {
302
- struct perf_evsel *evsel = perf_evlist__first(evlist);
302
+ struct evsel *evsel = evlist__first(evlist);
303303
304
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
305
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
304
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
305
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
306306
307307 return test__checkevent_symbolic_name(evlist);
308308 }
309309
310
-static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
310
+static int test__checkevent_symbolic_alias_modifier(struct evlist *evlist)
311311 {
312
- struct perf_evsel *evsel = perf_evlist__first(evlist);
312
+ struct evsel *evsel = evlist__first(evlist);
313313
314
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
315
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
316
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
317
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
314
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
315
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
316
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
317
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
318318
319319 return test__checkevent_symbolic_alias(evlist);
320320 }
321321
322
-static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
322
+static int test__checkevent_genhw_modifier(struct evlist *evlist)
323323 {
324
- struct perf_evsel *evsel = perf_evlist__first(evlist);
324
+ struct evsel *evsel = evlist__first(evlist);
325325
326
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
327
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
328
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
329
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
326
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
327
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
328
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
329
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
330330
331331 return test__checkevent_genhw(evlist);
332332 }
333333
334
-static int test__checkevent_exclude_idle_modifier(struct perf_evlist *evlist)
334
+static int test__checkevent_exclude_idle_modifier(struct evlist *evlist)
335335 {
336
- struct perf_evsel *evsel = perf_evlist__first(evlist);
336
+ struct evsel *evsel = evlist__first(evlist);
337337
338
- TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle);
339
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
340
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
341
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
342
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
343
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
344
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
338
+ TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle);
339
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
340
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
341
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
342
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
343
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
344
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
345345
346346 return test__checkevent_symbolic_name(evlist);
347347 }
348348
349
-static int test__checkevent_exclude_idle_modifier_1(struct perf_evlist *evlist)
349
+static int test__checkevent_exclude_idle_modifier_1(struct evlist *evlist)
350350 {
351
- struct perf_evsel *evsel = perf_evlist__first(evlist);
351
+ struct evsel *evsel = evlist__first(evlist);
352352
353
- TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle);
354
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
355
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
356
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
357
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
358
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
359
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
353
+ TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle);
354
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
355
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
356
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
357
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
358
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
359
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
360360
361361 return test__checkevent_symbolic_name(evlist);
362362 }
363363
364
-static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist)
364
+static int test__checkevent_breakpoint_modifier(struct evlist *evlist)
365365 {
366
- struct perf_evsel *evsel = perf_evlist__first(evlist);
366
+ struct evsel *evsel = evlist__first(evlist);
367367
368368
369
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
370
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
371
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
372
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
369
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
370
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
371
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
372
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
373373 TEST_ASSERT_VAL("wrong name",
374
- !strcmp(perf_evsel__name(evsel), "mem:0:u"));
374
+ !strcmp(evsel__name(evsel), "mem:0:u"));
375375
376376 return test__checkevent_breakpoint(evlist);
377377 }
378378
379
-static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist)
379
+static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist)
380380 {
381
- struct perf_evsel *evsel = perf_evlist__first(evlist);
381
+ struct evsel *evsel = evlist__first(evlist);
382382
383
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
384
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
385
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
386
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
383
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
384
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
385
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
386
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
387387 TEST_ASSERT_VAL("wrong name",
388
- !strcmp(perf_evsel__name(evsel), "mem:0:x:k"));
388
+ !strcmp(evsel__name(evsel), "mem:0:x:k"));
389389
390390 return test__checkevent_breakpoint_x(evlist);
391391 }
392392
393
-static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist)
393
+static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist)
394394 {
395
- struct perf_evsel *evsel = perf_evlist__first(evlist);
395
+ struct evsel *evsel = evlist__first(evlist);
396396
397
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
398
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
399
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
400
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
397
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
398
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
399
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
400
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
401401 TEST_ASSERT_VAL("wrong name",
402
- !strcmp(perf_evsel__name(evsel), "mem:0:r:hp"));
402
+ !strcmp(evsel__name(evsel), "mem:0:r:hp"));
403403
404404 return test__checkevent_breakpoint_r(evlist);
405405 }
406406
407
-static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist)
407
+static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist)
408408 {
409
- struct perf_evsel *evsel = perf_evlist__first(evlist);
409
+ struct evsel *evsel = evlist__first(evlist);
410410
411
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
412
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
413
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
414
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
411
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
412
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
413
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
414
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
415415 TEST_ASSERT_VAL("wrong name",
416
- !strcmp(perf_evsel__name(evsel), "mem:0:w:up"));
416
+ !strcmp(evsel__name(evsel), "mem:0:w:up"));
417417
418418 return test__checkevent_breakpoint_w(evlist);
419419 }
420420
421
-static int test__checkevent_breakpoint_rw_modifier(struct perf_evlist *evlist)
421
+static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist)
422422 {
423
- struct perf_evsel *evsel = perf_evlist__first(evlist);
423
+ struct evsel *evsel = evlist__first(evlist);
424424
425
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
426
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
427
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
428
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
425
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
426
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
427
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
428
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
429429 TEST_ASSERT_VAL("wrong name",
430
- !strcmp(perf_evsel__name(evsel), "mem:0:rw:kp"));
430
+ !strcmp(evsel__name(evsel), "mem:0:rw:kp"));
431431
432432 return test__checkevent_breakpoint_rw(evlist);
433433 }
434434
435
-static int test__checkevent_pmu(struct perf_evlist *evlist)
435
+static int test__checkevent_pmu(struct evlist *evlist)
436436 {
437437
438
- struct perf_evsel *evsel = perf_evlist__first(evlist);
438
+ struct evsel *evsel = evlist__first(evlist);
439439
440
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
441
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
442
- TEST_ASSERT_VAL("wrong config", 10 == evsel->attr.config);
443
- TEST_ASSERT_VAL("wrong config1", 1 == evsel->attr.config1);
444
- TEST_ASSERT_VAL("wrong config2", 3 == evsel->attr.config2);
440
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
441
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
442
+ TEST_ASSERT_VAL("wrong config", 10 == evsel->core.attr.config);
443
+ TEST_ASSERT_VAL("wrong config1", 1 == evsel->core.attr.config1);
444
+ TEST_ASSERT_VAL("wrong config2", 3 == evsel->core.attr.config2);
445445 /*
446446 * The period value gets configured within perf_evlist__config,
447447 * while this test executes only parse events method.
448448 */
449
- TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
449
+ TEST_ASSERT_VAL("wrong period", 0 == evsel->core.attr.sample_period);
450450
451451 return 0;
452452 }
453453
454
-static int test__checkevent_list(struct perf_evlist *evlist)
454
+static int test__checkevent_list(struct evlist *evlist)
455455 {
456
- struct perf_evsel *evsel = perf_evlist__first(evlist);
456
+ struct evsel *evsel = evlist__first(evlist);
457457
458
- TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
458
+ TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
459459
460460 /* r1 */
461
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
462
- TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
463
- TEST_ASSERT_VAL("wrong config1", 0 == evsel->attr.config1);
464
- TEST_ASSERT_VAL("wrong config2", 0 == evsel->attr.config2);
465
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
466
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
467
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
468
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
461
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
462
+ TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
463
+ TEST_ASSERT_VAL("wrong config1", 0 == evsel->core.attr.config1);
464
+ TEST_ASSERT_VAL("wrong config2", 0 == evsel->core.attr.config2);
465
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
466
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
467
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
468
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
469469
470470 /* syscalls:sys_enter_openat:k */
471
- evsel = perf_evsel__next(evsel);
472
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
471
+ evsel = evsel__next(evsel);
472
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
473473 TEST_ASSERT_VAL("wrong sample_type",
474
- PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
475
- TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
476
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
477
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
478
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
479
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
474
+ PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
475
+ TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
476
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
477
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
478
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
479
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
480480
481481 /* 1:1:hp */
482
- evsel = perf_evsel__next(evsel);
483
- TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type);
484
- TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
485
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
486
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
487
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
488
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
482
+ evsel = evsel__next(evsel);
483
+ TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
484
+ TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
485
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
486
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
487
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
488
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
489489
490490 return 0;
491491 }
492492
493
-static int test__checkevent_pmu_name(struct perf_evlist *evlist)
493
+static int test__checkevent_pmu_name(struct evlist *evlist)
494494 {
495
- struct perf_evsel *evsel = perf_evlist__first(evlist);
495
+ struct evsel *evsel = evlist__first(evlist);
496496
497497 /* cpu/config=1,name=krava/u */
498
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
499
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
500
- TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
501
- TEST_ASSERT_VAL("wrong name", !strcmp(perf_evsel__name(evsel), "krava"));
498
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
499
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
500
+ TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
501
+ TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "krava"));
502502
503503 /* cpu/config=2/u" */
504
- evsel = perf_evsel__next(evsel);
505
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
506
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
507
- TEST_ASSERT_VAL("wrong config", 2 == evsel->attr.config);
504
+ evsel = evsel__next(evsel);
505
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
506
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
507
+ TEST_ASSERT_VAL("wrong config", 2 == evsel->core.attr.config);
508508 TEST_ASSERT_VAL("wrong name",
509
- !strcmp(perf_evsel__name(evsel), "cpu/config=2/u"));
509
+ !strcmp(evsel__name(evsel), "cpu/config=2/u"));
510510
511511 return 0;
512512 }
513513
514
-static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist *evlist)
514
+static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist)
515515 {
516
- struct perf_evsel *evsel = perf_evlist__first(evlist);
516
+ struct evsel *evsel = evlist__first(evlist);
517517
518518 /* cpu/config=1,call-graph=fp,time,period=100000/ */
519
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
520
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
521
- TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config);
519
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
520
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
521
+ TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
522522 /*
523523 * The period, time and callgraph value gets configured
524524 * within perf_evlist__config,
525525 * while this test executes only parse events method.
526526 */
527
- TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
527
+ TEST_ASSERT_VAL("wrong period", 0 == evsel->core.attr.sample_period);
528528 TEST_ASSERT_VAL("wrong callgraph", !evsel__has_callchain(evsel));
529
- TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->attr.sample_type));
529
+ TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.sample_type));
530530
531531 /* cpu/config=2,call-graph=no,time=0,period=2000/ */
532
- evsel = perf_evsel__next(evsel);
533
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
534
- TEST_ASSERT_VAL("wrong config", 2 == evsel->attr.config);
532
+ evsel = evsel__next(evsel);
533
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
534
+ TEST_ASSERT_VAL("wrong config", 2 == evsel->core.attr.config);
535535 /*
536536 * The period, time and callgraph value gets configured
537537 * within perf_evlist__config,
538538 * while this test executes only parse events method.
539539 */
540
- TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
540
+ TEST_ASSERT_VAL("wrong period", 0 == evsel->core.attr.sample_period);
541541 TEST_ASSERT_VAL("wrong callgraph", !evsel__has_callchain(evsel));
542
- TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->attr.sample_type));
542
+ TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.sample_type));
543543
544544 return 0;
545545 }
546546
547
-static int test__checkevent_pmu_events(struct perf_evlist *evlist)
547
+static int test__checkevent_pmu_events(struct evlist *evlist)
548548 {
549
- struct perf_evsel *evsel = perf_evlist__first(evlist);
549
+ struct evsel *evsel = evlist__first(evlist);
550550
551
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
552
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
551
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
552
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
553553 TEST_ASSERT_VAL("wrong exclude_user",
554
- !evsel->attr.exclude_user);
554
+ !evsel->core.attr.exclude_user);
555555 TEST_ASSERT_VAL("wrong exclude_kernel",
556
- evsel->attr.exclude_kernel);
557
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
558
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
559
- TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned);
556
+ evsel->core.attr.exclude_kernel);
557
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
558
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
559
+ TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
560
+ TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
560561
561562 return 0;
562563 }
563564
564565
565
-static int test__checkevent_pmu_events_mix(struct perf_evlist *evlist)
566
+static int test__checkevent_pmu_events_mix(struct evlist *evlist)
566567 {
567
- struct perf_evsel *evsel = perf_evlist__first(evlist);
568
+ struct evsel *evsel = evlist__first(evlist);
568569
569570 /* pmu-event:u */
570
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
571
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
571572 TEST_ASSERT_VAL("wrong exclude_user",
572
- !evsel->attr.exclude_user);
573
+ !evsel->core.attr.exclude_user);
573574 TEST_ASSERT_VAL("wrong exclude_kernel",
574
- evsel->attr.exclude_kernel);
575
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
576
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
577
- TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned);
575
+ evsel->core.attr.exclude_kernel);
576
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
577
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
578
+ TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
579
+ TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
578580
579581 /* cpu/pmu-event/u*/
580
- evsel = perf_evsel__next(evsel);
581
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
582
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
582
+ evsel = evsel__next(evsel);
583
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
584
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
583585 TEST_ASSERT_VAL("wrong exclude_user",
584
- !evsel->attr.exclude_user);
586
+ !evsel->core.attr.exclude_user);
585587 TEST_ASSERT_VAL("wrong exclude_kernel",
586
- evsel->attr.exclude_kernel);
587
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
588
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
589
- TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned);
588
+ evsel->core.attr.exclude_kernel);
589
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
590
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
591
+ TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
592
+ TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.pinned);
590593
591594 return 0;
592595 }
....@@ -631,534 +634,562 @@
631634 TEST_ASSERT_VAL("wrong val", term->val.num == 1);
632635 TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "umask"));
633636
637
+ /*
638
+ * read
639
+ *
640
+ * The perf_pmu__test_parse_init injects 'read' term into
641
+ * perf_pmu_events_list, so 'read' is evaluated as read term
642
+ * and not as raw event with 'ead' hex value.
643
+ */
644
+ term = list_entry(term->list.next, struct parse_events_term, list);
645
+ TEST_ASSERT_VAL("wrong type term",
646
+ term->type_term == PARSE_EVENTS__TERM_TYPE_USER);
647
+ TEST_ASSERT_VAL("wrong type val",
648
+ term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
649
+ TEST_ASSERT_VAL("wrong val", term->val.num == 1);
650
+ TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "read"));
651
+
652
+ /*
653
+ * r0xead
654
+ *
655
+ * To be still able to pass 'ead' value with 'r' syntax,
656
+ * we added support to parse 'r0xHEX' event.
657
+ */
658
+ term = list_entry(term->list.next, struct parse_events_term, list);
659
+ TEST_ASSERT_VAL("wrong type term",
660
+ term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG);
661
+ TEST_ASSERT_VAL("wrong type val",
662
+ term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
663
+ TEST_ASSERT_VAL("wrong val", term->val.num == 0xead);
664
+ TEST_ASSERT_VAL("wrong config", !term->config);
634665 return 0;
635666 }
636667
637
-static int test__group1(struct perf_evlist *evlist)
668
+static int test__group1(struct evlist *evlist)
638669 {
639
- struct perf_evsel *evsel, *leader;
670
+ struct evsel *evsel, *leader;
640671
641
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
672
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
642673 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
643674
644675 /* instructions:k */
645
- evsel = leader = perf_evlist__first(evlist);
646
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
676
+ evsel = leader = evlist__first(evlist);
677
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
647678 TEST_ASSERT_VAL("wrong config",
648
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
649
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
650
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
651
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
652
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
653
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
654
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
655
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
656
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
657
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
679
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
680
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
681
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
682
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
683
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
684
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
685
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
686
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
687
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
688
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
658689 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
659690
660691 /* cycles:upp */
661
- evsel = perf_evsel__next(evsel);
662
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
692
+ evsel = evsel__next(evsel);
693
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
663694 TEST_ASSERT_VAL("wrong config",
664
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
665
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
666
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
667
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
695
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
696
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
697
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
698
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
668699 /* use of precise requires exclude_guest */
669
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
670
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
671
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2);
700
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
701
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
702
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 2);
672703 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
673
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
704
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
674705 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
675706
676707 return 0;
677708 }
678709
679
-static int test__group2(struct perf_evlist *evlist)
710
+static int test__group2(struct evlist *evlist)
680711 {
681
- struct perf_evsel *evsel, *leader;
712
+ struct evsel *evsel, *leader;
682713
683
- TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
714
+ TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
684715 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
685716
686717 /* faults + :ku modifier */
687
- evsel = leader = perf_evlist__first(evlist);
688
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
718
+ evsel = leader = evlist__first(evlist);
719
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
689720 TEST_ASSERT_VAL("wrong config",
690
- PERF_COUNT_SW_PAGE_FAULTS == evsel->attr.config);
691
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
692
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
693
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
694
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
695
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
696
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
697
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
698
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
699
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
721
+ PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
722
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
723
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
724
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
725
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
726
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
727
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
728
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
729
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
730
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
700731 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
701732
702733 /* cache-references + :u modifier */
703
- evsel = perf_evsel__next(evsel);
704
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
734
+ evsel = evsel__next(evsel);
735
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
705736 TEST_ASSERT_VAL("wrong config",
706
- PERF_COUNT_HW_CACHE_REFERENCES == evsel->attr.config);
707
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
708
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
709
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
710
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
711
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
712
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
737
+ PERF_COUNT_HW_CACHE_REFERENCES == evsel->core.attr.config);
738
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
739
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
740
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
741
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
742
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
743
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
713744 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
714
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
745
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
715746 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
716747
717748 /* cycles:k */
718
- evsel = perf_evsel__next(evsel);
719
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
749
+ evsel = evsel__next(evsel);
750
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
720751 TEST_ASSERT_VAL("wrong config",
721
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
722
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
723
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
724
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
725
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
726
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
727
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
728
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
752
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
753
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
754
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
755
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
756
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
757
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
758
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
759
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
729760 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
730761
731762 return 0;
732763 }
733764
734
-static int test__group3(struct perf_evlist *evlist __maybe_unused)
765
+static int test__group3(struct evlist *evlist __maybe_unused)
735766 {
736
- struct perf_evsel *evsel, *leader;
767
+ struct evsel *evsel, *leader;
737768
738
- TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries);
769
+ TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
739770 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
740771
741772 /* group1 syscalls:sys_enter_openat:H */
742
- evsel = leader = perf_evlist__first(evlist);
743
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
773
+ evsel = leader = evlist__first(evlist);
774
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
744775 TEST_ASSERT_VAL("wrong sample_type",
745
- PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
746
- TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
747
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
748
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
749
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
750
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
751
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
752
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
753
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
776
+ PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
777
+ TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
778
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
779
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
780
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
781
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
782
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
783
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
784
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
754785 TEST_ASSERT_VAL("wrong group name",
755786 !strcmp(leader->group_name, "group1"));
756
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
757
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
787
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
788
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
758789 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
759790
760791 /* group1 cycles:kppp */
761
- evsel = perf_evsel__next(evsel);
762
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
792
+ evsel = evsel__next(evsel);
793
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
763794 TEST_ASSERT_VAL("wrong config",
764
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
765
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
766
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
767
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
795
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
796
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
797
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
798
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
768799 /* use of precise requires exclude_guest */
769
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
770
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
771
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3);
800
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
801
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
802
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 3);
772803 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
773804 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
774
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
805
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
775806 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
776807
777808 /* group2 cycles + G modifier */
778
- evsel = leader = perf_evsel__next(evsel);
779
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
809
+ evsel = leader = evsel__next(evsel);
810
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
780811 TEST_ASSERT_VAL("wrong config",
781
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
782
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
783
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
784
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
785
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
786
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
787
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
788
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
812
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
813
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
814
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
815
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
816
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
817
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
818
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
819
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
789820 TEST_ASSERT_VAL("wrong group name",
790821 !strcmp(leader->group_name, "group2"));
791
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
792
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
822
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
823
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
793824 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
794825
795826 /* group2 1:3 + G modifier */
796
- evsel = perf_evsel__next(evsel);
797
- TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type);
798
- TEST_ASSERT_VAL("wrong config", 3 == evsel->attr.config);
799
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
800
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
801
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
802
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
803
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
804
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
827
+ evsel = evsel__next(evsel);
828
+ TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
829
+ TEST_ASSERT_VAL("wrong config", 3 == evsel->core.attr.config);
830
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
831
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
832
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
833
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
834
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
835
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
805836 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
806
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
837
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
807838 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
808839
809840 /* instructions:u */
810
- evsel = perf_evsel__next(evsel);
811
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
841
+ evsel = evsel__next(evsel);
842
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
812843 TEST_ASSERT_VAL("wrong config",
813
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
814
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
815
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
816
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
817
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
818
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
819
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
820
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
844
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
845
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
846
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
847
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
848
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
849
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
850
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
851
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
821852 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
822853
823854 return 0;
824855 }
825856
826
-static int test__group4(struct perf_evlist *evlist __maybe_unused)
857
+static int test__group4(struct evlist *evlist __maybe_unused)
827858 {
828
- struct perf_evsel *evsel, *leader;
859
+ struct evsel *evsel, *leader;
829860
830
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
861
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
831862 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
832863
833864 /* cycles:u + p */
834
- evsel = leader = perf_evlist__first(evlist);
835
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
865
+ evsel = leader = evlist__first(evlist);
866
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
836867 TEST_ASSERT_VAL("wrong config",
837
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
838
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
839
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
840
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
868
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
869
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
870
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
871
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
841872 /* use of precise requires exclude_guest */
842
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
843
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
844
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1);
873
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
874
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
875
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 1);
845876 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
846
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
847
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
848
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
877
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
878
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
879
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
849880 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
850881
851882 /* instructions:kp + p */
852
- evsel = perf_evsel__next(evsel);
853
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
883
+ evsel = evsel__next(evsel);
884
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
854885 TEST_ASSERT_VAL("wrong config",
855
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
856
- TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
857
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
858
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
886
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
887
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
888
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
889
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
859890 /* use of precise requires exclude_guest */
860
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
861
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
862
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2);
891
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
892
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
893
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 2);
863894 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
864
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
895
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
865896 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
866897
867898 return 0;
868899 }
869900
870
-static int test__group5(struct perf_evlist *evlist __maybe_unused)
901
+static int test__group5(struct evlist *evlist __maybe_unused)
871902 {
872
- struct perf_evsel *evsel, *leader;
903
+ struct evsel *evsel, *leader;
873904
874
- TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries);
905
+ TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
875906 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
876907
877908 /* cycles + G */
878
- evsel = leader = perf_evlist__first(evlist);
879
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
909
+ evsel = leader = evlist__first(evlist);
910
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
880911 TEST_ASSERT_VAL("wrong config",
881
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
882
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
883
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
884
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
885
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
886
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
887
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
912
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
913
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
914
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
915
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
916
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
917
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
918
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
888919 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
889
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
890
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
891
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
920
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
921
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
922
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
892923 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
893924
894925 /* instructions + G */
895
- evsel = perf_evsel__next(evsel);
896
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
926
+ evsel = evsel__next(evsel);
927
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
897928 TEST_ASSERT_VAL("wrong config",
898
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
899
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
900
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
901
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
902
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
903
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
904
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
929
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
930
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
931
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
932
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
933
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
934
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
935
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
905936 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
906
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
937
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
907938 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
908939
909940 /* cycles:G */
910
- evsel = leader = perf_evsel__next(evsel);
911
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
941
+ evsel = leader = evsel__next(evsel);
942
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
912943 TEST_ASSERT_VAL("wrong config",
913
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
914
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
915
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
916
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
917
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
918
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
919
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
944
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
945
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
946
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
947
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
948
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
949
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
950
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
920951 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
921
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
922
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
923
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
952
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
953
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
954
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
924955 TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
925956
926957 /* instructions:G */
927
- evsel = perf_evsel__next(evsel);
928
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
958
+ evsel = evsel__next(evsel);
959
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
929960 TEST_ASSERT_VAL("wrong config",
930
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
931
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
932
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
933
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
934
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
935
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
936
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
961
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
962
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
963
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
964
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
965
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
966
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
967
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
937968 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
938
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
969
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
939970
940971 /* cycles */
941
- evsel = perf_evsel__next(evsel);
942
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
972
+ evsel = evsel__next(evsel);
973
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
943974 TEST_ASSERT_VAL("wrong config",
944
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
945
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
946
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
947
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
948
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
949
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
950
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
951
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
975
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
976
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
977
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
978
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
979
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
980
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
981
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
982
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
952983
953984 return 0;
954985 }
955986
956
-static int test__group_gh1(struct perf_evlist *evlist)
987
+static int test__group_gh1(struct evlist *evlist)
957988 {
958
- struct perf_evsel *evsel, *leader;
989
+ struct evsel *evsel, *leader;
959990
960
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
991
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
961992 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
962993
963994 /* cycles + :H group modifier */
964
- evsel = leader = perf_evlist__first(evlist);
965
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
995
+ evsel = leader = evlist__first(evlist);
996
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
966997 TEST_ASSERT_VAL("wrong config",
967
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
968
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
969
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
970
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
971
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
972
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
973
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
998
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
999
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1000
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1001
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1002
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1003
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1004
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
9741005 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
975
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
976
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
977
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
1006
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
1007
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
1008
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
9781009
9791010 /* cache-misses:G + :H group modifier */
980
- evsel = perf_evsel__next(evsel);
981
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1011
+ evsel = evsel__next(evsel);
1012
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
9821013 TEST_ASSERT_VAL("wrong config",
983
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
984
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
985
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
986
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
987
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
988
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
989
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1014
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1015
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1016
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1017
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1018
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1019
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1020
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
9901021 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
991
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
1022
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
9921023
9931024 return 0;
9941025 }
9951026
996
-static int test__group_gh2(struct perf_evlist *evlist)
1027
+static int test__group_gh2(struct evlist *evlist)
9971028 {
998
- struct perf_evsel *evsel, *leader;
1029
+ struct evsel *evsel, *leader;
9991030
1000
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1031
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
10011032 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
10021033
10031034 /* cycles + :G group modifier */
1004
- evsel = leader = perf_evlist__first(evlist);
1005
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1035
+ evsel = leader = evlist__first(evlist);
1036
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
10061037 TEST_ASSERT_VAL("wrong config",
1007
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
1008
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1009
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
1010
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
1011
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
1012
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
1013
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1038
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
1039
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1040
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1041
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1042
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1043
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
1044
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
10141045 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
1015
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
1016
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
1017
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
1046
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
1047
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
1048
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
10181049
10191050 /* cache-misses:H + :G group modifier */
1020
- evsel = perf_evsel__next(evsel);
1021
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1051
+ evsel = evsel__next(evsel);
1052
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
10221053 TEST_ASSERT_VAL("wrong config",
1023
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
1024
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1025
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
1026
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
1027
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
1028
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1029
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1054
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1055
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1056
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1057
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1058
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1059
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1060
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
10301061 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
1031
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
1062
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
10321063
10331064 return 0;
10341065 }
10351066
1036
-static int test__group_gh3(struct perf_evlist *evlist)
1067
+static int test__group_gh3(struct evlist *evlist)
10371068 {
1038
- struct perf_evsel *evsel, *leader;
1069
+ struct evsel *evsel, *leader;
10391070
1040
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1071
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
10411072 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
10421073
10431074 /* cycles:G + :u group modifier */
1044
- evsel = leader = perf_evlist__first(evlist);
1045
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1075
+ evsel = leader = evlist__first(evlist);
1076
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
10461077 TEST_ASSERT_VAL("wrong config",
1047
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
1048
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1049
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1050
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1051
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
1052
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
1053
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1078
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
1079
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1080
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1081
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1082
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1083
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
1084
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
10541085 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
1055
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
1056
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
1057
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
1086
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
1087
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
1088
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
10581089
10591090 /* cache-misses:H + :u group modifier */
1060
- evsel = perf_evsel__next(evsel);
1061
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1091
+ evsel = evsel__next(evsel);
1092
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
10621093 TEST_ASSERT_VAL("wrong config",
1063
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
1064
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1065
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1066
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1067
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1068
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1069
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1094
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1095
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1096
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1097
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1098
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1099
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1100
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
10701101 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
1071
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
1102
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
10721103
10731104 return 0;
10741105 }
10751106
1076
-static int test__group_gh4(struct perf_evlist *evlist)
1107
+static int test__group_gh4(struct evlist *evlist)
10771108 {
1078
- struct perf_evsel *evsel, *leader;
1109
+ struct evsel *evsel, *leader;
10791110
1080
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1111
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
10811112 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
10821113
10831114 /* cycles:G + :uG group modifier */
1084
- evsel = leader = perf_evlist__first(evlist);
1085
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1115
+ evsel = leader = evlist__first(evlist);
1116
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
10861117 TEST_ASSERT_VAL("wrong config",
1087
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
1088
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1089
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1090
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1091
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
1092
- TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
1093
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1118
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
1119
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1120
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1121
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1122
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1123
+ TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
1124
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
10941125 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
1095
- TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
1096
- TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2);
1097
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0);
1126
+ TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
1127
+ TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
1128
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
10981129
10991130 /* cache-misses:H + :uG group modifier */
1100
- evsel = perf_evsel__next(evsel);
1101
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1131
+ evsel = evsel__next(evsel);
1132
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11021133 TEST_ASSERT_VAL("wrong config",
1103
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
1104
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1105
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1106
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1107
- TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
1108
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1109
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1134
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1135
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1136
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1137
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1138
+ TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
1139
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1140
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
11101141 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
1111
- TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1);
1142
+ TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
11121143
11131144 return 0;
11141145 }
11151146
1116
-static int test__leader_sample1(struct perf_evlist *evlist)
1147
+static int test__leader_sample1(struct evlist *evlist)
11171148 {
1118
- struct perf_evsel *evsel, *leader;
1149
+ struct evsel *evsel, *leader;
11191150
1120
- TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
1151
+ TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
11211152
11221153 /* cycles - sampling group leader */
1123
- evsel = leader = perf_evlist__first(evlist);
1124
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1154
+ evsel = leader = evlist__first(evlist);
1155
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11251156 TEST_ASSERT_VAL("wrong config",
1126
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
1127
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1128
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
1129
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
1130
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1131
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1132
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1157
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
1158
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1159
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1160
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1161
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1162
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1163
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
11331164 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
11341165 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
11351166 TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
11361167
11371168 /* cache-misses - not sampling */
1138
- evsel = perf_evsel__next(evsel);
1139
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1169
+ evsel = evsel__next(evsel);
1170
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11401171 TEST_ASSERT_VAL("wrong config",
1141
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
1142
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1143
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
1144
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
1145
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1146
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1147
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1172
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1173
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1174
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1175
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1176
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1177
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1178
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
11481179 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
11491180 TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
11501181
11511182 /* branch-misses - not sampling */
1152
- evsel = perf_evsel__next(evsel);
1153
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1183
+ evsel = evsel__next(evsel);
1184
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11541185 TEST_ASSERT_VAL("wrong config",
1155
- PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config);
1156
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1157
- TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
1158
- TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
1159
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1160
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1161
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1186
+ PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
1187
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1188
+ TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
1189
+ TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
1190
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1191
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1192
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
11621193 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
11631194 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
11641195 TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
....@@ -1166,38 +1197,38 @@
11661197 return 0;
11671198 }
11681199
1169
-static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused)
1200
+static int test__leader_sample2(struct evlist *evlist __maybe_unused)
11701201 {
1171
- struct perf_evsel *evsel, *leader;
1202
+ struct evsel *evsel, *leader;
11721203
1173
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1204
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
11741205
11751206 /* instructions - sampling group leader */
1176
- evsel = leader = perf_evlist__first(evlist);
1177
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1207
+ evsel = leader = evlist__first(evlist);
1208
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11781209 TEST_ASSERT_VAL("wrong config",
1179
- PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config);
1180
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1181
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1182
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1183
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1184
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1185
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1210
+ PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
1211
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1212
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1213
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1214
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1215
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1216
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
11861217 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
11871218 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
11881219 TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
11891220
11901221 /* branch-misses - not sampling */
1191
- evsel = perf_evsel__next(evsel);
1192
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1222
+ evsel = evsel__next(evsel);
1223
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
11931224 TEST_ASSERT_VAL("wrong config",
1194
- PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config);
1195
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1196
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1197
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1198
- TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
1199
- TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
1200
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1225
+ PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
1226
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1227
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1228
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1229
+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
1230
+ TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
1231
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
12011232 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
12021233 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
12031234 TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
....@@ -1205,131 +1236,174 @@
12051236 return 0;
12061237 }
12071238
1208
-static int test__checkevent_pinned_modifier(struct perf_evlist *evlist)
1239
+static int test__checkevent_pinned_modifier(struct evlist *evlist)
12091240 {
1210
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1241
+ struct evsel *evsel = evlist__first(evlist);
12111242
1212
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1213
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1214
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1215
- TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip);
1216
- TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned);
1243
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1244
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1245
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1246
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
1247
+ TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned);
12171248
12181249 return test__checkevent_symbolic_name(evlist);
12191250 }
12201251
1221
-static int test__pinned_group(struct perf_evlist *evlist)
1252
+static int test__pinned_group(struct evlist *evlist)
12221253 {
1223
- struct perf_evsel *evsel, *leader;
1254
+ struct evsel *evsel, *leader;
12241255
1225
- TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
1256
+ TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
12261257
12271258 /* cycles - group leader */
1228
- evsel = leader = perf_evlist__first(evlist);
1229
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1259
+ evsel = leader = evlist__first(evlist);
1260
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
12301261 TEST_ASSERT_VAL("wrong config",
1231
- PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
1262
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
12321263 TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
12331264 TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
1234
- TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned);
1265
+ TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned);
12351266
12361267 /* cache-misses - can not be pinned, but will go on with the leader */
1237
- evsel = perf_evsel__next(evsel);
1238
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
1268
+ evsel = evsel__next(evsel);
1269
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
12391270 TEST_ASSERT_VAL("wrong config",
1240
- PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config);
1241
- TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned);
1271
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1272
+ TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
12421273
12431274 /* branch-misses - ditto */
1244
- evsel = perf_evsel__next(evsel);
1275
+ evsel = evsel__next(evsel);
12451276 TEST_ASSERT_VAL("wrong config",
1246
- PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config);
1247
- TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned);
1277
+ PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
1278
+ TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
12481279
12491280 return 0;
12501281 }
12511282
1252
-static int test__checkevent_breakpoint_len(struct perf_evlist *evlist)
1283
+static int test__checkevent_exclusive_modifier(struct evlist *evlist)
12531284 {
1254
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1285
+ struct evsel *evsel = evlist__first(evlist);
12551286
1256
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
1257
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
1258
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
1287
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1288
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1289
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1290
+ TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
1291
+ TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive);
1292
+
1293
+ return test__checkevent_symbolic_name(evlist);
1294
+}
1295
+
1296
+static int test__exclusive_group(struct evlist *evlist)
1297
+{
1298
+ struct evsel *evsel, *leader;
1299
+
1300
+ TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
1301
+
1302
+ /* cycles - group leader */
1303
+ evsel = leader = evlist__first(evlist);
1304
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
1305
+ TEST_ASSERT_VAL("wrong config",
1306
+ PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
1307
+ TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
1308
+ TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
1309
+ TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive);
1310
+
1311
+ /* cache-misses - can not be pinned, but will go on with the leader */
1312
+ evsel = evsel__next(evsel);
1313
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
1314
+ TEST_ASSERT_VAL("wrong config",
1315
+ PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
1316
+ TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
1317
+
1318
+ /* branch-misses - ditto */
1319
+ evsel = evsel__next(evsel);
1320
+ TEST_ASSERT_VAL("wrong config",
1321
+ PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
1322
+ TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
1323
+
1324
+ return 0;
1325
+}
1326
+static int test__checkevent_breakpoint_len(struct evlist *evlist)
1327
+{
1328
+ struct evsel *evsel = evlist__first(evlist);
1329
+
1330
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
1331
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
1332
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
12591333 TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
1260
- evsel->attr.bp_type);
1334
+ evsel->core.attr.bp_type);
12611335 TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 ==
1262
- evsel->attr.bp_len);
1336
+ evsel->core.attr.bp_len);
12631337
12641338 return 0;
12651339 }
12661340
1267
-static int test__checkevent_breakpoint_len_w(struct perf_evlist *evlist)
1341
+static int test__checkevent_breakpoint_len_w(struct evlist *evlist)
12681342 {
1269
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1343
+ struct evsel *evsel = evlist__first(evlist);
12701344
1271
- TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
1272
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
1273
- TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config);
1345
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
1346
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
1347
+ TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
12741348 TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W ==
1275
- evsel->attr.bp_type);
1349
+ evsel->core.attr.bp_type);
12761350 TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 ==
1277
- evsel->attr.bp_len);
1351
+ evsel->core.attr.bp_len);
12781352
12791353 return 0;
12801354 }
12811355
12821356 static int
1283
-test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
1357
+test__checkevent_breakpoint_len_rw_modifier(struct evlist *evlist)
12841358 {
1285
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1359
+ struct evsel *evsel = evlist__first(evlist);
12861360
1287
- TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1288
- TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
1289
- TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
1290
- TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
1361
+ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
1362
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1363
+ TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
1364
+ TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
12911365
12921366 return test__checkevent_breakpoint_rw(evlist);
12931367 }
12941368
1295
-static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
1369
+static int test__checkevent_precise_max_modifier(struct evlist *evlist)
12961370 {
1297
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1371
+ struct evsel *evsel = evlist__first(evlist);
12981372
1299
- TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1300
- TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
1373
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
1374
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
13011375 TEST_ASSERT_VAL("wrong config",
1302
- PERF_COUNT_SW_TASK_CLOCK == evsel->attr.config);
1376
+ PERF_COUNT_SW_TASK_CLOCK == evsel->core.attr.config);
13031377 return 0;
13041378 }
13051379
1306
-static int test__checkevent_config_symbol(struct perf_evlist *evlist)
1380
+static int test__checkevent_config_symbol(struct evlist *evlist)
13071381 {
1308
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1382
+ struct evsel *evsel = evlist__first(evlist);
13091383
13101384 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0);
13111385 return 0;
13121386 }
13131387
1314
-static int test__checkevent_config_raw(struct perf_evlist *evlist)
1388
+static int test__checkevent_config_raw(struct evlist *evlist)
13151389 {
1316
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1390
+ struct evsel *evsel = evlist__first(evlist);
13171391
13181392 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0);
13191393 return 0;
13201394 }
13211395
1322
-static int test__checkevent_config_num(struct perf_evlist *evlist)
1396
+static int test__checkevent_config_num(struct evlist *evlist)
13231397 {
1324
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1398
+ struct evsel *evsel = evlist__first(evlist);
13251399
13261400 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0);
13271401 return 0;
13281402 }
13291403
1330
-static int test__checkevent_config_cache(struct perf_evlist *evlist)
1404
+static int test__checkevent_config_cache(struct evlist *evlist)
13311405 {
1332
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1406
+ struct evsel *evsel = evlist__first(evlist);
13331407
13341408 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0);
13351409 return 0;
....@@ -1340,19 +1414,49 @@
13401414 return !!perf_pmu__find("intel_pt");
13411415 }
13421416
1343
-static int test__intel_pt(struct perf_evlist *evlist)
1417
+static int test__intel_pt(struct evlist *evlist)
13441418 {
1345
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1419
+ struct evsel *evsel = evlist__first(evlist);
13461420
13471421 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
13481422 return 0;
13491423 }
13501424
1351
-static int test__checkevent_complex_name(struct perf_evlist *evlist)
1425
+static int test__checkevent_complex_name(struct evlist *evlist)
13521426 {
1353
- struct perf_evsel *evsel = perf_evlist__first(evlist);
1427
+ struct evsel *evsel = evlist__first(evlist);
13541428
13551429 TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0);
1430
+ return 0;
1431
+}
1432
+
1433
+static int test__checkevent_raw_pmu(struct evlist *evlist)
1434
+{
1435
+ struct evsel *evsel = evlist__first(evlist);
1436
+
1437
+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
1438
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
1439
+ TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
1440
+ return 0;
1441
+}
1442
+
1443
+static int test__sym_event_slash(struct evlist *evlist)
1444
+{
1445
+ struct evsel *evsel = evlist__first(evlist);
1446
+
1447
+ TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
1448
+ TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
1449
+ TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
1450
+ return 0;
1451
+}
1452
+
1453
+static int test__sym_event_dc(struct evlist *evlist)
1454
+{
1455
+ struct evsel *evsel = evlist__first(evlist);
1456
+
1457
+ TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
1458
+ TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
1459
+ TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
13561460 return 0;
13571461 }
13581462
....@@ -1402,10 +1506,10 @@
14021506 return cnt;
14031507 }
14041508
1405
-static int test__all_tracepoints(struct perf_evlist *evlist)
1509
+static int test__all_tracepoints(struct evlist *evlist)
14061510 {
14071511 TEST_ASSERT_VAL("wrong events count",
1408
- count_tracepoints() == evlist->nr_entries);
1512
+ count_tracepoints() == evlist->core.nr_entries);
14091513
14101514 return test__checkevent_tracepoint_multi(evlist);
14111515 }
....@@ -1415,7 +1519,7 @@
14151519 __u32 type;
14161520 const int id;
14171521 bool (*valid)(void);
1418
- int (*check)(struct perf_evlist *evlist);
1522
+ int (*check)(struct evlist *evlist);
14191523 };
14201524
14211525 static struct evlist_test test__events[] = {
....@@ -1697,7 +1801,27 @@
16971801 .name = "cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk",
16981802 .check = test__checkevent_complex_name,
16991803 .id = 53
1700
- }
1804
+ },
1805
+ {
1806
+ .name = "cycles//u",
1807
+ .check = test__sym_event_slash,
1808
+ .id = 54,
1809
+ },
1810
+ {
1811
+ .name = "cycles:k",
1812
+ .check = test__sym_event_dc,
1813
+ .id = 55,
1814
+ },
1815
+ {
1816
+ .name = "instructions:uep",
1817
+ .check = test__checkevent_exclusive_modifier,
1818
+ .id = 56,
1819
+ },
1820
+ {
1821
+ .name = "{cycles,cache-misses,branch-misses}:e",
1822
+ .check = test__exclusive_group,
1823
+ .id = 57,
1824
+ },
17011825 };
17021826
17031827 static struct evlist_test test__events_pmu[] = {
....@@ -1720,7 +1844,17 @@
17201844 .name = "cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2/ukp",
17211845 .check = test__checkevent_complex_name,
17221846 .id = 3,
1723
- }
1847
+ },
1848
+ {
1849
+ .name = "software/r1a/",
1850
+ .check = test__checkevent_raw_pmu,
1851
+ .id = 4,
1852
+ },
1853
+ {
1854
+ .name = "software/r0x1a/",
1855
+ .check = test__checkevent_raw_pmu,
1856
+ .id = 4,
1857
+ },
17241858 };
17251859
17261860 struct terms_test {
....@@ -1731,23 +1865,24 @@
17311865
17321866 static struct terms_test test__terms[] = {
17331867 [0] = {
1734
- .str = "config=10,config1,config2=3,umask=1",
1868
+ .str = "config=10,config1,config2=3,umask=1,read,r0xead",
17351869 .check = test__checkterms_simple,
17361870 },
17371871 };
17381872
17391873 static int test_event(struct evlist_test *e)
17401874 {
1741
- struct parse_events_error err = { .idx = 0, };
1742
- struct perf_evlist *evlist;
1875
+ struct parse_events_error err;
1876
+ struct evlist *evlist;
17431877 int ret;
17441878
1879
+ bzero(&err, sizeof(err));
17451880 if (e->valid && !e->valid()) {
17461881 pr_debug("... SKIP");
17471882 return 0;
17481883 }
17491884
1750
- evlist = perf_evlist__new();
1885
+ evlist = evlist__new();
17511886 if (evlist == NULL)
17521887 return -ENOMEM;
17531888
....@@ -1760,7 +1895,7 @@
17601895 ret = e->check(evlist);
17611896 }
17621897
1763
- perf_evlist__delete(evlist);
1898
+ evlist__delete(evlist);
17641899
17651900 return ret;
17661901 }
....@@ -1790,6 +1925,13 @@
17901925
17911926 INIT_LIST_HEAD(&terms);
17921927
1928
+ /*
1929
+ * The perf_pmu__test_parse_init prepares perf_pmu_events_list
1930
+ * which gets freed in parse_events_terms.
1931
+ */
1932
+ if (perf_pmu__test_parse_init())
1933
+ return -1;
1934
+
17931935 ret = parse_events_terms(&terms, t->str);
17941936 if (ret) {
17951937 pr_debug("failed to parse terms '%s', err %d\n",