diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-09-03 04:39:52 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-25 08:51:48 -0400 |
commit | 515dbe48f6202147fb7c88aac48c43f49db1c793 (patch) | |
tree | a969b05759a298444d639bff15c3d98e4808b728 /tools | |
parent | 70c20369ee95ef8b6887944194cfb74a5a8d1fe3 (diff) |
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>
Diffstat (limited to 'tools')
32 files changed, 145 insertions, 129 deletions
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 051e9066fb38..6654bcfc1224 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c | |||
@@ -416,7 +416,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, | |||
416 | if (err) | 416 | if (err) |
417 | goto out; | 417 | goto out; |
418 | 418 | ||
419 | tracking_evsel = perf_evlist__last(evlist); | 419 | tracking_evsel = evlist__last(evlist); |
420 | perf_evlist__set_tracking_event(evlist, tracking_evsel); | 420 | perf_evlist__set_tracking_event(evlist, tracking_evsel); |
421 | 421 | ||
422 | tracking_evsel->core.attr.freq = 0; | 422 | tracking_evsel->core.attr.freq = 0; |
diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 9302c6566f53..745f2d50ee82 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c | |||
@@ -129,7 +129,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, | |||
129 | if (err) | 129 | if (err) |
130 | return err; | 130 | return err; |
131 | 131 | ||
132 | tracking_evsel = perf_evlist__last(evlist); | 132 | tracking_evsel = evlist__last(evlist); |
133 | perf_evlist__set_tracking_event(evlist, tracking_evsel); | 133 | perf_evlist__set_tracking_event(evlist, tracking_evsel); |
134 | 134 | ||
135 | tracking_evsel->core.attr.freq = 0; | 135 | tracking_evsel->core.attr.freq = 0; |
diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c index 111c0ab2e7b5..0329b9168fae 100644 --- a/tools/perf/arch/x86/tests/intel-cqm.c +++ b/tools/perf/arch/x86/tests/intel-cqm.c | |||
@@ -62,9 +62,9 @@ int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subt | |||
62 | goto out; | 62 | goto out; |
63 | } | 63 | } |
64 | 64 | ||
65 | evsel = perf_evlist__first(evlist); | 65 | evsel = evlist__first(evlist); |
66 | if (!evsel) { | 66 | if (!evsel) { |
67 | pr_debug("perf_evlist__first failed\n"); | 67 | pr_debug("evlist__first failed\n"); |
68 | goto out; | 68 | goto out; |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 10b7acebc0eb..fa947952c16a 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c | |||
@@ -83,7 +83,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe | |||
83 | 83 | ||
84 | perf_evlist__config(evlist, &opts, NULL); | 84 | perf_evlist__config(evlist, &opts, NULL); |
85 | 85 | ||
86 | evsel = perf_evlist__first(evlist); | 86 | evsel = evlist__first(evlist); |
87 | 87 | ||
88 | evsel->core.attr.comm = 1; | 88 | evsel->core.attr.comm = 1; |
89 | evsel->core.attr.disabled = 1; | 89 | evsel->core.attr.disabled = 1; |
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index e81535c8e9c5..e2c7095327db 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c | |||
@@ -231,7 +231,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, | |||
231 | if (err) | 231 | if (err) |
232 | return err; | 232 | return err; |
233 | 233 | ||
234 | tracking_evsel = perf_evlist__last(evlist); | 234 | tracking_evsel = evlist__last(evlist); |
235 | 235 | ||
236 | perf_evlist__set_tracking_event(evlist, tracking_evsel); | 236 | perf_evlist__set_tracking_event(evlist, tracking_evsel); |
237 | 237 | ||
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index 886b3ac60f23..84a65524c418 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c | |||
@@ -417,7 +417,7 @@ static int intel_pt_track_switches(struct evlist *evlist) | |||
417 | return err; | 417 | return err; |
418 | } | 418 | } |
419 | 419 | ||
420 | evsel = perf_evlist__last(evlist); | 420 | evsel = evlist__last(evlist); |
421 | 421 | ||
422 | perf_evsel__set_sample_bit(evsel, CPU); | 422 | perf_evsel__set_sample_bit(evsel, CPU); |
423 | perf_evsel__set_sample_bit(evsel, TIME); | 423 | perf_evsel__set_sample_bit(evsel, TIME); |
@@ -717,7 +717,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, | |||
717 | if (err) | 717 | if (err) |
718 | return err; | 718 | return err; |
719 | 719 | ||
720 | switch_evsel = perf_evlist__last(evlist); | 720 | switch_evsel = evlist__last(evlist); |
721 | 721 | ||
722 | switch_evsel->core.attr.freq = 0; | 722 | switch_evsel->core.attr.freq = 0; |
723 | switch_evsel->core.attr.sample_period = 1; | 723 | switch_evsel->core.attr.sample_period = 1; |
@@ -775,7 +775,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, | |||
775 | if (err) | 775 | if (err) |
776 | return err; | 776 | return err; |
777 | 777 | ||
778 | tracking_evsel = perf_evlist__last(evlist); | 778 | tracking_evsel = evlist__last(evlist); |
779 | 779 | ||
780 | perf_evlist__set_tracking_event(evlist, tracking_evsel); | 780 | perf_evlist__set_tracking_event(evlist, tracking_evsel); |
781 | 781 | ||
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 94997144547d..48600c90cc7e 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -756,9 +756,9 @@ static int record__open(struct record *rec) | |||
756 | if (perf_evlist__add_dummy(evlist)) | 756 | if (perf_evlist__add_dummy(evlist)) |
757 | return -ENOMEM; | 757 | return -ENOMEM; |
758 | 758 | ||
759 | pos = perf_evlist__first(evlist); | 759 | pos = evlist__first(evlist); |
760 | pos->tracking = 0; | 760 | pos->tracking = 0; |
761 | pos = perf_evlist__last(evlist); | 761 | pos = evlist__last(evlist); |
762 | pos->tracking = 1; | 762 | pos->tracking = 1; |
763 | pos->core.attr.enable_on_exec = 1; | 763 | pos->core.attr.enable_on_exec = 1; |
764 | } | 764 | } |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index e7a49e2d7575..22c1d114014c 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -2043,7 +2043,7 @@ static int process_attr(struct perf_tool *tool, union perf_event *event, | |||
2043 | return err; | 2043 | return err; |
2044 | 2044 | ||
2045 | evlist = *pevlist; | 2045 | evlist = *pevlist; |
2046 | evsel = perf_evlist__last(*pevlist); | 2046 | evsel = evlist__last(*pevlist); |
2047 | 2047 | ||
2048 | if (!evsel->priv) { | 2048 | if (!evsel->priv) { |
2049 | if (scr->per_event_dump) { | 2049 | if (scr->per_event_dump) { |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 474b9860cfd4..73bf79053ae3 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -531,7 +531,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c) | |||
531 | prompt_integer(&counter, "Enter details event counter"); | 531 | prompt_integer(&counter, "Enter details event counter"); |
532 | 532 | ||
533 | if (counter >= top->evlist->core.nr_entries) { | 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 | fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel)); | 535 | fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel)); |
536 | sleep(1); | 536 | sleep(1); |
537 | break; | 537 | break; |
@@ -540,7 +540,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c) | |||
540 | if (top->sym_evsel->idx == counter) | 540 | if (top->sym_evsel->idx == counter) |
541 | break; | 541 | break; |
542 | } else | 542 | } else |
543 | top->sym_evsel = perf_evlist__first(top->evlist); | 543 | top->sym_evsel = evlist__first(top->evlist); |
544 | break; | 544 | break; |
545 | case 'f': | 545 | case 'f': |
546 | prompt_integer(&top->count_filter, "Enter display event count filter"); | 546 | prompt_integer(&top->count_filter, "Enter display event count filter"); |
@@ -962,7 +962,7 @@ static int perf_top__overwrite_check(struct perf_top *top) | |||
962 | /* has term for current event */ | 962 | /* has term for current event */ |
963 | if ((overwrite < 0) && (set >= 0)) { | 963 | if ((overwrite < 0) && (set >= 0)) { |
964 | /* if it's first event, set overwrite */ | 964 | /* if it's first event, set overwrite */ |
965 | if (evsel == perf_evlist__first(evlist)) | 965 | if (evsel == evlist__first(evlist)) |
966 | overwrite = set; | 966 | overwrite = set; |
967 | else | 967 | else |
968 | return -1; | 968 | return -1; |
@@ -986,7 +986,7 @@ static int perf_top_overwrite_fallback(struct perf_top *top, | |||
986 | return 0; | 986 | return 0; |
987 | 987 | ||
988 | /* only fall back when first event fails */ | 988 | /* only fall back when first event fails */ |
989 | if (evsel != perf_evlist__first(evlist)) | 989 | if (evsel != evlist__first(evlist)) |
990 | return 0; | 990 | return 0; |
991 | 991 | ||
992 | evlist__for_each_entry(evlist, counter) | 992 | evlist__for_each_entry(evlist, counter) |
@@ -1644,7 +1644,7 @@ int cmd_top(int argc, const char **argv) | |||
1644 | goto out_delete_evlist; | 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 | if (!callchain_param.enabled) { | 1649 | if (!callchain_param.enabled) { |
1650 | symbol_conf.cumulate_callchain = false; | 1650 | symbol_conf.cumulate_callchain = false; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 91c73c7472ba..97667287f573 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -3427,7 +3427,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) | |||
3427 | 3427 | ||
3428 | trace->multiple_threads = perf_thread_map__pid(evlist->core.threads, 0) == -1 || | 3428 | trace->multiple_threads = perf_thread_map__pid(evlist->core.threads, 0) == -1 || |
3429 | evlist->core.threads->nr > 1 || | 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 | * Now that we already used evsel->core.attr to ask the kernel to setup the | 3433 | * Now that we already used evsel->core.attr to ask the kernel to setup the |
diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index c5a06890fd6a..16ae6d6cfb39 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <api/fd/array.h> | 6 | #include <api/fd/array.h> |
7 | #include <internal/evsel.h> | ||
7 | 8 | ||
8 | #define PERF_EVLIST__HLIST_BITS 8 | 9 | #define PERF_EVLIST__HLIST_BITS 8 |
9 | #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) | 10 | #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) |
@@ -55,4 +56,14 @@ struct perf_evlist { | |||
55 | #define perf_evlist__for_each_entry_reverse(evlist, evsel) \ | 56 | #define perf_evlist__for_each_entry_reverse(evlist, evsel) \ |
56 | __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel) | 57 | __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel) |
57 | 58 | ||
59 | static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) | ||
60 | { | ||
61 | return list_entry(evlist->entries.next, struct perf_evsel, node); | ||
62 | } | ||
63 | |||
64 | static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) | ||
65 | { | ||
66 | return list_entry(evlist->entries.prev, struct perf_evsel, node); | ||
67 | } | ||
68 | |||
58 | #endif /* __LIBPERF_INTERNAL_EVLIST_H */ | 69 | #endif /* __LIBPERF_INTERNAL_EVLIST_H */ |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 7dac69a375f9..f5764a3890b9 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -652,7 +652,7 @@ static int do_test_code_reading(bool try_kcore) | |||
652 | 652 | ||
653 | perf_evlist__config(evlist, &opts, NULL); | 653 | perf_evlist__config(evlist, &opts, NULL); |
654 | 654 | ||
655 | evsel = perf_evlist__first(evlist); | 655 | evsel = evlist__first(evlist); |
656 | 656 | ||
657 | evsel->core.attr.comm = 1; | 657 | evsel->core.attr.comm = 1; |
658 | evsel->core.attr.disabled = 1; | 658 | evsel->core.attr.disabled = 1; |
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c index 0228ba435a2a..1ee8704e2284 100644 --- a/tools/perf/tests/event-times.c +++ b/tools/perf/tests/event-times.c | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | static int attach__enable_on_exec(struct evlist *evlist) | 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 | struct target target = { | 20 | struct target target = { |
21 | .uid = UINT_MAX, | 21 | .uid = UINT_MAX, |
22 | }; | 22 | }; |
@@ -58,7 +58,7 @@ static int detach__enable_on_exec(struct evlist *evlist) | |||
58 | 58 | ||
59 | static int attach__current_disabled(struct evlist *evlist) | 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 | struct perf_thread_map *threads; | 62 | struct perf_thread_map *threads; |
63 | int err; | 63 | int err; |
64 | 64 | ||
@@ -84,7 +84,7 @@ static int attach__current_disabled(struct evlist *evlist) | |||
84 | 84 | ||
85 | static int attach__current_enabled(struct evlist *evlist) | 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 | struct perf_thread_map *threads; | 88 | struct perf_thread_map *threads; |
89 | int err; | 89 | int err; |
90 | 90 | ||
@@ -104,14 +104,14 @@ static int attach__current_enabled(struct evlist *evlist) | |||
104 | 104 | ||
105 | static int detach__disable(struct evlist *evlist) | 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 | return evsel__enable(evsel); | 109 | return evsel__enable(evsel); |
110 | } | 110 | } |
111 | 111 | ||
112 | static int attach__cpu_disabled(struct evlist *evlist) | 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 | struct perf_cpu_map *cpus; | 115 | struct perf_cpu_map *cpus; |
116 | int err; | 116 | int err; |
117 | 117 | ||
@@ -140,7 +140,7 @@ static int attach__cpu_disabled(struct evlist *evlist) | |||
140 | 140 | ||
141 | static int attach__cpu_enabled(struct evlist *evlist) | 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 | struct perf_cpu_map *cpus; | 144 | struct perf_cpu_map *cpus; |
145 | int err; | 145 | int err; |
146 | 146 | ||
@@ -180,7 +180,7 @@ static int test_times(int (attach)(struct evlist *), | |||
180 | goto out_err; | 180 | goto out_err; |
181 | } | 181 | } |
182 | 182 | ||
183 | evsel = perf_evlist__last(evlist); | 183 | evsel = evlist__last(evlist); |
184 | evsel->core.attr.read_format |= | 184 | evsel->core.attr.read_format |= |
185 | PERF_FORMAT_TOTAL_TIME_ENABLED | | 185 | PERF_FORMAT_TOTAL_TIME_ENABLED | |
186 | PERF_FORMAT_TOTAL_TIME_RUNNING; | 186 | PERF_FORMAT_TOTAL_TIME_RUNNING; |
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c index cf4f90170f90..cd6cae8e5137 100644 --- a/tools/perf/tests/event_update.c +++ b/tools/perf/tests/event_update.c | |||
@@ -92,7 +92,7 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu | |||
92 | evlist = perf_evlist__new_default(); | 92 | evlist = perf_evlist__new_default(); |
93 | TEST_ASSERT_VAL("failed to get evlist", evlist); | 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 | TEST_ASSERT_VAL("failed to allocate ids", | 97 | TEST_ASSERT_VAL("failed to allocate ids", |
98 | !perf_evsel__alloc_id(&evsel->core, 1, 1)); | 98 | !perf_evsel__alloc_id(&evsel->core, 1, 1)); |
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c index 5330f106a6ee..956205bf9326 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c | |||
@@ -34,7 +34,7 @@ static int perf_evsel__roundtrip_cache_name_test(void) | |||
34 | } | 34 | } |
35 | 35 | ||
36 | idx = 0; | 36 | idx = 0; |
37 | evsel = perf_evlist__first(evlist); | 37 | evsel = evlist__first(evlist); |
38 | 38 | ||
39 | for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { | 39 | for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { |
40 | for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { | 40 | for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { |
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index fa55b7bad3af..6367c8f6ca22 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c | |||
@@ -721,7 +721,7 @@ int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_u | |||
721 | if (verbose > 1) | 721 | if (verbose > 1) |
722 | machine__fprintf(machine, stderr); | 722 | machine__fprintf(machine, stderr); |
723 | 723 | ||
724 | evsel = perf_evlist__first(evlist); | 724 | evsel = evlist__first(evlist); |
725 | 725 | ||
726 | for (i = 0; i < ARRAY_SIZE(testcases); i++) { | 726 | for (i = 0; i < ARRAY_SIZE(testcases); i++) { |
727 | err = testcases[i](evsel, machine); | 727 | err = testcases[i](evsel, machine); |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 1a3bdc0a2d14..a024d3f3a412 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
@@ -311,8 +311,8 @@ int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unuse | |||
311 | print_hists_in(hists); | 311 | print_hists_in(hists); |
312 | } | 312 | } |
313 | 313 | ||
314 | first = perf_evlist__first(evlist); | 314 | first = evlist__first(evlist); |
315 | evsel = perf_evlist__last(evlist); | 315 | evsel = evlist__last(evlist); |
316 | 316 | ||
317 | first_hists = evsel__hists(first); | 317 | first_hists = evsel__hists(first); |
318 | hists = evsel__hists(evsel); | 318 | hists = evsel__hists(evsel); |
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index 3f6dfa212260..38f804ff6452 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c | |||
@@ -608,7 +608,7 @@ int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unu | |||
608 | if (verbose > 1) | 608 | if (verbose > 1) |
609 | machine__fprintf(machine, stderr); | 609 | machine__fprintf(machine, stderr); |
610 | 610 | ||
611 | evsel = perf_evlist__first(evlist); | 611 | evsel = evlist__first(evlist); |
612 | 612 | ||
613 | for (i = 0; i < ARRAY_SIZE(testcases); i++) { | 613 | for (i = 0; i < ARRAY_SIZE(testcases); i++) { |
614 | err = testcases[i](evsel, machine); | 614 | err = testcases[i](evsel, machine); |
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index bd4ae8e5cd5d..92c7d591bcac 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -93,7 +93,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un | |||
93 | 93 | ||
94 | perf_evlist__config(evlist, &opts, NULL); | 94 | perf_evlist__config(evlist, &opts, NULL); |
95 | 95 | ||
96 | evsel = perf_evlist__first(evlist); | 96 | evsel = evlist__first(evlist); |
97 | 97 | ||
98 | evsel->core.attr.comm = 1; | 98 | evsel->core.attr.comm = 1; |
99 | evsel->core.attr.disabled = 1; | 99 | evsel->core.attr.disabled = 1; |
@@ -132,7 +132,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un | |||
132 | 132 | ||
133 | evlist__enable(evlist); | 133 | evlist__enable(evlist); |
134 | 134 | ||
135 | evsel = perf_evlist__last(evlist); | 135 | evsel = evlist__last(evlist); |
136 | 136 | ||
137 | CHECK__(evsel__disable(evsel)); | 137 | CHECK__(evsel__disable(evsel)); |
138 | 138 | ||
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index c25c8e7b41e5..25e0ed2eedfc 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -46,7 +46,7 @@ static bool kvm_s390_create_vm_valid(void) | |||
46 | 46 | ||
47 | static int test__checkevent_tracepoint(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 51 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
52 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); | 52 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); |
@@ -77,7 +77,7 @@ static int test__checkevent_tracepoint_multi(struct evlist *evlist) | |||
77 | 77 | ||
78 | static int test__checkevent_raw(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 83 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); |
@@ -87,7 +87,7 @@ static int test__checkevent_raw(struct evlist *evlist) | |||
87 | 87 | ||
88 | static int test__checkevent_numeric(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 92 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
93 | TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type); | 93 | TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type); |
@@ -97,7 +97,7 @@ static int test__checkevent_numeric(struct evlist *evlist) | |||
97 | 97 | ||
98 | static int test__checkevent_symbolic_name(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 103 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
@@ -108,7 +108,7 @@ static int test__checkevent_symbolic_name(struct evlist *evlist) | |||
108 | 108 | ||
109 | static int test__checkevent_symbolic_name_config(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 114 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
@@ -129,7 +129,7 @@ static int test__checkevent_symbolic_name_config(struct evlist *evlist) | |||
129 | 129 | ||
130 | static int test__checkevent_symbolic_alias(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 135 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); |
@@ -140,7 +140,7 @@ static int test__checkevent_symbolic_alias(struct evlist *evlist) | |||
140 | 140 | ||
141 | static int test__checkevent_genhw(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 146 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type); |
@@ -150,7 +150,7 @@ static int test__checkevent_genhw(struct evlist *evlist) | |||
150 | 150 | ||
151 | static int test__checkevent_breakpoint(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 156 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); |
@@ -164,7 +164,7 @@ static int test__checkevent_breakpoint(struct evlist *evlist) | |||
164 | 164 | ||
165 | static int test__checkevent_breakpoint_x(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 170 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); |
@@ -177,7 +177,7 @@ static int test__checkevent_breakpoint_x(struct evlist *evlist) | |||
177 | 177 | ||
178 | static int test__checkevent_breakpoint_r(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 182 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
183 | TEST_ASSERT_VAL("wrong type", | 183 | TEST_ASSERT_VAL("wrong type", |
@@ -192,7 +192,7 @@ static int test__checkevent_breakpoint_r(struct evlist *evlist) | |||
192 | 192 | ||
193 | static int test__checkevent_breakpoint_w(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 197 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
198 | TEST_ASSERT_VAL("wrong type", | 198 | TEST_ASSERT_VAL("wrong type", |
@@ -207,7 +207,7 @@ static int test__checkevent_breakpoint_w(struct evlist *evlist) | |||
207 | 207 | ||
208 | static int test__checkevent_breakpoint_rw(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 212 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
213 | TEST_ASSERT_VAL("wrong type", | 213 | TEST_ASSERT_VAL("wrong type", |
@@ -222,7 +222,7 @@ static int test__checkevent_breakpoint_rw(struct evlist *evlist) | |||
222 | 222 | ||
223 | static int test__checkevent_tracepoint_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 227 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
228 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 228 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
@@ -253,7 +253,7 @@ test__checkevent_tracepoint_multi_modifier(struct evlist *evlist) | |||
253 | 253 | ||
254 | static int test__checkevent_raw_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 258 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
259 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 259 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
@@ -265,7 +265,7 @@ static int test__checkevent_raw_modifier(struct evlist *evlist) | |||
265 | 265 | ||
266 | static int test__checkevent_numeric_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 270 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
271 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 271 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -277,7 +277,7 @@ static int test__checkevent_numeric_modifier(struct evlist *evlist) | |||
277 | 277 | ||
278 | static int test__checkevent_symbolic_name_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 282 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
283 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 283 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -289,7 +289,7 @@ static int test__checkevent_symbolic_name_modifier(struct evlist *evlist) | |||
289 | 289 | ||
290 | static int test__checkevent_exclude_host_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); | 294 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); |
295 | TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); | 295 | TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); |
@@ -299,7 +299,7 @@ static int test__checkevent_exclude_host_modifier(struct evlist *evlist) | |||
299 | 299 | ||
300 | static int test__checkevent_exclude_guest_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); | 304 | TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); |
305 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); | 305 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); |
@@ -309,7 +309,7 @@ static int test__checkevent_exclude_guest_modifier(struct evlist *evlist) | |||
309 | 309 | ||
310 | static int test__checkevent_symbolic_alias_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 314 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
315 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 315 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -321,7 +321,7 @@ static int test__checkevent_symbolic_alias_modifier(struct evlist *evlist) | |||
321 | 321 | ||
322 | static int test__checkevent_genhw_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 326 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
327 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 327 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
@@ -333,7 +333,7 @@ static int test__checkevent_genhw_modifier(struct evlist *evlist) | |||
333 | 333 | ||
334 | static int test__checkevent_exclude_idle_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); | 338 | TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); |
339 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); | 339 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); |
@@ -348,7 +348,7 @@ static int test__checkevent_exclude_idle_modifier(struct evlist *evlist) | |||
348 | 348 | ||
349 | static int test__checkevent_exclude_idle_modifier_1(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); | 353 | TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); |
354 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); | 354 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); |
@@ -363,7 +363,7 @@ static int test__checkevent_exclude_idle_modifier_1(struct evlist *evlist) | |||
363 | 363 | ||
364 | static int test__checkevent_breakpoint_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 369 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
@@ -378,7 +378,7 @@ static int test__checkevent_breakpoint_modifier(struct evlist *evlist) | |||
378 | 378 | ||
379 | static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 383 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
384 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 384 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
@@ -392,7 +392,7 @@ static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist) | |||
392 | 392 | ||
393 | static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 397 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
398 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 398 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -406,7 +406,7 @@ static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist) | |||
406 | 406 | ||
407 | static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 411 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
412 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 412 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -420,7 +420,7 @@ static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist) | |||
420 | 420 | ||
421 | static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); | 425 | TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); |
426 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 426 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
@@ -435,7 +435,7 @@ static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist) | |||
435 | static int test__checkevent_pmu(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 441 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); |
@@ -453,7 +453,7 @@ static int test__checkevent_pmu(struct evlist *evlist) | |||
453 | 453 | ||
454 | static int test__checkevent_list(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); | 458 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); |
459 | 459 | ||
@@ -492,7 +492,7 @@ static int test__checkevent_list(struct evlist *evlist) | |||
492 | 492 | ||
493 | static int test__checkevent_pmu_name(struct evlist *evlist) | 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 | /* cpu/config=1,name=krava/u */ | 497 | /* cpu/config=1,name=krava/u */ |
498 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); | 498 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); |
@@ -513,7 +513,7 @@ static int test__checkevent_pmu_name(struct evlist *evlist) | |||
513 | 513 | ||
514 | static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist) | 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 | /* cpu/config=1,call-graph=fp,time,period=100000/ */ | 518 | /* cpu/config=1,call-graph=fp,time,period=100000/ */ |
519 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); | 519 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); |
@@ -546,7 +546,7 @@ static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist) | |||
546 | 546 | ||
547 | static int test__checkevent_pmu_events(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 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); | 552 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); |
@@ -564,7 +564,7 @@ static int test__checkevent_pmu_events(struct evlist *evlist) | |||
564 | 564 | ||
565 | static int test__checkevent_pmu_events_mix(struct evlist *evlist) | 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 | /* pmu-event:u */ | 569 | /* pmu-event:u */ |
570 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); | 570 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); |
@@ -642,7 +642,7 @@ static int test__group1(struct evlist *evlist) | |||
642 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 642 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
643 | 643 | ||
644 | /* instructions:k */ | 644 | /* instructions:k */ |
645 | evsel = leader = perf_evlist__first(evlist); | 645 | evsel = leader = evlist__first(evlist); |
646 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 646 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
647 | TEST_ASSERT_VAL("wrong config", | 647 | TEST_ASSERT_VAL("wrong config", |
648 | PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); | 648 | PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); |
@@ -684,7 +684,7 @@ static int test__group2(struct evlist *evlist) | |||
684 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 684 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
685 | 685 | ||
686 | /* faults + :ku modifier */ | 686 | /* faults + :ku modifier */ |
687 | evsel = leader = perf_evlist__first(evlist); | 687 | evsel = leader = evlist__first(evlist); |
688 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); | 688 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); |
689 | TEST_ASSERT_VAL("wrong config", | 689 | TEST_ASSERT_VAL("wrong config", |
690 | PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config); | 690 | PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config); |
@@ -739,7 +739,7 @@ static int test__group3(struct evlist *evlist __maybe_unused) | |||
739 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); | 739 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); |
740 | 740 | ||
741 | /* group1 syscalls:sys_enter_openat:H */ | 741 | /* group1 syscalls:sys_enter_openat:H */ |
742 | evsel = leader = perf_evlist__first(evlist); | 742 | evsel = leader = evlist__first(evlist); |
743 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type); | 743 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type); |
744 | TEST_ASSERT_VAL("wrong sample_type", | 744 | TEST_ASSERT_VAL("wrong sample_type", |
745 | PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type); | 745 | PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type); |
@@ -831,7 +831,7 @@ static int test__group4(struct evlist *evlist __maybe_unused) | |||
831 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 831 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
832 | 832 | ||
833 | /* cycles:u + p */ | 833 | /* cycles:u + p */ |
834 | evsel = leader = perf_evlist__first(evlist); | 834 | evsel = leader = evlist__first(evlist); |
835 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 835 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
836 | TEST_ASSERT_VAL("wrong config", | 836 | TEST_ASSERT_VAL("wrong config", |
837 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 837 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -875,7 +875,7 @@ static int test__group5(struct evlist *evlist __maybe_unused) | |||
875 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); | 875 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); |
876 | 876 | ||
877 | /* cycles + G */ | 877 | /* cycles + G */ |
878 | evsel = leader = perf_evlist__first(evlist); | 878 | evsel = leader = evlist__first(evlist); |
879 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 879 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
880 | TEST_ASSERT_VAL("wrong config", | 880 | TEST_ASSERT_VAL("wrong config", |
881 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 881 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -961,7 +961,7 @@ static int test__group_gh1(struct evlist *evlist) | |||
961 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 961 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
962 | 962 | ||
963 | /* cycles + :H group modifier */ | 963 | /* cycles + :H group modifier */ |
964 | evsel = leader = perf_evlist__first(evlist); | 964 | evsel = leader = evlist__first(evlist); |
965 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 965 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
966 | TEST_ASSERT_VAL("wrong config", | 966 | TEST_ASSERT_VAL("wrong config", |
967 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 967 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1001,7 +1001,7 @@ static int test__group_gh2(struct evlist *evlist) | |||
1001 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 1001 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
1002 | 1002 | ||
1003 | /* cycles + :G group modifier */ | 1003 | /* cycles + :G group modifier */ |
1004 | evsel = leader = perf_evlist__first(evlist); | 1004 | evsel = leader = evlist__first(evlist); |
1005 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1005 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1006 | TEST_ASSERT_VAL("wrong config", | 1006 | TEST_ASSERT_VAL("wrong config", |
1007 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 1007 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1041,7 +1041,7 @@ static int test__group_gh3(struct evlist *evlist) | |||
1041 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 1041 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
1042 | 1042 | ||
1043 | /* cycles:G + :u group modifier */ | 1043 | /* cycles:G + :u group modifier */ |
1044 | evsel = leader = perf_evlist__first(evlist); | 1044 | evsel = leader = evlist__first(evlist); |
1045 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1045 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1046 | TEST_ASSERT_VAL("wrong config", | 1046 | TEST_ASSERT_VAL("wrong config", |
1047 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 1047 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1081,7 +1081,7 @@ static int test__group_gh4(struct evlist *evlist) | |||
1081 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | 1081 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
1082 | 1082 | ||
1083 | /* cycles:G + :uG group modifier */ | 1083 | /* cycles:G + :uG group modifier */ |
1084 | evsel = leader = perf_evlist__first(evlist); | 1084 | evsel = leader = evlist__first(evlist); |
1085 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1085 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1086 | TEST_ASSERT_VAL("wrong config", | 1086 | TEST_ASSERT_VAL("wrong config", |
1087 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 1087 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1120,7 +1120,7 @@ static int test__leader_sample1(struct evlist *evlist) | |||
1120 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); | 1120 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); |
1121 | 1121 | ||
1122 | /* cycles - sampling group leader */ | 1122 | /* cycles - sampling group leader */ |
1123 | evsel = leader = perf_evlist__first(evlist); | 1123 | evsel = leader = evlist__first(evlist); |
1124 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1124 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1125 | TEST_ASSERT_VAL("wrong config", | 1125 | TEST_ASSERT_VAL("wrong config", |
1126 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 1126 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1173,7 +1173,7 @@ static int test__leader_sample2(struct evlist *evlist __maybe_unused) | |||
1173 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); | 1173 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); |
1174 | 1174 | ||
1175 | /* instructions - sampling group leader */ | 1175 | /* instructions - sampling group leader */ |
1176 | evsel = leader = perf_evlist__first(evlist); | 1176 | evsel = leader = evlist__first(evlist); |
1177 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1177 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1178 | TEST_ASSERT_VAL("wrong config", | 1178 | TEST_ASSERT_VAL("wrong config", |
1179 | PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); | 1179 | PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config); |
@@ -1207,7 +1207,7 @@ static int test__leader_sample2(struct evlist *evlist __maybe_unused) | |||
1207 | 1207 | ||
1208 | static int test__checkevent_pinned_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 1212 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
1213 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 1213 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -1225,7 +1225,7 @@ static int test__pinned_group(struct evlist *evlist) | |||
1225 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); | 1225 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries); |
1226 | 1226 | ||
1227 | /* cycles - group leader */ | 1227 | /* cycles - group leader */ |
1228 | evsel = leader = perf_evlist__first(evlist); | 1228 | evsel = leader = evlist__first(evlist); |
1229 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); | 1229 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type); |
1230 | TEST_ASSERT_VAL("wrong config", | 1230 | TEST_ASSERT_VAL("wrong config", |
1231 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); | 1231 | PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config); |
@@ -1251,7 +1251,7 @@ static int test__pinned_group(struct evlist *evlist) | |||
1251 | 1251 | ||
1252 | static int test__checkevent_breakpoint_len(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 1256 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
1257 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); | 1257 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); |
@@ -1266,7 +1266,7 @@ static int test__checkevent_breakpoint_len(struct evlist *evlist) | |||
1266 | 1266 | ||
1267 | static int test__checkevent_breakpoint_len_w(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); | 1271 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); |
1272 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); | 1272 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type); |
@@ -1282,7 +1282,7 @@ static int test__checkevent_breakpoint_len_w(struct evlist *evlist) | |||
1282 | static int | 1282 | static int |
1283 | test__checkevent_breakpoint_len_rw_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 1287 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
1288 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 1288 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
@@ -1294,7 +1294,7 @@ test__checkevent_breakpoint_len_rw_modifier(struct evlist *evlist) | |||
1294 | 1294 | ||
1295 | static int test__checkevent_precise_max_modifier(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); | 1299 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); |
1300 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); | 1300 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type); |
@@ -1305,7 +1305,7 @@ static int test__checkevent_precise_max_modifier(struct evlist *evlist) | |||
1305 | 1305 | ||
1306 | static int test__checkevent_config_symbol(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0); | 1310 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0); |
1311 | return 0; | 1311 | return 0; |
@@ -1313,7 +1313,7 @@ static int test__checkevent_config_symbol(struct evlist *evlist) | |||
1313 | 1313 | ||
1314 | static int test__checkevent_config_raw(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0); | 1318 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0); |
1319 | return 0; | 1319 | return 0; |
@@ -1321,7 +1321,7 @@ static int test__checkevent_config_raw(struct evlist *evlist) | |||
1321 | 1321 | ||
1322 | static int test__checkevent_config_num(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0); | 1326 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0); |
1327 | return 0; | 1327 | return 0; |
@@ -1329,7 +1329,7 @@ static int test__checkevent_config_num(struct evlist *evlist) | |||
1329 | 1329 | ||
1330 | static int test__checkevent_config_cache(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0); | 1334 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0); |
1335 | return 0; | 1335 | return 0; |
@@ -1342,7 +1342,7 @@ static bool test__intel_pt_valid(void) | |||
1342 | 1342 | ||
1343 | static int test__intel_pt(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0); | 1347 | TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0); |
1348 | return 0; | 1348 | return 0; |
@@ -1350,7 +1350,7 @@ static int test__intel_pt(struct evlist *evlist) | |||
1350 | 1350 | ||
1351 | static int test__checkevent_complex_name(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0); | 1355 | TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0); |
1356 | return 0; | 1356 | return 0; |
@@ -1358,7 +1358,7 @@ static int test__checkevent_complex_name(struct evlist *evlist) | |||
1358 | 1358 | ||
1359 | static int test__sym_event_slash(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); | 1363 | TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); |
1364 | TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES); | 1364 | TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES); |
@@ -1368,7 +1368,7 @@ static int test__sym_event_slash(struct evlist *evlist) | |||
1368 | 1368 | ||
1369 | static int test__sym_event_dc(struct evlist *evlist) | 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 | TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); | 1373 | TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); |
1374 | TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES); | 1374 | TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES); |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 199a66444e60..401e8d11427b 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -104,7 +104,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus | |||
104 | /* | 104 | /* |
105 | * Config the evsels, setting attr->comm on the first one, etc. | 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 | perf_evsel__set_sample_bit(evsel, CPU); | 108 | perf_evsel__set_sample_bit(evsel, CPU); |
109 | perf_evsel__set_sample_bit(evsel, TID); | 109 | perf_evsel__set_sample_bit(evsel, TID); |
110 | perf_evsel__set_sample_bit(evsel, TIME); | 110 | perf_evsel__set_sample_bit(evsel, TIME); |
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 30a70db6473d..ffa592e0020e 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c | |||
@@ -367,7 +367,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
367 | goto out_err; | 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 | /* Second event */ | 372 | /* Second event */ |
373 | err = parse_events(evlist, "cycles:u", NULL); | 373 | err = parse_events(evlist, "cycles:u", NULL); |
@@ -376,7 +376,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
376 | goto out_err; | 376 | goto out_err; |
377 | } | 377 | } |
378 | 378 | ||
379 | cycles_evsel = perf_evlist__last(evlist); | 379 | cycles_evsel = evlist__last(evlist); |
380 | 380 | ||
381 | /* Third event */ | 381 | /* Third event */ |
382 | if (!perf_evlist__can_select_event(evlist, sched_switch)) { | 382 | if (!perf_evlist__can_select_event(evlist, sched_switch)) { |
@@ -391,7 +391,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
391 | goto out_err; | 391 | goto out_err; |
392 | } | 392 | } |
393 | 393 | ||
394 | switch_evsel = perf_evlist__last(evlist); | 394 | switch_evsel = evlist__last(evlist); |
395 | 395 | ||
396 | perf_evsel__set_sample_bit(switch_evsel, CPU); | 396 | perf_evsel__set_sample_bit(switch_evsel, CPU); |
397 | perf_evsel__set_sample_bit(switch_evsel, TIME); | 397 | perf_evsel__set_sample_bit(switch_evsel, TIME); |
@@ -401,12 +401,12 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
401 | switch_evsel->immediate = true; | 401 | switch_evsel->immediate = true; |
402 | 402 | ||
403 | /* Test moving an event to the front */ | 403 | /* Test moving an event to the front */ |
404 | if (cycles_evsel == perf_evlist__first(evlist)) { | 404 | if (cycles_evsel == evlist__first(evlist)) { |
405 | pr_debug("cycles event already at front"); | 405 | pr_debug("cycles event already at front"); |
406 | goto out_err; | 406 | goto out_err; |
407 | } | 407 | } |
408 | perf_evlist__to_front(evlist, cycles_evsel); | 408 | perf_evlist__to_front(evlist, cycles_evsel); |
409 | if (cycles_evsel != perf_evlist__first(evlist)) { | 409 | if (cycles_evsel != evlist__first(evlist)) { |
410 | pr_debug("Failed to move cycles event to front"); | 410 | pr_debug("Failed to move cycles event to front"); |
411 | goto out_err; | 411 | goto out_err; |
412 | } | 412 | } |
@@ -421,7 +421,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
421 | goto out_err; | 421 | goto out_err; |
422 | } | 422 | } |
423 | 423 | ||
424 | tracking_evsel = perf_evlist__last(evlist); | 424 | tracking_evsel = evlist__last(evlist); |
425 | 425 | ||
426 | perf_evlist__set_tracking_event(evlist, tracking_evsel); | 426 | perf_evlist__set_tracking_event(evlist, tracking_evsel); |
427 | 427 | ||
@@ -434,7 +434,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
434 | perf_evlist__config(evlist, &opts, NULL); | 434 | perf_evlist__config(evlist, &opts, NULL); |
435 | 435 | ||
436 | /* Check moved event is still at the front */ | 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 | pr_debug("Front event no longer at front"); | 438 | pr_debug("Front event no longer at front"); |
439 | goto out_err; | 439 | goto out_err; |
440 | } | 440 | } |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 7fc39af48a76..24565f83e07d 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -88,7 +88,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused | |||
88 | goto out_delete_evlist; | 88 | goto out_delete_evlist; |
89 | } | 89 | } |
90 | 90 | ||
91 | evsel = perf_evlist__first(evlist); | 91 | evsel = evlist__first(evlist); |
92 | evsel->core.attr.task = 1; | 92 | evsel->core.attr.task = 1; |
93 | #ifdef __s390x__ | 93 | #ifdef __s390x__ |
94 | evsel->core.attr.sample_freq = 1000000; | 94 | evsel->core.attr.sample_freq = 1000000; |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 589168ca9f62..7a7187e069b4 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -3319,13 +3319,13 @@ browse_hists: | |||
3319 | switch (key) { | 3319 | switch (key) { |
3320 | case K_TAB: | 3320 | case K_TAB: |
3321 | if (pos->core.node.next == &evlist->core.entries) | 3321 | if (pos->core.node.next == &evlist->core.entries) |
3322 | pos = perf_evlist__first(evlist); | 3322 | pos = evlist__first(evlist); |
3323 | else | 3323 | else |
3324 | pos = perf_evsel__next(pos); | 3324 | pos = perf_evsel__next(pos); |
3325 | goto browse_hists; | 3325 | goto browse_hists; |
3326 | case K_UNTAB: | 3326 | case K_UNTAB: |
3327 | if (pos->core.node.prev == &evlist->core.entries) | 3327 | if (pos->core.node.prev == &evlist->core.entries) |
3328 | pos = perf_evlist__last(evlist); | 3328 | pos = evlist__last(evlist); |
3329 | else | 3329 | else |
3330 | pos = perf_evsel__prev(pos); | 3330 | pos = perf_evsel__prev(pos); |
3331 | goto browse_hists; | 3331 | goto browse_hists; |
@@ -3417,7 +3417,7 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, | |||
3417 | 3417 | ||
3418 | single_entry: | 3418 | single_entry: |
3419 | if (nr_entries == 1) { | 3419 | if (nr_entries == 1) { |
3420 | struct evsel *first = perf_evlist__first(evlist); | 3420 | struct evsel *first = evlist__first(evlist); |
3421 | 3421 | ||
3422 | return perf_evsel__hists_browse(first, nr_entries, help, | 3422 | return perf_evsel__hists_browse(first, nr_entries, help, |
3423 | false, hbt, min_pcnt, | 3423 | false, hbt, min_pcnt, |
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 37283e865352..10c187b8b8ea 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c | |||
@@ -1568,7 +1568,7 @@ struct evsel *bpf__setup_output_event(struct evlist *evlist, const char *name) | |||
1568 | return ERR_PTR(-err); | 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 | bpf__for_each_map_named(map, obj, tmp, name) { | 1574 | bpf__for_each_map_named(map, obj, tmp, name) { |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 559db38594a8..e8f0357b1532 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -105,7 +105,7 @@ struct evlist *perf_evlist__new_dummy(void) | |||
105 | */ | 105 | */ |
106 | void perf_evlist__set_id_pos(struct evlist *evlist) | 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 | evlist->id_pos = first->id_pos; | 110 | evlist->id_pos = first->id_pos; |
111 | evlist->is_pos = first->is_pos; | 111 | evlist->is_pos = first->is_pos; |
@@ -559,14 +559,14 @@ struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id) | |||
559 | struct perf_sample_id *sid; | 559 | struct perf_sample_id *sid; |
560 | 560 | ||
561 | if (evlist->core.nr_entries == 1 || !id) | 561 | if (evlist->core.nr_entries == 1 || !id) |
562 | return perf_evlist__first(evlist); | 562 | return evlist__first(evlist); |
563 | 563 | ||
564 | sid = perf_evlist__id2sid(evlist, id); | 564 | sid = perf_evlist__id2sid(evlist, id); |
565 | if (sid) | 565 | if (sid) |
566 | return container_of(sid->evsel, struct evsel, core); | 566 | return container_of(sid->evsel, struct evsel, core); |
567 | 567 | ||
568 | if (!perf_evlist__sample_id_all(evlist)) | 568 | if (!perf_evlist__sample_id_all(evlist)) |
569 | return perf_evlist__first(evlist); | 569 | return evlist__first(evlist); |
570 | 570 | ||
571 | return NULL; | 571 | return NULL; |
572 | } | 572 | } |
@@ -610,7 +610,7 @@ static int perf_evlist__event2id(struct evlist *evlist, | |||
610 | struct evsel *perf_evlist__event2evsel(struct evlist *evlist, | 610 | struct evsel *perf_evlist__event2evsel(struct evlist *evlist, |
611 | union perf_event *event) | 611 | union perf_event *event) |
612 | { | 612 | { |
613 | struct evsel *first = perf_evlist__first(evlist); | 613 | struct evsel *first = evlist__first(evlist); |
614 | struct hlist_head *head; | 614 | struct hlist_head *head; |
615 | struct perf_sample_id *sid; | 615 | struct perf_sample_id *sid; |
616 | int hash; | 616 | int hash; |
@@ -1222,7 +1222,7 @@ u64 perf_evlist__combined_branch_type(struct evlist *evlist) | |||
1222 | 1222 | ||
1223 | bool perf_evlist__valid_read_format(struct evlist *evlist) | 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 | u64 read_format = first->core.attr.read_format; | 1226 | u64 read_format = first->core.attr.read_format; |
1227 | u64 sample_type = first->core.attr.sample_type; | 1227 | u64 sample_type = first->core.attr.sample_type; |
1228 | 1228 | ||
@@ -1242,13 +1242,13 @@ bool perf_evlist__valid_read_format(struct evlist *evlist) | |||
1242 | 1242 | ||
1243 | u64 perf_evlist__read_format(struct evlist *evlist) | 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 | return first->core.attr.read_format; | 1246 | return first->core.attr.read_format; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | u16 perf_evlist__id_hdr_size(struct evlist *evlist) | 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 | struct perf_sample *data; | 1252 | struct perf_sample *data; |
1253 | u64 sample_type; | 1253 | u64 sample_type; |
1254 | u16 size = 0; | 1254 | u16 size = 0; |
@@ -1281,7 +1281,7 @@ out: | |||
1281 | 1281 | ||
1282 | bool perf_evlist__valid_sample_id_all(struct evlist *evlist) | 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 | evlist__for_each_entry_continue(evlist, pos) { | 1286 | evlist__for_each_entry_continue(evlist, pos) { |
1287 | if (first->core.attr.sample_id_all != pos->core.attr.sample_id_all) | 1287 | if (first->core.attr.sample_id_all != pos->core.attr.sample_id_all) |
@@ -1293,7 +1293,7 @@ bool perf_evlist__valid_sample_id_all(struct evlist *evlist) | |||
1293 | 1293 | ||
1294 | bool perf_evlist__sample_id_all(struct evlist *evlist) | 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 | return first->core.attr.sample_id_all; | 1297 | return first->core.attr.sample_id_all; |
1298 | } | 1298 | } |
1299 | 1299 | ||
@@ -1568,7 +1568,7 @@ int perf_evlist__strerror_open(struct evlist *evlist, | |||
1568 | "Hint:\tThe current value is %d.", value); | 1568 | "Hint:\tThe current value is %d.", value); |
1569 | break; | 1569 | break; |
1570 | case EINVAL: { | 1570 | case EINVAL: { |
1571 | struct evsel *first = perf_evlist__first(evlist); | 1571 | struct evsel *first = evlist__first(evlist); |
1572 | int max_freq; | 1572 | int max_freq; |
1573 | 1573 | ||
1574 | if (sysctl__read_int("kernel/perf_event_max_sample_rate", &max_freq) < 0) | 1574 | if (sysctl__read_int("kernel/perf_event_max_sample_rate", &max_freq) < 0) |
@@ -1630,7 +1630,7 @@ void perf_evlist__to_front(struct evlist *evlist, | |||
1630 | struct evsel *evsel, *n; | 1630 | struct evsel *evsel, *n; |
1631 | LIST_HEAD(move); | 1631 | LIST_HEAD(move); |
1632 | 1632 | ||
1633 | if (move_evsel == perf_evlist__first(evlist)) | 1633 | if (move_evsel == evlist__first(evlist)) |
1634 | return; | 1634 | return; |
1635 | 1635 | ||
1636 | evlist__for_each_entry_safe(evlist, n, evsel) { | 1636 | evlist__for_each_entry_safe(evlist, n, evsel) { |
@@ -1751,7 +1751,7 @@ bool perf_evlist__exclude_kernel(struct evlist *evlist) | |||
1751 | void perf_evlist__force_leader(struct evlist *evlist) | 1751 | void perf_evlist__force_leader(struct evlist *evlist) |
1752 | { | 1752 | { |
1753 | if (!evlist->nr_groups) { | 1753 | if (!evlist->nr_groups) { |
1754 | struct evsel *leader = perf_evlist__first(evlist); | 1754 | struct evsel *leader = evlist__first(evlist); |
1755 | 1755 | ||
1756 | perf_evlist__set_leader(evlist); | 1756 | perf_evlist__set_leader(evlist); |
1757 | leader->forced_leader = true; | 1757 | leader->forced_leader = true; |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index ad9c0ba57a91..6529ad2a9d97 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <api/fd/array.h> | 9 | #include <api/fd/array.h> |
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <internal/evlist.h> | 11 | #include <internal/evlist.h> |
12 | #include <internal/evsel.h> | ||
12 | #include "events_stats.h" | 13 | #include "events_stats.h" |
13 | #include "evsel.h" | 14 | #include "evsel.h" |
14 | #include <pthread.h> | 15 | #include <pthread.h> |
@@ -242,14 +243,18 @@ static inline bool perf_evlist__empty(struct evlist *evlist) | |||
242 | return list_empty(&evlist->core.entries); | 243 | return list_empty(&evlist->core.entries); |
243 | } | 244 | } |
244 | 245 | ||
245 | static inline struct evsel *perf_evlist__first(struct evlist *evlist) | 246 | static inline struct evsel *evlist__first(struct evlist *evlist) |
246 | { | 247 | { |
247 | return list_entry(evlist->core.entries.next, struct evsel, core.node); | 248 | struct perf_evsel *evsel = perf_evlist__first(&evlist->core); |
249 | |||
250 | return container_of(evsel, struct evsel, core); | ||
248 | } | 251 | } |
249 | 252 | ||
250 | static inline struct evsel *perf_evlist__last(struct evlist *evlist) | 253 | static inline struct evsel *evlist__last(struct evlist *evlist) |
251 | { | 254 | { |
252 | return list_entry(evlist->core.entries.prev, struct evsel, core.node); | 255 | struct perf_evsel *evsel = perf_evlist__last(&evlist->core); |
256 | |||
257 | return container_of(evsel, struct evsel, core); | ||
253 | } | 258 | } |
254 | 259 | ||
255 | size_t perf_evlist__fprintf(struct evlist *evlist, FILE *fp); | 260 | size_t perf_evlist__fprintf(struct evlist *evlist, FILE *fp); |
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 9f9c6c6a2fd3..1bdf4c6ea3e5 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c | |||
@@ -777,7 +777,7 @@ jit_process(struct perf_session *session, | |||
777 | * track sample_type to compute id_all layout | 777 | * track sample_type to compute id_all layout |
778 | * perf sets the same sample type to all events as of now | 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 | jd.sample_type = first->core.attr.sample_type; | 781 | jd.sample_type = first->core.attr.sample_type; |
782 | 782 | ||
783 | *nbytes = 0; | 783 | *nbytes = 0; |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d7aebe9b005d..d69ff746cda5 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -1936,7 +1936,7 @@ int parse_events(struct evlist *evlist, const char *str, | |||
1936 | 1936 | ||
1937 | perf_evlist__splice_list_tail(evlist, &parse_state.list); | 1937 | perf_evlist__splice_list_tail(evlist, &parse_state.list); |
1938 | evlist->nr_groups += parse_state.nr_groups; | 1938 | evlist->nr_groups += parse_state.nr_groups; |
1939 | last = perf_evlist__last(evlist); | 1939 | last = evlist__last(evlist); |
1940 | last->cmdline_group_boundary = true; | 1940 | last->cmdline_group_boundary = true; |
1941 | 1941 | ||
1942 | return 0; | 1942 | return 0; |
@@ -2050,7 +2050,7 @@ foreach_evsel_in_last_glob(struct evlist *evlist, | |||
2050 | * So no need to WARN here, let *func do this. | 2050 | * So no need to WARN here, let *func do this. |
2051 | */ | 2051 | */ |
2052 | if (evlist->core.nr_entries > 0) | 2052 | if (evlist->core.nr_entries > 0) |
2053 | last = perf_evlist__last(evlist); | 2053 | last = evlist__last(evlist); |
2054 | 2054 | ||
2055 | do { | 2055 | do { |
2056 | err = (*func)(last, arg); | 2056 | err = (*func)(last, arg); |
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 8a015fc0aba0..8579505c29a4 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c | |||
@@ -30,7 +30,7 @@ static int perf_do_probe_api(setup_probe_fn_t fn, int cpu, const char *str) | |||
30 | if (parse_events(evlist, str, NULL)) | 30 | if (parse_events(evlist, str, NULL)) |
31 | goto out_delete; | 31 | goto out_delete; |
32 | 32 | ||
33 | evsel = perf_evlist__first(evlist); | 33 | evsel = evlist__first(evlist); |
34 | 34 | ||
35 | while (1) { | 35 | while (1) { |
36 | fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, flags); | 36 | fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, flags); |
@@ -171,7 +171,7 @@ void perf_evlist__config(struct evlist *evlist, struct record_opts *opts, | |||
171 | use_sample_identifier = perf_can_sample_identifier(); | 171 | use_sample_identifier = perf_can_sample_identifier(); |
172 | sample_id = true; | 172 | sample_id = true; |
173 | } else if (evlist->core.nr_entries > 1) { | 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 | evlist__for_each_entry(evlist, evsel) { | 176 | evlist__for_each_entry(evlist, evsel) { |
177 | if (evsel->core.attr.sample_type == first->core.attr.sample_type) | 177 | if (evsel->core.attr.sample_type == first->core.attr.sample_type) |
@@ -276,7 +276,7 @@ bool perf_evlist__can_select_event(struct evlist *evlist, const char *str) | |||
276 | if (err) | 276 | if (err) |
277 | goto out_delete; | 277 | goto out_delete; |
278 | 278 | ||
279 | evsel = perf_evlist__last(temp_evlist); | 279 | evsel = evlist__last(temp_evlist); |
280 | 280 | ||
281 | if (!evlist || perf_cpu_map__empty(evlist->core.cpus)) { | 281 | if (!evlist || perf_cpu_map__empty(evlist->core.cpus)) { |
282 | struct perf_cpu_map *cpus = perf_cpu_map__new(NULL); | 282 | struct perf_cpu_map *cpus = perf_cpu_map__new(NULL); |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index a2308eb77681..43d1d410854a 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -2329,7 +2329,7 @@ static struct evsel *find_evsel(struct evlist *evlist, char *event_name) | |||
2329 | if (nr > evlist->core.nr_entries) | 2329 | if (nr > evlist->core.nr_entries) |
2330 | return NULL; | 2330 | return NULL; |
2331 | 2331 | ||
2332 | evsel = perf_evlist__first(evlist); | 2332 | evsel = evlist__first(evlist); |
2333 | while (--nr > 0) | 2333 | while (--nr > 0) |
2334 | evsel = perf_evsel__next(evsel); | 2334 | evsel = perf_evsel__next(evsel); |
2335 | 2335 | ||
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index ef96e3dd6902..3dce2de9d005 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c | |||
@@ -71,7 +71,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | if (top->evlist->core.nr_entries == 1) { | 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 | ret += SNPRINTF(bf + ret, size - ret, "%" PRIu64 "%s ", | 75 | ret += SNPRINTF(bf + ret, size - ret, "%" PRIu64 "%s ", |
76 | (uint64_t)first->core.attr.sample_period, | 76 | (uint64_t)first->core.attr.sample_period, |
77 | opts->freq ? "Hz" : ""); | 77 | opts->freq ? "Hz" : ""); |