Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libperf: Add perf_evlist__first()/last() functions

Add perf_evlist__first()/last() functions to libperf, as internal
functions and rename perf's origins to evlist__first/last.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-29-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
515dbe48 70c20369

+145 -129
+1 -1
tools/perf/arch/arm/util/cs-etm.c
··· 416 416 if (err) 417 417 goto out; 418 418 419 - tracking_evsel = perf_evlist__last(evlist); 419 + tracking_evsel = evlist__last(evlist); 420 420 perf_evlist__set_tracking_event(evlist, tracking_evsel); 421 421 422 422 tracking_evsel->core.attr.freq = 0;
+1 -1
tools/perf/arch/arm64/util/arm-spe.c
··· 129 129 if (err) 130 130 return err; 131 131 132 - tracking_evsel = perf_evlist__last(evlist); 132 + tracking_evsel = evlist__last(evlist); 133 133 perf_evlist__set_tracking_event(evlist, tracking_evsel); 134 134 135 135 tracking_evsel->core.attr.freq = 0;
+2 -2
tools/perf/arch/x86/tests/intel-cqm.c
··· 62 62 goto out; 63 63 } 64 64 65 - evsel = perf_evlist__first(evlist); 65 + evsel = evlist__first(evlist); 66 66 if (!evsel) { 67 - pr_debug("perf_evlist__first failed\n"); 67 + pr_debug("evlist__first failed\n"); 68 68 goto out; 69 69 } 70 70
+1 -1
tools/perf/arch/x86/tests/perf-time-to-tsc.c
··· 83 83 84 84 perf_evlist__config(evlist, &opts, NULL); 85 85 86 - evsel = perf_evlist__first(evlist); 86 + evsel = evlist__first(evlist); 87 87 88 88 evsel->core.attr.comm = 1; 89 89 evsel->core.attr.disabled = 1;
+1 -1
tools/perf/arch/x86/util/intel-bts.c
··· 231 231 if (err) 232 232 return err; 233 233 234 - tracking_evsel = perf_evlist__last(evlist); 234 + tracking_evsel = evlist__last(evlist); 235 235 236 236 perf_evlist__set_tracking_event(evlist, tracking_evsel); 237 237
+3 -3
tools/perf/arch/x86/util/intel-pt.c
··· 417 417 return err; 418 418 } 419 419 420 - evsel = perf_evlist__last(evlist); 420 + evsel = evlist__last(evlist); 421 421 422 422 perf_evsel__set_sample_bit(evsel, CPU); 423 423 perf_evsel__set_sample_bit(evsel, TIME); ··· 717 717 if (err) 718 718 return err; 719 719 720 - switch_evsel = perf_evlist__last(evlist); 720 + switch_evsel = evlist__last(evlist); 721 721 722 722 switch_evsel->core.attr.freq = 0; 723 723 switch_evsel->core.attr.sample_period = 1; ··· 775 775 if (err) 776 776 return err; 777 777 778 - tracking_evsel = perf_evlist__last(evlist); 778 + tracking_evsel = evlist__last(evlist); 779 779 780 780 perf_evlist__set_tracking_event(evlist, tracking_evsel); 781 781
+2 -2
tools/perf/builtin-record.c
··· 756 756 if (perf_evlist__add_dummy(evlist)) 757 757 return -ENOMEM; 758 758 759 - pos = perf_evlist__first(evlist); 759 + pos = evlist__first(evlist); 760 760 pos->tracking = 0; 761 - pos = perf_evlist__last(evlist); 761 + pos = evlist__last(evlist); 762 762 pos->tracking = 1; 763 763 pos->core.attr.enable_on_exec = 1; 764 764 }
+1 -1
tools/perf/builtin-script.c
··· 2043 2043 return err; 2044 2044 2045 2045 evlist = *pevlist; 2046 - evsel = perf_evlist__last(*pevlist); 2046 + evsel = evlist__last(*pevlist); 2047 2047 2048 2048 if (!evsel->priv) { 2049 2049 if (scr->per_event_dump) {
+5 -5
tools/perf/builtin-top.c
··· 531 531 prompt_integer(&counter, "Enter details event counter"); 532 532 533 533 if (counter >= top->evlist->core.nr_entries) { 534 - top->sym_evsel = perf_evlist__first(top->evlist); 534 + top->sym_evsel = evlist__first(top->evlist); 535 535 fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel)); 536 536 sleep(1); 537 537 break; ··· 540 540 if (top->sym_evsel->idx == counter) 541 541 break; 542 542 } else 543 - top->sym_evsel = perf_evlist__first(top->evlist); 543 + top->sym_evsel = evlist__first(top->evlist); 544 544 break; 545 545 case 'f': 546 546 prompt_integer(&top->count_filter, "Enter display event count filter"); ··· 962 962 /* has term for current event */ 963 963 if ((overwrite < 0) && (set >= 0)) { 964 964 /* if it's first event, set overwrite */ 965 - if (evsel == perf_evlist__first(evlist)) 965 + if (evsel == evlist__first(evlist)) 966 966 overwrite = set; 967 967 else 968 968 return -1; ··· 986 986 return 0; 987 987 988 988 /* only fall back when first event fails */ 989 - if (evsel != perf_evlist__first(evlist)) 989 + if (evsel != evlist__first(evlist)) 990 990 return 0; 991 991 992 992 evlist__for_each_entry(evlist, counter) ··· 1644 1644 goto out_delete_evlist; 1645 1645 } 1646 1646 1647 - top.sym_evsel = perf_evlist__first(top.evlist); 1647 + top.sym_evsel = evlist__first(top.evlist); 1648 1648 1649 1649 if (!callchain_param.enabled) { 1650 1650 symbol_conf.cumulate_callchain = false;
+1 -1
tools/perf/builtin-trace.c
··· 3427 3427 3428 3428 trace->multiple_threads = perf_thread_map__pid(evlist->core.threads, 0) == -1 || 3429 3429 evlist->core.threads->nr > 1 || 3430 - perf_evlist__first(evlist)->core.attr.inherit; 3430 + evlist__first(evlist)->core.attr.inherit; 3431 3431 3432 3432 /* 3433 3433 * Now that we already used evsel->core.attr to ask the kernel to setup the
+11
tools/perf/lib/include/internal/evlist.h
··· 4 4 5 5 #include <linux/list.h> 6 6 #include <api/fd/array.h> 7 + #include <internal/evsel.h> 7 8 8 9 #define PERF_EVLIST__HLIST_BITS 8 9 10 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) ··· 55 54 */ 56 55 #define perf_evlist__for_each_entry_reverse(evlist, evsel) \ 57 56 __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel) 57 + 58 + static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) 59 + { 60 + return list_entry(evlist->entries.next, struct perf_evsel, node); 61 + } 62 + 63 + static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) 64 + { 65 + return list_entry(evlist->entries.prev, struct perf_evsel, node); 66 + } 58 67 59 68 #endif /* __LIBPERF_INTERNAL_EVLIST_H */
+1 -1
tools/perf/tests/code-reading.c
··· 652 652 653 653 perf_evlist__config(evlist, &opts, NULL); 654 654 655 - evsel = perf_evlist__first(evlist); 655 + evsel = evlist__first(evlist); 656 656 657 657 evsel->core.attr.comm = 1; 658 658 evsel->core.attr.disabled = 1;
+7 -7
tools/perf/tests/event-times.c
··· 16 16 17 17 static int attach__enable_on_exec(struct evlist *evlist) 18 18 { 19 - struct evsel *evsel = perf_evlist__last(evlist); 19 + struct evsel *evsel = evlist__last(evlist); 20 20 struct target target = { 21 21 .uid = UINT_MAX, 22 22 }; ··· 58 58 59 59 static int attach__current_disabled(struct evlist *evlist) 60 60 { 61 - struct evsel *evsel = perf_evlist__last(evlist); 61 + struct evsel *evsel = evlist__last(evlist); 62 62 struct perf_thread_map *threads; 63 63 int err; 64 64 ··· 84 84 85 85 static int attach__current_enabled(struct evlist *evlist) 86 86 { 87 - struct evsel *evsel = perf_evlist__last(evlist); 87 + struct evsel *evsel = evlist__last(evlist); 88 88 struct perf_thread_map *threads; 89 89 int err; 90 90 ··· 104 104 105 105 static int detach__disable(struct evlist *evlist) 106 106 { 107 - struct evsel *evsel = perf_evlist__last(evlist); 107 + struct evsel *evsel = evlist__last(evlist); 108 108 109 109 return evsel__enable(evsel); 110 110 } 111 111 112 112 static int attach__cpu_disabled(struct evlist *evlist) 113 113 { 114 - struct evsel *evsel = perf_evlist__last(evlist); 114 + struct evsel *evsel = evlist__last(evlist); 115 115 struct perf_cpu_map *cpus; 116 116 int err; 117 117 ··· 140 140 141 141 static int attach__cpu_enabled(struct evlist *evlist) 142 142 { 143 - struct evsel *evsel = perf_evlist__last(evlist); 143 + struct evsel *evsel = evlist__last(evlist); 144 144 struct perf_cpu_map *cpus; 145 145 int err; 146 146 ··· 180 180 goto out_err; 181 181 } 182 182 183 - evsel = perf_evlist__last(evlist); 183 + evsel = evlist__last(evlist); 184 184 evsel->core.attr.read_format |= 185 185 PERF_FORMAT_TOTAL_TIME_ENABLED | 186 186 PERF_FORMAT_TOTAL_TIME_RUNNING;
+1 -1
tools/perf/tests/event_update.c
··· 92 92 evlist = perf_evlist__new_default(); 93 93 TEST_ASSERT_VAL("failed to get evlist", evlist); 94 94 95 - evsel = perf_evlist__first(evlist); 95 + evsel = evlist__first(evlist); 96 96 97 97 TEST_ASSERT_VAL("failed to allocate ids", 98 98 !perf_evsel__alloc_id(&evsel->core, 1, 1));
+1 -1
tools/perf/tests/evsel-roundtrip-name.c
··· 34 34 } 35 35 36 36 idx = 0; 37 - evsel = perf_evlist__first(evlist); 37 + evsel = evlist__first(evlist); 38 38 39 39 for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { 40 40 for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
+1 -1
tools/perf/tests/hists_cumulate.c
··· 721 721 if (verbose > 1) 722 722 machine__fprintf(machine, stderr); 723 723 724 - evsel = perf_evlist__first(evlist); 724 + evsel = evlist__first(evlist); 725 725 726 726 for (i = 0; i < ARRAY_SIZE(testcases); i++) { 727 727 err = testcases[i](evsel, machine);
+2 -2
tools/perf/tests/hists_link.c
··· 311 311 print_hists_in(hists); 312 312 } 313 313 314 - first = perf_evlist__first(evlist); 315 - evsel = perf_evlist__last(evlist); 314 + first = evlist__first(evlist); 315 + evsel = evlist__last(evlist); 316 316 317 317 first_hists = evsel__hists(first); 318 318 hists = evsel__hists(evsel);
+1 -1
tools/perf/tests/hists_output.c
··· 608 608 if (verbose > 1) 609 609 machine__fprintf(machine, stderr); 610 610 611 - evsel = perf_evlist__first(evlist); 611 + evsel = evlist__first(evlist); 612 612 613 613 for (i = 0; i < ARRAY_SIZE(testcases); i++) { 614 614 err = testcases[i](evsel, machine);
+2 -2
tools/perf/tests/keep-tracking.c
··· 93 93 94 94 perf_evlist__config(evlist, &opts, NULL); 95 95 96 - evsel = perf_evlist__first(evlist); 96 + evsel = evlist__first(evlist); 97 97 98 98 evsel->core.attr.comm = 1; 99 99 evsel->core.attr.disabled = 1; ··· 132 132 133 133 evlist__enable(evlist); 134 134 135 - evsel = perf_evlist__last(evlist); 135 + evsel = evlist__last(evlist); 136 136 137 137 CHECK__(evsel__disable(evsel)); 138 138
+58 -58
tools/perf/tests/parse-events.c
··· 46 46 47 47 static int test__checkevent_tracepoint(struct evlist *evlist) 48 48 { 49 - struct evsel *evsel = perf_evlist__first(evlist); 49 + struct evsel *evsel = evlist__first(evlist); 50 50 51 51 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 52 52 TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); ··· 77 77 78 78 static int test__checkevent_raw(struct evlist *evlist) 79 79 { 80 - struct evsel *evsel = perf_evlist__first(evlist); 80 + struct evsel *evsel = evlist__first(evlist); 81 81 82 82 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 83 83 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); ··· 87 87 88 88 static int test__checkevent_numeric(struct evlist *evlist) 89 89 { 90 - struct evsel *evsel = perf_evlist__first(evlist); 90 + struct evsel *evsel = evlist__first(evlist); 91 91 92 92 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 93 93 TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type); ··· 97 97 98 98 static int test__checkevent_symbolic_name(struct evlist *evlist) 99 99 { 100 - struct evsel *evsel = perf_evlist__first(evlist); 100 + struct evsel *evsel = evlist__first(evlist); 101 101 102 102 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 103 103 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); ··· 108 108 109 109 static int test__checkevent_symbolic_name_config(struct evlist *evlist) 110 110 { 111 - struct evsel *evsel = perf_evlist__first(evlist); 111 + struct evsel *evsel = evlist__first(evlist); 112 112 113 113 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 114 114 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); ··· 129 129 130 130 static int test__checkevent_symbolic_alias(struct evlist *evlist) 131 131 { 132 - struct evsel *evsel = perf_evlist__first(evlist); 132 + struct evsel *evsel = evlist__first(evlist); 133 133 134 134 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 135 135 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); ··· 140 140 141 141 static int test__checkevent_genhw(struct evlist *evlist) 142 142 { 143 - struct evsel *evsel = perf_evlist__first(evlist); 143 + struct evsel *evsel = evlist__first(evlist); 144 144 145 145 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 146 146 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type); ··· 150 150 151 151 static int test__checkevent_breakpoint(struct evlist *evlist) 152 152 { 153 - struct evsel *evsel = perf_evlist__first(evlist); 153 + struct evsel *evsel = evlist__first(evlist); 154 154 155 155 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 156 156 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); ··· 164 164 165 165 static int test__checkevent_breakpoint_x(struct evlist *evlist) 166 166 { 167 - struct evsel *evsel = perf_evlist__first(evlist); 167 + struct evsel *evsel = evlist__first(evlist); 168 168 169 169 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 170 170 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); ··· 177 177 178 178 static int test__checkevent_breakpoint_r(struct evlist *evlist) 179 179 { 180 - struct evsel *evsel = perf_evlist__first(evlist); 180 + struct evsel *evsel = evlist__first(evlist); 181 181 182 182 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 183 183 TEST_ASSERT_VAL("wrong type", ··· 192 192 193 193 static int test__checkevent_breakpoint_w(struct evlist *evlist) 194 194 { 195 - struct evsel *evsel = perf_evlist__first(evlist); 195 + struct evsel *evsel = evlist__first(evlist); 196 196 197 197 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 198 198 TEST_ASSERT_VAL("wrong type", ··· 207 207 208 208 static int test__checkevent_breakpoint_rw(struct evlist *evlist) 209 209 { 210 - struct evsel *evsel = perf_evlist__first(evlist); 210 + struct evsel *evsel = evlist__first(evlist); 211 211 212 212 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 213 213 TEST_ASSERT_VAL("wrong type", ··· 222 222 223 223 static int test__checkevent_tracepoint_modifier(struct evlist *evlist) 224 224 { 225 - struct evsel *evsel = perf_evlist__first(evlist); 225 + struct evsel *evsel = evlist__first(evlist); 226 226 227 227 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 228 228 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); ··· 253 253 254 254 static int test__checkevent_raw_modifier(struct evlist *evlist) 255 255 { 256 - struct evsel *evsel = perf_evlist__first(evlist); 256 + struct evsel *evsel = evlist__first(evlist); 257 257 258 258 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 259 259 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); ··· 265 265 266 266 static int test__checkevent_numeric_modifier(struct evlist *evlist) 267 267 { 268 - struct evsel *evsel = perf_evlist__first(evlist); 268 + struct evsel *evsel = evlist__first(evlist); 269 269 270 270 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 271 271 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 277 277 278 278 static int test__checkevent_symbolic_name_modifier(struct evlist *evlist) 279 279 { 280 - struct evsel *evsel = perf_evlist__first(evlist); 280 + struct evsel *evsel = evlist__first(evlist); 281 281 282 282 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 283 283 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 289 289 290 290 static int test__checkevent_exclude_host_modifier(struct evlist *evlist) 291 291 { 292 - struct evsel *evsel = perf_evlist__first(evlist); 292 + struct evsel *evsel = evlist__first(evlist); 293 293 294 294 TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); 295 295 TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); ··· 299 299 300 300 static int test__checkevent_exclude_guest_modifier(struct evlist *evlist) 301 301 { 302 - struct evsel *evsel = perf_evlist__first(evlist); 302 + struct evsel *evsel = evlist__first(evlist); 303 303 304 304 TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); 305 305 TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); ··· 309 309 310 310 static int test__checkevent_symbolic_alias_modifier(struct evlist *evlist) 311 311 { 312 - struct evsel *evsel = perf_evlist__first(evlist); 312 + struct evsel *evsel = evlist__first(evlist); 313 313 314 314 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 315 315 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 321 321 322 322 static int test__checkevent_genhw_modifier(struct evlist *evlist) 323 323 { 324 - struct evsel *evsel = perf_evlist__first(evlist); 324 + struct evsel *evsel = evlist__first(evlist); 325 325 326 326 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 327 327 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); ··· 333 333 334 334 static int test__checkevent_exclude_idle_modifier(struct evlist *evlist) 335 335 { 336 - struct evsel *evsel = perf_evlist__first(evlist); 336 + struct evsel *evsel = evlist__first(evlist); 337 337 338 338 TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); 339 339 TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); ··· 348 348 349 349 static int test__checkevent_exclude_idle_modifier_1(struct evlist *evlist) 350 350 { 351 - struct evsel *evsel = perf_evlist__first(evlist); 351 + struct evsel *evsel = evlist__first(evlist); 352 352 353 353 TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); 354 354 TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); ··· 363 363 364 364 static int test__checkevent_breakpoint_modifier(struct evlist *evlist) 365 365 { 366 - struct evsel *evsel = perf_evlist__first(evlist); 366 + struct evsel *evsel = evlist__first(evlist); 367 367 368 368 369 369 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); ··· 378 378 379 379 static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist) 380 380 { 381 - struct evsel *evsel = perf_evlist__first(evlist); 381 + struct evsel *evsel = evlist__first(evlist); 382 382 383 383 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 384 384 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); ··· 392 392 393 393 static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist) 394 394 { 395 - struct evsel *evsel = perf_evlist__first(evlist); 395 + struct evsel *evsel = evlist__first(evlist); 396 396 397 397 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 398 398 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 406 406 407 407 static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist) 408 408 { 409 - struct evsel *evsel = perf_evlist__first(evlist); 409 + struct evsel *evsel = evlist__first(evlist); 410 410 411 411 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 412 412 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 420 420 421 421 static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist) 422 422 { 423 - struct evsel *evsel = perf_evlist__first(evlist); 423 + struct evsel *evsel = evlist__first(evlist); 424 424 425 425 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); 426 426 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); ··· 435 435 static int test__checkevent_pmu(struct evlist *evlist) 436 436 { 437 437 438 - struct evsel *evsel = perf_evlist__first(evlist); 438 + struct evsel *evsel = evlist__first(evlist); 439 439 440 440 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 441 441 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); ··· 453 453 454 454 static int test__checkevent_list(struct evlist *evlist) 455 455 { 456 - struct evsel *evsel = perf_evlist__first(evlist); 456 + struct evsel *evsel = evlist__first(evlist); 457 457 458 458 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); 459 459 ··· 492 492 493 493 static int test__checkevent_pmu_name(struct evlist *evlist) 494 494 { 495 - struct evsel *evsel = perf_evlist__first(evlist); 495 + struct evsel *evsel = evlist__first(evlist); 496 496 497 497 /* cpu/config=1,name=krava/u */ 498 498 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); ··· 513 513 514 514 static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist) 515 515 { 516 - struct evsel *evsel = perf_evlist__first(evlist); 516 + struct evsel *evsel = evlist__first(evlist); 517 517 518 518 /* cpu/config=1,call-graph=fp,time,period=100000/ */ 519 519 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); ··· 546 546 547 547 static int test__checkevent_pmu_events(struct evlist *evlist) 548 548 { 549 - struct evsel *evsel = perf_evlist__first(evlist); 549 + struct evsel *evsel = evlist__first(evlist); 550 550 551 551 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 552 552 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); ··· 564 564 565 565 static int test__checkevent_pmu_events_mix(struct evlist *evlist) 566 566 { 567 - struct evsel *evsel = perf_evlist__first(evlist); 567 + struct evsel *evsel = evlist__first(evlist); 568 568 569 569 /* pmu-event:u */ 570 570 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); ··· 642 642 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 643 643 644 644 /* instructions:k */ 645 - evsel = leader = perf_evlist__first(evlist); 645 + evsel = leader = evlist__first(evlist); 646 646 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 647 647 TEST_ASSERT_VAL("wrong config", 648 648 PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); ··· 684 684 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 685 685 686 686 /* faults + :ku modifier */ 687 - evsel = leader = perf_evlist__first(evlist); 687 + evsel = leader = evlist__first(evlist); 688 688 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); 689 689 TEST_ASSERT_VAL("wrong config", 690 690 PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config); ··· 739 739 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); 740 740 741 741 /* group1 syscalls:sys_enter_openat:H */ 742 - evsel = leader = perf_evlist__first(evlist); 742 + evsel = leader = evlist__first(evlist); 743 743 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type); 744 744 TEST_ASSERT_VAL("wrong sample_type", 745 745 PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type); ··· 831 831 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 832 832 833 833 /* cycles:u + p */ 834 - evsel = leader = perf_evlist__first(evlist); 834 + evsel = leader = evlist__first(evlist); 835 835 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 836 836 TEST_ASSERT_VAL("wrong config", 837 837 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 875 875 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); 876 876 877 877 /* cycles + G */ 878 - evsel = leader = perf_evlist__first(evlist); 878 + evsel = leader = evlist__first(evlist); 879 879 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 880 880 TEST_ASSERT_VAL("wrong config", 881 881 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 961 961 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 962 962 963 963 /* cycles + :H group modifier */ 964 - evsel = leader = perf_evlist__first(evlist); 964 + evsel = leader = evlist__first(evlist); 965 965 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 966 966 TEST_ASSERT_VAL("wrong config", 967 967 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1001 1001 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1002 1002 1003 1003 /* cycles + :G group modifier */ 1004 - evsel = leader = perf_evlist__first(evlist); 1004 + evsel = leader = evlist__first(evlist); 1005 1005 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1006 1006 TEST_ASSERT_VAL("wrong config", 1007 1007 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1041 1041 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1042 1042 1043 1043 /* cycles:G + :u group modifier */ 1044 - evsel = leader = perf_evlist__first(evlist); 1044 + evsel = leader = evlist__first(evlist); 1045 1045 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1046 1046 TEST_ASSERT_VAL("wrong config", 1047 1047 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1081 1081 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1082 1082 1083 1083 /* cycles:G + :uG group modifier */ 1084 - evsel = leader = perf_evlist__first(evlist); 1084 + evsel = leader = evlist__first(evlist); 1085 1085 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1086 1086 TEST_ASSERT_VAL("wrong config", 1087 1087 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1120 1120 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); 1121 1121 1122 1122 /* cycles - sampling group leader */ 1123 - evsel = leader = perf_evlist__first(evlist); 1123 + evsel = leader = evlist__first(evlist); 1124 1124 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1125 1125 TEST_ASSERT_VAL("wrong config", 1126 1126 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1173 1173 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); 1174 1174 1175 1175 /* instructions - sampling group leader */ 1176 - evsel = leader = perf_evlist__first(evlist); 1176 + evsel = leader = evlist__first(evlist); 1177 1177 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1178 1178 TEST_ASSERT_VAL("wrong config", 1179 1179 PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); ··· 1207 1207 1208 1208 static int test__checkevent_pinned_modifier(struct evlist *evlist) 1209 1209 { 1210 - struct evsel *evsel = perf_evlist__first(evlist); 1210 + struct evsel *evsel = evlist__first(evlist); 1211 1211 1212 1212 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 1213 1213 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 1225 1225 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); 1226 1226 1227 1227 /* cycles - group leader */ 1228 - evsel = leader = perf_evlist__first(evlist); 1228 + evsel = leader = evlist__first(evlist); 1229 1229 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); 1230 1230 TEST_ASSERT_VAL("wrong config", 1231 1231 PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); ··· 1251 1251 1252 1252 static int test__checkevent_breakpoint_len(struct evlist *evlist) 1253 1253 { 1254 - struct evsel *evsel = perf_evlist__first(evlist); 1254 + struct evsel *evsel = evlist__first(evlist); 1255 1255 1256 1256 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 1257 1257 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); ··· 1266 1266 1267 1267 static int test__checkevent_breakpoint_len_w(struct evlist *evlist) 1268 1268 { 1269 - struct evsel *evsel = perf_evlist__first(evlist); 1269 + struct evsel *evsel = evlist__first(evlist); 1270 1270 1271 1271 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); 1272 1272 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); ··· 1282 1282 static int 1283 1283 test__checkevent_breakpoint_len_rw_modifier(struct evlist *evlist) 1284 1284 { 1285 - struct evsel *evsel = perf_evlist__first(evlist); 1285 + struct evsel *evsel = evlist__first(evlist); 1286 1286 1287 1287 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 1288 1288 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); ··· 1294 1294 1295 1295 static int test__checkevent_precise_max_modifier(struct evlist *evlist) 1296 1296 { 1297 - struct evsel *evsel = perf_evlist__first(evlist); 1297 + struct evsel *evsel = evlist__first(evlist); 1298 1298 1299 1299 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); 1300 1300 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); ··· 1305 1305 1306 1306 static int test__checkevent_config_symbol(struct evlist *evlist) 1307 1307 { 1308 - struct evsel *evsel = perf_evlist__first(evlist); 1308 + struct evsel *evsel = evlist__first(evlist); 1309 1309 1310 1310 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0); 1311 1311 return 0; ··· 1313 1313 1314 1314 static int test__checkevent_config_raw(struct evlist *evlist) 1315 1315 { 1316 - struct evsel *evsel = perf_evlist__first(evlist); 1316 + struct evsel *evsel = evlist__first(evlist); 1317 1317 1318 1318 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0); 1319 1319 return 0; ··· 1321 1321 1322 1322 static int test__checkevent_config_num(struct evlist *evlist) 1323 1323 { 1324 - struct evsel *evsel = perf_evlist__first(evlist); 1324 + struct evsel *evsel = evlist__first(evlist); 1325 1325 1326 1326 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0); 1327 1327 return 0; ··· 1329 1329 1330 1330 static int test__checkevent_config_cache(struct evlist *evlist) 1331 1331 { 1332 - struct evsel *evsel = perf_evlist__first(evlist); 1332 + struct evsel *evsel = evlist__first(evlist); 1333 1333 1334 1334 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0); 1335 1335 return 0; ··· 1342 1342 1343 1343 static int test__intel_pt(struct evlist *evlist) 1344 1344 { 1345 - struct evsel *evsel = perf_evlist__first(evlist); 1345 + struct evsel *evsel = evlist__first(evlist); 1346 1346 1347 1347 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0); 1348 1348 return 0; ··· 1350 1350 1351 1351 static int test__checkevent_complex_name(struct evlist *evlist) 1352 1352 { 1353 - struct evsel *evsel = perf_evlist__first(evlist); 1353 + struct evsel *evsel = evlist__first(evlist); 1354 1354 1355 1355 TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0); 1356 1356 return 0; ··· 1358 1358 1359 1359 static int test__sym_event_slash(struct evlist *evlist) 1360 1360 { 1361 - struct evsel *evsel = perf_evlist__first(evlist); 1361 + struct evsel *evsel = evlist__first(evlist); 1362 1362 1363 1363 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); 1364 1364 TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES); ··· 1368 1368 1369 1369 static int test__sym_event_dc(struct evlist *evlist) 1370 1370 { 1371 - struct evsel *evsel = perf_evlist__first(evlist); 1371 + struct evsel *evsel = evlist__first(evlist); 1372 1372 1373 1373 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); 1374 1374 TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
+1 -1
tools/perf/tests/perf-record.c
··· 104 104 /* 105 105 * Config the evsels, setting attr->comm on the first one, etc. 106 106 */ 107 - evsel = perf_evlist__first(evlist); 107 + evsel = evlist__first(evlist); 108 108 perf_evsel__set_sample_bit(evsel, CPU); 109 109 perf_evsel__set_sample_bit(evsel, TID); 110 110 perf_evsel__set_sample_bit(evsel, TIME);
+7 -7
tools/perf/tests/switch-tracking.c
··· 367 367 goto out_err; 368 368 } 369 369 370 - cpu_clocks_evsel = perf_evlist__last(evlist); 370 + cpu_clocks_evsel = evlist__last(evlist); 371 371 372 372 /* Second event */ 373 373 err = parse_events(evlist, "cycles:u", NULL); ··· 376 376 goto out_err; 377 377 } 378 378 379 - cycles_evsel = perf_evlist__last(evlist); 379 + cycles_evsel = evlist__last(evlist); 380 380 381 381 /* Third event */ 382 382 if (!perf_evlist__can_select_event(evlist, sched_switch)) { ··· 391 391 goto out_err; 392 392 } 393 393 394 - switch_evsel = perf_evlist__last(evlist); 394 + switch_evsel = evlist__last(evlist); 395 395 396 396 perf_evsel__set_sample_bit(switch_evsel, CPU); 397 397 perf_evsel__set_sample_bit(switch_evsel, TIME); ··· 401 401 switch_evsel->immediate = true; 402 402 403 403 /* Test moving an event to the front */ 404 - if (cycles_evsel == perf_evlist__first(evlist)) { 404 + if (cycles_evsel == evlist__first(evlist)) { 405 405 pr_debug("cycles event already at front"); 406 406 goto out_err; 407 407 } 408 408 perf_evlist__to_front(evlist, cycles_evsel); 409 - if (cycles_evsel != perf_evlist__first(evlist)) { 409 + if (cycles_evsel != evlist__first(evlist)) { 410 410 pr_debug("Failed to move cycles event to front"); 411 411 goto out_err; 412 412 } ··· 421 421 goto out_err; 422 422 } 423 423 424 - tracking_evsel = perf_evlist__last(evlist); 424 + tracking_evsel = evlist__last(evlist); 425 425 426 426 perf_evlist__set_tracking_event(evlist, tracking_evsel); 427 427 ··· 434 434 perf_evlist__config(evlist, &opts, NULL); 435 435 436 436 /* Check moved event is still at the front */ 437 - if (cycles_evsel != perf_evlist__first(evlist)) { 437 + if (cycles_evsel != evlist__first(evlist)) { 438 438 pr_debug("Front event no longer at front"); 439 439 goto out_err; 440 440 }
+1 -1
tools/perf/tests/task-exit.c
··· 88 88 goto out_delete_evlist; 89 89 } 90 90 91 - evsel = perf_evlist__first(evlist); 91 + evsel = evlist__first(evlist); 92 92 evsel->core.attr.task = 1; 93 93 #ifdef __s390x__ 94 94 evsel->core.attr.sample_freq = 1000000;
+3 -3
tools/perf/ui/browsers/hists.c
··· 3319 3319 switch (key) { 3320 3320 case K_TAB: 3321 3321 if (pos->core.node.next == &evlist->core.entries) 3322 - pos = perf_evlist__first(evlist); 3322 + pos = evlist__first(evlist); 3323 3323 else 3324 3324 pos = perf_evsel__next(pos); 3325 3325 goto browse_hists; 3326 3326 case K_UNTAB: 3327 3327 if (pos->core.node.prev == &evlist->core.entries) 3328 - pos = perf_evlist__last(evlist); 3328 + pos = evlist__last(evlist); 3329 3329 else 3330 3330 pos = perf_evsel__prev(pos); 3331 3331 goto browse_hists; ··· 3417 3417 3418 3418 single_entry: 3419 3419 if (nr_entries == 1) { 3420 - struct evsel *first = perf_evlist__first(evlist); 3420 + struct evsel *first = evlist__first(evlist); 3421 3421 3422 3422 return perf_evsel__hists_browse(first, nr_entries, help, 3423 3423 false, hbt, min_pcnt,
+1 -1
tools/perf/util/bpf-loader.c
··· 1568 1568 return ERR_PTR(-err); 1569 1569 } 1570 1570 1571 - evsel = perf_evlist__last(evlist); 1571 + evsel = evlist__last(evlist); 1572 1572 } 1573 1573 1574 1574 bpf__for_each_map_named(map, obj, tmp, name) {
+12 -12
tools/perf/util/evlist.c
··· 105 105 */ 106 106 void perf_evlist__set_id_pos(struct evlist *evlist) 107 107 { 108 - struct evsel *first = perf_evlist__first(evlist); 108 + struct evsel *first = evlist__first(evlist); 109 109 110 110 evlist->id_pos = first->id_pos; 111 111 evlist->is_pos = first->is_pos; ··· 559 559 struct perf_sample_id *sid; 560 560 561 561 if (evlist->core.nr_entries == 1 || !id) 562 - return perf_evlist__first(evlist); 562 + return evlist__first(evlist); 563 563 564 564 sid = perf_evlist__id2sid(evlist, id); 565 565 if (sid) 566 566 return container_of(sid->evsel, struct evsel, core); 567 567 568 568 if (!perf_evlist__sample_id_all(evlist)) 569 - return perf_evlist__first(evlist); 569 + return evlist__first(evlist); 570 570 571 571 return NULL; 572 572 } ··· 610 610 struct evsel *perf_evlist__event2evsel(struct evlist *evlist, 611 611 union perf_event *event) 612 612 { 613 - struct evsel *first = perf_evlist__first(evlist); 613 + struct evsel *first = evlist__first(evlist); 614 614 struct hlist_head *head; 615 615 struct perf_sample_id *sid; 616 616 int hash; ··· 1222 1222 1223 1223 bool perf_evlist__valid_read_format(struct evlist *evlist) 1224 1224 { 1225 - struct evsel *first = perf_evlist__first(evlist), *pos = first; 1225 + struct evsel *first = evlist__first(evlist), *pos = first; 1226 1226 u64 read_format = first->core.attr.read_format; 1227 1227 u64 sample_type = first->core.attr.sample_type; 1228 1228 ··· 1242 1242 1243 1243 u64 perf_evlist__read_format(struct evlist *evlist) 1244 1244 { 1245 - struct evsel *first = perf_evlist__first(evlist); 1245 + struct evsel *first = evlist__first(evlist); 1246 1246 return first->core.attr.read_format; 1247 1247 } 1248 1248 1249 1249 u16 perf_evlist__id_hdr_size(struct evlist *evlist) 1250 1250 { 1251 - struct evsel *first = perf_evlist__first(evlist); 1251 + struct evsel *first = evlist__first(evlist); 1252 1252 struct perf_sample *data; 1253 1253 u64 sample_type; 1254 1254 u16 size = 0; ··· 1281 1281 1282 1282 bool perf_evlist__valid_sample_id_all(struct evlist *evlist) 1283 1283 { 1284 - struct evsel *first = perf_evlist__first(evlist), *pos = first; 1284 + struct evsel *first = evlist__first(evlist), *pos = first; 1285 1285 1286 1286 evlist__for_each_entry_continue(evlist, pos) { 1287 1287 if (first->core.attr.sample_id_all != pos->core.attr.sample_id_all) ··· 1293 1293 1294 1294 bool perf_evlist__sample_id_all(struct evlist *evlist) 1295 1295 { 1296 - struct evsel *first = perf_evlist__first(evlist); 1296 + struct evsel *first = evlist__first(evlist); 1297 1297 return first->core.attr.sample_id_all; 1298 1298 } 1299 1299 ··· 1568 1568 "Hint:\tThe current value is %d.", value); 1569 1569 break; 1570 1570 case EINVAL: { 1571 - struct evsel *first = perf_evlist__first(evlist); 1571 + struct evsel *first = evlist__first(evlist); 1572 1572 int max_freq; 1573 1573 1574 1574 if (sysctl__read_int("kernel/perf_event_max_sample_rate", &max_freq) < 0) ··· 1630 1630 struct evsel *evsel, *n; 1631 1631 LIST_HEAD(move); 1632 1632 1633 - if (move_evsel == perf_evlist__first(evlist)) 1633 + if (move_evsel == evlist__first(evlist)) 1634 1634 return; 1635 1635 1636 1636 evlist__for_each_entry_safe(evlist, n, evsel) { ··· 1751 1751 void perf_evlist__force_leader(struct evlist *evlist) 1752 1752 { 1753 1753 if (!evlist->nr_groups) { 1754 - struct evsel *leader = perf_evlist__first(evlist); 1754 + struct evsel *leader = evlist__first(evlist); 1755 1755 1756 1756 perf_evlist__set_leader(evlist); 1757 1757 leader->forced_leader = true;
+9 -4
tools/perf/util/evlist.h
··· 9 9 #include <api/fd/array.h> 10 10 #include <stdio.h> 11 11 #include <internal/evlist.h> 12 + #include <internal/evsel.h> 12 13 #include "events_stats.h" 13 14 #include "evsel.h" 14 15 #include <pthread.h> ··· 243 242 return list_empty(&evlist->core.entries); 244 243 } 245 244 246 - static inline struct evsel *perf_evlist__first(struct evlist *evlist) 245 + static inline struct evsel *evlist__first(struct evlist *evlist) 247 246 { 248 - return list_entry(evlist->core.entries.next, struct evsel, core.node); 247 + struct perf_evsel *evsel = perf_evlist__first(&evlist->core); 248 + 249 + return container_of(evsel, struct evsel, core); 249 250 } 250 251 251 - static inline struct evsel *perf_evlist__last(struct evlist *evlist) 252 + static inline struct evsel *evlist__last(struct evlist *evlist) 252 253 { 253 - return list_entry(evlist->core.entries.prev, struct evsel, core.node); 254 + struct perf_evsel *evsel = perf_evlist__last(&evlist->core); 255 + 256 + return container_of(evsel, struct evsel, core); 254 257 } 255 258 256 259 size_t perf_evlist__fprintf(struct evlist *evlist, FILE *fp);
+1 -1
tools/perf/util/jitdump.c
··· 777 777 * track sample_type to compute id_all layout 778 778 * perf sets the same sample type to all events as of now 779 779 */ 780 - first = perf_evlist__first(session->evlist); 780 + first = evlist__first(session->evlist); 781 781 jd.sample_type = first->core.attr.sample_type; 782 782 783 783 *nbytes = 0;
+2 -2
tools/perf/util/parse-events.c
··· 1936 1936 1937 1937 perf_evlist__splice_list_tail(evlist, &parse_state.list); 1938 1938 evlist->nr_groups += parse_state.nr_groups; 1939 - last = perf_evlist__last(evlist); 1939 + last = evlist__last(evlist); 1940 1940 last->cmdline_group_boundary = true; 1941 1941 1942 1942 return 0; ··· 2050 2050 * So no need to WARN here, let *func do this. 2051 2051 */ 2052 2052 if (evlist->core.nr_entries > 0) 2053 - last = perf_evlist__last(evlist); 2053 + last = evlist__last(evlist); 2054 2054 2055 2055 do { 2056 2056 err = (*func)(last, arg);
+3 -3
tools/perf/util/record.c
··· 30 30 if (parse_events(evlist, str, NULL)) 31 31 goto out_delete; 32 32 33 - evsel = perf_evlist__first(evlist); 33 + evsel = evlist__first(evlist); 34 34 35 35 while (1) { 36 36 fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, flags); ··· 171 171 use_sample_identifier = perf_can_sample_identifier(); 172 172 sample_id = true; 173 173 } else if (evlist->core.nr_entries > 1) { 174 - struct evsel *first = perf_evlist__first(evlist); 174 + struct evsel *first = evlist__first(evlist); 175 175 176 176 evlist__for_each_entry(evlist, evsel) { 177 177 if (evsel->core.attr.sample_type == first->core.attr.sample_type) ··· 276 276 if (err) 277 277 goto out_delete; 278 278 279 - evsel = perf_evlist__last(temp_evlist); 279 + evsel = evlist__last(temp_evlist); 280 280 281 281 if (!evlist || perf_cpu_map__empty(evlist->core.cpus)) { 282 282 struct perf_cpu_map *cpus = perf_cpu_map__new(NULL);
+1 -1
tools/perf/util/sort.c
··· 2329 2329 if (nr > evlist->core.nr_entries) 2330 2330 return NULL; 2331 2331 2332 - evsel = perf_evlist__first(evlist); 2332 + evsel = evlist__first(evlist); 2333 2333 while (--nr > 0) 2334 2334 evsel = perf_evsel__next(evsel); 2335 2335
+1 -1
tools/perf/util/top.c
··· 71 71 } 72 72 73 73 if (top->evlist->core.nr_entries == 1) { 74 - struct evsel *first = perf_evlist__first(top->evlist); 74 + struct evsel *first = evlist__first(top->evlist); 75 75 ret += SNPRINTF(bf + ret, size - ret, "%" PRIu64 "%s ", 76 76 (uint64_t)first->core.attr.sample_period, 77 77 opts->freq ? "Hz" : "");