summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/arch/arm/util/auxtrace.c2
-rw-r--r--tools/perf/arch/arm/util/cs-etm.c20
-rw-r--r--tools/perf/arch/arm64/util/arm-spe.c6
-rw-r--r--tools/perf/arch/powerpc/util/kvm-stat.c6
-rw-r--r--tools/perf/arch/s390/util/auxtrace.c2
-rw-r--r--tools/perf/arch/s390/util/kvm-stat.c8
-rw-r--r--tools/perf/arch/x86/tests/intel-cqm.c2
-rw-r--r--tools/perf/arch/x86/tests/perf-time-to-tsc.c2
-rw-r--r--tools/perf/arch/x86/util/auxtrace.c2
-rw-r--r--tools/perf/arch/x86/util/intel-bts.c10
-rw-r--r--tools/perf/arch/x86/util/intel-pt.c20
-rw-r--r--tools/perf/arch/x86/util/kvm-stat.c12
-rw-r--r--tools/perf/builtin-annotate.c16
-rw-r--r--tools/perf/builtin-c2c.c4
-rw-r--r--tools/perf/builtin-diff.c12
-rw-r--r--tools/perf/builtin-evlist.c2
-rw-r--r--tools/perf/builtin-inject.c30
-rw-r--r--tools/perf/builtin-kmem.c24
-rw-r--r--tools/perf/builtin-kvm.c20
-rw-r--r--tools/perf/builtin-lock.c30
-rw-r--r--tools/perf/builtin-mem.c2
-rw-r--r--tools/perf/builtin-record.c4
-rw-r--r--tools/perf/builtin-report.c22
-rw-r--r--tools/perf/builtin-sched.c74
-rw-r--r--tools/perf/builtin-script.c90
-rw-r--r--tools/perf/builtin-stat.c18
-rw-r--r--tools/perf/builtin-timechart.c44
-rw-r--r--tools/perf/builtin-top.c30
-rw-r--r--tools/perf/builtin-trace.c76
-rw-r--r--tools/perf/tests/backward-ring-buffer.c2
-rw-r--r--tools/perf/tests/code-reading.c2
-rw-r--r--tools/perf/tests/event-times.c14
-rw-r--r--tools/perf/tests/event_update.c2
-rw-r--r--tools/perf/tests/evsel-roundtrip-name.c4
-rw-r--r--tools/perf/tests/evsel-tp-sched.c4
-rw-r--r--tools/perf/tests/hists_cumulate.c14
-rw-r--r--tools/perf/tests/hists_filter.c4
-rw-r--r--tools/perf/tests/hists_link.c4
-rw-r--r--tools/perf/tests/hists_output.c16
-rw-r--r--tools/perf/tests/keep-tracking.c2
-rw-r--r--tools/perf/tests/mmap-basic.c2
-rw-r--r--tools/perf/tests/openat-syscall-all-cpus.c2
-rw-r--r--tools/perf/tests/openat-syscall-tp-fields.c2
-rw-r--r--tools/perf/tests/openat-syscall.c2
-rw-r--r--tools/perf/tests/parse-events.c120
-rw-r--r--tools/perf/tests/perf-record.c2
-rw-r--r--tools/perf/tests/sample-parsing.c2
-rw-r--r--tools/perf/tests/sw-clock.c2
-rw-r--r--tools/perf/tests/switch-tracking.c10
-rw-r--r--tools/perf/tests/task-exit.c2
-rw-r--r--tools/perf/ui/browsers/annotate.c14
-rw-r--r--tools/perf/ui/browsers/hists.c40
-rw-r--r--tools/perf/ui/browsers/res_sample.c2
-rw-r--r--tools/perf/ui/browsers/scripts.c4
-rw-r--r--tools/perf/ui/gtk/annotate.c6
-rw-r--r--tools/perf/ui/gtk/gtk.h4
-rw-r--r--tools/perf/ui/gtk/hists.c2
-rw-r--r--tools/perf/ui/hist.c8
-rw-r--r--tools/perf/util/annotate.c32
-rw-r--r--tools/perf/util/annotate.h26
-rw-r--r--tools/perf/util/auxtrace.c8
-rw-r--r--tools/perf/util/bpf-loader.c12
-rw-r--r--tools/perf/util/bpf-loader.h6
-rw-r--r--tools/perf/util/build-id.c2
-rw-r--r--tools/perf/util/build-id.h2
-rw-r--r--tools/perf/util/callchain.c2
-rw-r--r--tools/perf/util/callchain.h2
-rw-r--r--tools/perf/util/cgroup.c10
-rw-r--r--tools/perf/util/counts.c6
-rw-r--r--tools/perf/util/counts.h6
-rw-r--r--tools/perf/util/cs-etm.c4
-rw-r--r--tools/perf/util/data-convert-bt.c18
-rw-r--r--tools/perf/util/db-export.c6
-rw-r--r--tools/perf/util/db-export.h10
-rw-r--r--tools/perf/util/evlist.c142
-rw-r--r--tools/perf/util/evlist.h46
-rw-r--r--tools/perf/util/evsel.c168
-rw-r--r--tools/perf/util/evsel.h146
-rw-r--r--tools/perf/util/evsel_fprintf.c4
-rw-r--r--tools/perf/util/header.c58
-rw-r--r--tools/perf/util/header.h8
-rw-r--r--tools/perf/util/hist.c26
-rw-r--r--tools/perf/util/hist.h28
-rw-r--r--tools/perf/util/intel-bts.c2
-rw-r--r--tools/perf/util/intel-pt.c36
-rw-r--r--tools/perf/util/jitdump.c4
-rw-r--r--tools/perf/util/kvm-stat.h18
-rw-r--r--tools/perf/util/machine.c6
-rw-r--r--tools/perf/util/machine.h4
-rw-r--r--tools/perf/util/map.h2
-rw-r--r--tools/perf/util/metricgroup.c22
-rw-r--r--tools/perf/util/metricgroup.h6
-rw-r--r--tools/perf/util/parse-events.c48
-rw-r--r--tools/perf/util/parse-events.h2
-rw-r--r--tools/perf/util/python.c14
-rw-r--r--tools/perf/util/record.c16
-rw-r--r--tools/perf/util/s390-cpumsf.c2
-rw-r--r--tools/perf/util/s390-sample-raw.c2
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c8
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c22
-rw-r--r--tools/perf/util/session.c30
-rw-r--r--tools/perf/util/session.h8
-rw-r--r--tools/perf/util/sort.c28
-rw-r--r--tools/perf/util/stat-display.c60
-rw-r--r--tools/perf/util/stat-shadow.c38
-rw-r--r--tools/perf/util/stat.c38
-rw-r--r--tools/perf/util/stat.h14
-rw-r--r--tools/perf/util/tool.h4
-rw-r--r--tools/perf/util/top.c2
-rw-r--r--tools/perf/util/top.h4
-rw-r--r--tools/perf/util/trace-event-info.c4
-rw-r--r--tools/perf/util/trace-event-scripting.c2
-rw-r--r--tools/perf/util/trace-event.h4
113 files changed, 1056 insertions, 1056 deletions
diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
index 02014740a1aa..fd17dccfcb0b 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -53,7 +53,7 @@ struct auxtrace_record
53*auxtrace_record__init(struct perf_evlist *evlist, int *err) 53*auxtrace_record__init(struct perf_evlist *evlist, int *err)
54{ 54{
55 struct perf_pmu *cs_etm_pmu; 55 struct perf_pmu *cs_etm_pmu;
56 struct perf_evsel *evsel; 56 struct evsel *evsel;
57 bool found_etm = false; 57 bool found_etm = false;
58 bool found_spe = false; 58 bool found_spe = false;
59 static struct perf_pmu **arm_spe_pmus = NULL; 59 static struct perf_pmu **arm_spe_pmus = NULL;
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index d08b55c27774..476f845be5fe 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -55,7 +55,7 @@ static const char *metadata_etmv4_ro[CS_ETMV4_PRIV_MAX] = {
55static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu); 55static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu);
56 56
57static int cs_etm_set_context_id(struct auxtrace_record *itr, 57static int cs_etm_set_context_id(struct auxtrace_record *itr,
58 struct perf_evsel *evsel, int cpu) 58 struct evsel *evsel, int cpu)
59{ 59{
60 struct cs_etm_recording *ptr; 60 struct cs_etm_recording *ptr;
61 struct perf_pmu *cs_etm_pmu; 61 struct perf_pmu *cs_etm_pmu;
@@ -104,7 +104,7 @@ out:
104} 104}
105 105
106static int cs_etm_set_timestamp(struct auxtrace_record *itr, 106static int cs_etm_set_timestamp(struct auxtrace_record *itr,
107 struct perf_evsel *evsel, int cpu) 107 struct evsel *evsel, int cpu)
108{ 108{
109 struct cs_etm_recording *ptr; 109 struct cs_etm_recording *ptr;
110 struct perf_pmu *cs_etm_pmu; 110 struct perf_pmu *cs_etm_pmu;
@@ -152,7 +152,7 @@ out:
152} 152}
153 153
154static int cs_etm_set_option(struct auxtrace_record *itr, 154static int cs_etm_set_option(struct auxtrace_record *itr,
155 struct perf_evsel *evsel, u32 option) 155 struct evsel *evsel, u32 option)
156{ 156{
157 int i, err = -EINVAL; 157 int i, err = -EINVAL;
158 struct perf_cpu_map *event_cpus = evsel->evlist->cpus; 158 struct perf_cpu_map *event_cpus = evsel->evlist->cpus;
@@ -208,7 +208,7 @@ static int cs_etm_parse_snapshot_options(struct auxtrace_record *itr,
208} 208}
209 209
210static int cs_etm_set_sink_attr(struct perf_pmu *pmu, 210static int cs_etm_set_sink_attr(struct perf_pmu *pmu,
211 struct perf_evsel *evsel) 211 struct evsel *evsel)
212{ 212{
213 char msg[BUFSIZ], path[PATH_MAX], *sink; 213 char msg[BUFSIZ], path[PATH_MAX], *sink;
214 struct perf_evsel_config_term *term; 214 struct perf_evsel_config_term *term;
@@ -252,7 +252,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
252 struct cs_etm_recording *ptr = 252 struct cs_etm_recording *ptr =
253 container_of(itr, struct cs_etm_recording, itr); 253 container_of(itr, struct cs_etm_recording, itr);
254 struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; 254 struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu;
255 struct perf_evsel *evsel, *cs_etm_evsel = NULL; 255 struct evsel *evsel, *cs_etm_evsel = NULL;
256 struct perf_cpu_map *cpus = evlist->cpus; 256 struct perf_cpu_map *cpus = evlist->cpus;
257 bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0); 257 bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0);
258 int err = 0; 258 int err = 0;
@@ -407,7 +407,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
407 407
408 /* Add dummy event to keep tracking */ 408 /* Add dummy event to keep tracking */
409 if (opts->full_auxtrace) { 409 if (opts->full_auxtrace) {
410 struct perf_evsel *tracking_evsel; 410 struct evsel *tracking_evsel;
411 411
412 err = parse_events(evlist, "dummy:u", NULL); 412 err = parse_events(evlist, "dummy:u", NULL);
413 if (err) 413 if (err)
@@ -435,7 +435,7 @@ static u64 cs_etm_get_config(struct auxtrace_record *itr)
435 container_of(itr, struct cs_etm_recording, itr); 435 container_of(itr, struct cs_etm_recording, itr);
436 struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; 436 struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu;
437 struct perf_evlist *evlist = ptr->evlist; 437 struct perf_evlist *evlist = ptr->evlist;
438 struct perf_evsel *evsel; 438 struct evsel *evsel;
439 439
440 evlist__for_each_entry(evlist, evsel) { 440 evlist__for_each_entry(evlist, evsel) {
441 if (evsel->attr.type == cs_etm_pmu->type) { 441 if (evsel->attr.type == cs_etm_pmu->type) {
@@ -817,7 +817,7 @@ static int cs_etm_snapshot_start(struct auxtrace_record *itr)
817{ 817{
818 struct cs_etm_recording *ptr = 818 struct cs_etm_recording *ptr =
819 container_of(itr, struct cs_etm_recording, itr); 819 container_of(itr, struct cs_etm_recording, itr);
820 struct perf_evsel *evsel; 820 struct evsel *evsel;
821 821
822 evlist__for_each_entry(ptr->evlist, evsel) { 822 evlist__for_each_entry(ptr->evlist, evsel) {
823 if (evsel->attr.type == ptr->cs_etm_pmu->type) 823 if (evsel->attr.type == ptr->cs_etm_pmu->type)
@@ -830,7 +830,7 @@ static int cs_etm_snapshot_finish(struct auxtrace_record *itr)
830{ 830{
831 struct cs_etm_recording *ptr = 831 struct cs_etm_recording *ptr =
832 container_of(itr, struct cs_etm_recording, itr); 832 container_of(itr, struct cs_etm_recording, itr);
833 struct perf_evsel *evsel; 833 struct evsel *evsel;
834 834
835 evlist__for_each_entry(ptr->evlist, evsel) { 835 evlist__for_each_entry(ptr->evlist, evsel) {
836 if (evsel->attr.type == ptr->cs_etm_pmu->type) 836 if (evsel->attr.type == ptr->cs_etm_pmu->type)
@@ -858,7 +858,7 @@ static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
858{ 858{
859 struct cs_etm_recording *ptr = 859 struct cs_etm_recording *ptr =
860 container_of(itr, struct cs_etm_recording, itr); 860 container_of(itr, struct cs_etm_recording, itr);
861 struct perf_evsel *evsel; 861 struct evsel *evsel;
862 862
863 evlist__for_each_entry(ptr->evlist, evsel) { 863 evlist__for_each_entry(ptr->evlist, evsel) {
864 if (evsel->attr.type == ptr->cs_etm_pmu->type) 864 if (evsel->attr.type == ptr->cs_etm_pmu->type)
diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index 2c009aa74633..103bf20ae32a 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -65,9 +65,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
65 struct arm_spe_recording *sper = 65 struct arm_spe_recording *sper =
66 container_of(itr, struct arm_spe_recording, itr); 66 container_of(itr, struct arm_spe_recording, itr);
67 struct perf_pmu *arm_spe_pmu = sper->arm_spe_pmu; 67 struct perf_pmu *arm_spe_pmu = sper->arm_spe_pmu;
68 struct perf_evsel *evsel, *arm_spe_evsel = NULL; 68 struct evsel *evsel, *arm_spe_evsel = NULL;
69 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; 69 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
70 struct perf_evsel *tracking_evsel; 70 struct evsel *tracking_evsel;
71 int err; 71 int err;
72 72
73 sper->evlist = evlist; 73 sper->evlist = evlist;
@@ -160,7 +160,7 @@ static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
160{ 160{
161 struct arm_spe_recording *sper = 161 struct arm_spe_recording *sper =
162 container_of(itr, struct arm_spe_recording, itr); 162 container_of(itr, struct arm_spe_recording, itr);
163 struct perf_evsel *evsel; 163 struct evsel *evsel;
164 164
165 evlist__for_each_entry(sper->evlist, evsel) { 165 evlist__for_each_entry(sper->evlist, evsel) {
166 if (evsel->attr.type == sper->arm_spe_pmu->type) 166 if (evsel->attr.type == sper->arm_spe_pmu->type)
diff --git a/tools/perf/arch/powerpc/util/kvm-stat.c b/tools/perf/arch/powerpc/util/kvm-stat.c
index f9db341c47b6..557c474f0a4b 100644
--- a/tools/perf/arch/powerpc/util/kvm-stat.c
+++ b/tools/perf/arch/powerpc/util/kvm-stat.c
@@ -32,7 +32,7 @@ const char *ppc_book3s_hv_kvm_tp[] = {
32const char *kvm_events_tp[NR_TPS + 1]; 32const char *kvm_events_tp[NR_TPS + 1];
33const char *kvm_exit_reason; 33const char *kvm_exit_reason;
34 34
35static void hcall_event_get_key(struct perf_evsel *evsel, 35static void hcall_event_get_key(struct evsel *evsel,
36 struct perf_sample *sample, 36 struct perf_sample *sample,
37 struct event_key *key) 37 struct event_key *key)
38{ 38{
@@ -55,14 +55,14 @@ static const char *get_hcall_exit_reason(u64 exit_code)
55 return "UNKNOWN"; 55 return "UNKNOWN";
56} 56}
57 57
58static bool hcall_event_end(struct perf_evsel *evsel, 58static bool hcall_event_end(struct evsel *evsel,
59 struct perf_sample *sample __maybe_unused, 59 struct perf_sample *sample __maybe_unused,
60 struct event_key *key __maybe_unused) 60 struct event_key *key __maybe_unused)
61{ 61{
62 return (!strcmp(evsel->name, kvm_events_tp[3])); 62 return (!strcmp(evsel->name, kvm_events_tp[3]));
63} 63}
64 64
65static bool hcall_event_begin(struct perf_evsel *evsel, 65static bool hcall_event_begin(struct evsel *evsel,
66 struct perf_sample *sample, struct event_key *key) 66 struct perf_sample *sample, struct event_key *key)
67{ 67{
68 if (!strcmp(evsel->name, kvm_events_tp[2])) { 68 if (!strcmp(evsel->name, kvm_events_tp[2])) {
diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c
index 0fe1be93f375..aec819b945c5 100644
--- a/tools/perf/arch/s390/util/auxtrace.c
+++ b/tools/perf/arch/s390/util/auxtrace.c
@@ -86,7 +86,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
86 int *err) 86 int *err)
87{ 87{
88 struct auxtrace_record *aux; 88 struct auxtrace_record *aux;
89 struct perf_evsel *pos; 89 struct evsel *pos;
90 int diagnose = 0; 90 int diagnose = 0;
91 91
92 *err = 0; 92 *err = 0;
diff --git a/tools/perf/arch/s390/util/kvm-stat.c b/tools/perf/arch/s390/util/kvm-stat.c
index f852f2a77e0a..dac78441338c 100644
--- a/tools/perf/arch/s390/util/kvm-stat.c
+++ b/tools/perf/arch/s390/util/kvm-stat.c
@@ -23,7 +23,7 @@ const char *kvm_exit_reason = "icptcode";
23const char *kvm_entry_trace = "kvm:kvm_s390_sie_enter"; 23const char *kvm_entry_trace = "kvm:kvm_s390_sie_enter";
24const char *kvm_exit_trace = "kvm:kvm_s390_sie_exit"; 24const char *kvm_exit_trace = "kvm:kvm_s390_sie_exit";
25 25
26static void event_icpt_insn_get_key(struct perf_evsel *evsel, 26static void event_icpt_insn_get_key(struct evsel *evsel,
27 struct perf_sample *sample, 27 struct perf_sample *sample,
28 struct event_key *key) 28 struct event_key *key)
29{ 29{
@@ -34,7 +34,7 @@ static void event_icpt_insn_get_key(struct perf_evsel *evsel,
34 key->exit_reasons = sie_icpt_insn_codes; 34 key->exit_reasons = sie_icpt_insn_codes;
35} 35}
36 36
37static void event_sigp_get_key(struct perf_evsel *evsel, 37static void event_sigp_get_key(struct evsel *evsel,
38 struct perf_sample *sample, 38 struct perf_sample *sample,
39 struct event_key *key) 39 struct event_key *key)
40{ 40{
@@ -42,7 +42,7 @@ static void event_sigp_get_key(struct perf_evsel *evsel,
42 key->exit_reasons = sie_sigp_order_codes; 42 key->exit_reasons = sie_sigp_order_codes;
43} 43}
44 44
45static void event_diag_get_key(struct perf_evsel *evsel, 45static void event_diag_get_key(struct evsel *evsel,
46 struct perf_sample *sample, 46 struct perf_sample *sample,
47 struct event_key *key) 47 struct event_key *key)
48{ 48{
@@ -50,7 +50,7 @@ static void event_diag_get_key(struct perf_evsel *evsel,
50 key->exit_reasons = sie_diagnose_codes; 50 key->exit_reasons = sie_diagnose_codes;
51} 51}
52 52
53static void event_icpt_prog_get_key(struct perf_evsel *evsel, 53static void event_icpt_prog_get_key(struct evsel *evsel,
54 struct perf_sample *sample, 54 struct perf_sample *sample,
55 struct event_key *key) 55 struct event_key *key)
56{ 56{
diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
index 94aa0b673b7f..b88ed71b2e3f 100644
--- a/tools/perf/arch/x86/tests/intel-cqm.c
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -41,7 +41,7 @@ static pid_t spawn(void)
41int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest __maybe_unused) 41int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest __maybe_unused)
42{ 42{
43 struct perf_evlist *evlist = NULL; 43 struct perf_evlist *evlist = NULL;
44 struct perf_evsel *evsel = NULL; 44 struct evsel *evsel = NULL;
45 struct perf_event_attr pe; 45 struct perf_event_attr pe;
46 int i, fd[2], flag, ret; 46 int i, fd[2], flag, ret;
47 size_t mmap_len; 47 size_t mmap_len;
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 f542b878bdb5..43fc7d426d93 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -52,7 +52,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
52 struct perf_thread_map *threads = NULL; 52 struct perf_thread_map *threads = NULL;
53 struct perf_cpu_map *cpus = NULL; 53 struct perf_cpu_map *cpus = NULL;
54 struct perf_evlist *evlist = NULL; 54 struct perf_evlist *evlist = NULL;
55 struct perf_evsel *evsel = NULL; 55 struct evsel *evsel = NULL;
56 int err = -1, ret, i; 56 int err = -1, ret, i;
57 const char *comm1, *comm2; 57 const char *comm1, *comm2;
58 struct perf_tsc_conversion tc; 58 struct perf_tsc_conversion tc;
diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c
index d711268af330..02f192114448 100644
--- a/tools/perf/arch/x86/util/auxtrace.c
+++ b/tools/perf/arch/x86/util/auxtrace.c
@@ -21,7 +21,7 @@ struct auxtrace_record *auxtrace_record__init_intel(struct perf_evlist *evlist,
21{ 21{
22 struct perf_pmu *intel_pt_pmu; 22 struct perf_pmu *intel_pt_pmu;
23 struct perf_pmu *intel_bts_pmu; 23 struct perf_pmu *intel_bts_pmu;
24 struct perf_evsel *evsel; 24 struct evsel *evsel;
25 bool found_pt = false; 25 bool found_pt = false;
26 bool found_bts = false; 26 bool found_bts = false;
27 27
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index da1583d27efd..59685a19c3b9 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -105,7 +105,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
105 struct intel_bts_recording *btsr = 105 struct intel_bts_recording *btsr =
106 container_of(itr, struct intel_bts_recording, itr); 106 container_of(itr, struct intel_bts_recording, itr);
107 struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu; 107 struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu;
108 struct perf_evsel *evsel, *intel_bts_evsel = NULL; 108 struct evsel *evsel, *intel_bts_evsel = NULL;
109 const struct perf_cpu_map *cpus = evlist->cpus; 109 const struct perf_cpu_map *cpus = evlist->cpus;
110 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; 110 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
111 111
@@ -220,7 +220,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
220 220
221 /* Add dummy event to keep tracking */ 221 /* Add dummy event to keep tracking */
222 if (opts->full_auxtrace) { 222 if (opts->full_auxtrace) {
223 struct perf_evsel *tracking_evsel; 223 struct evsel *tracking_evsel;
224 int err; 224 int err;
225 225
226 err = parse_events(evlist, "dummy:u", NULL); 226 err = parse_events(evlist, "dummy:u", NULL);
@@ -313,7 +313,7 @@ static int intel_bts_snapshot_start(struct auxtrace_record *itr)
313{ 313{
314 struct intel_bts_recording *btsr = 314 struct intel_bts_recording *btsr =
315 container_of(itr, struct intel_bts_recording, itr); 315 container_of(itr, struct intel_bts_recording, itr);
316 struct perf_evsel *evsel; 316 struct evsel *evsel;
317 317
318 evlist__for_each_entry(btsr->evlist, evsel) { 318 evlist__for_each_entry(btsr->evlist, evsel) {
319 if (evsel->attr.type == btsr->intel_bts_pmu->type) 319 if (evsel->attr.type == btsr->intel_bts_pmu->type)
@@ -326,7 +326,7 @@ static int intel_bts_snapshot_finish(struct auxtrace_record *itr)
326{ 326{
327 struct intel_bts_recording *btsr = 327 struct intel_bts_recording *btsr =
328 container_of(itr, struct intel_bts_recording, itr); 328 container_of(itr, struct intel_bts_recording, itr);
329 struct perf_evsel *evsel; 329 struct evsel *evsel;
330 330
331 evlist__for_each_entry(btsr->evlist, evsel) { 331 evlist__for_each_entry(btsr->evlist, evsel) {
332 if (evsel->attr.type == btsr->intel_bts_pmu->type) 332 if (evsel->attr.type == btsr->intel_bts_pmu->type)
@@ -408,7 +408,7 @@ static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
408{ 408{
409 struct intel_bts_recording *btsr = 409 struct intel_bts_recording *btsr =
410 container_of(itr, struct intel_bts_recording, itr); 410 container_of(itr, struct intel_bts_recording, itr);
411 struct perf_evsel *evsel; 411 struct evsel *evsel;
412 412
413 evlist__for_each_entry(btsr->evlist, evsel) { 413 evlist__for_each_entry(btsr->evlist, evsel) {
414 if (evsel->attr.type == btsr->intel_bts_pmu->type) 414 if (evsel->attr.type == btsr->intel_bts_pmu->type)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 69a23e40abc9..b42df73fd7ff 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -112,7 +112,7 @@ static u64 intel_pt_masked_bits(u64 mask, u64 bits)
112static int intel_pt_read_config(struct perf_pmu *intel_pt_pmu, const char *str, 112static int intel_pt_read_config(struct perf_pmu *intel_pt_pmu, const char *str,
113 struct perf_evlist *evlist, u64 *res) 113 struct perf_evlist *evlist, u64 *res)
114{ 114{
115 struct perf_evsel *evsel; 115 struct evsel *evsel;
116 u64 mask; 116 u64 mask;
117 117
118 *res = 0; 118 *res = 0;
@@ -271,7 +271,7 @@ intel_pt_pmu_default_config(struct perf_pmu *intel_pt_pmu)
271static const char *intel_pt_find_filter(struct perf_evlist *evlist, 271static const char *intel_pt_find_filter(struct perf_evlist *evlist,
272 struct perf_pmu *intel_pt_pmu) 272 struct perf_pmu *intel_pt_pmu)
273{ 273{
274 struct perf_evsel *evsel; 274 struct evsel *evsel;
275 275
276 evlist__for_each_entry(evlist, evsel) { 276 evlist__for_each_entry(evlist, evsel) {
277 if (evsel->attr.type == intel_pt_pmu->type) 277 if (evsel->attr.type == intel_pt_pmu->type)
@@ -401,7 +401,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
401static int intel_pt_track_switches(struct perf_evlist *evlist) 401static int intel_pt_track_switches(struct perf_evlist *evlist)
402{ 402{
403 const char *sched_switch = "sched:sched_switch"; 403 const char *sched_switch = "sched:sched_switch";
404 struct perf_evsel *evsel; 404 struct evsel *evsel;
405 int err; 405 int err;
406 406
407 if (!perf_evlist__can_select_event(evlist, sched_switch)) 407 if (!perf_evlist__can_select_event(evlist, sched_switch))
@@ -513,7 +513,7 @@ out_err:
513} 513}
514 514
515static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu, 515static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu,
516 struct perf_evsel *evsel) 516 struct evsel *evsel)
517{ 517{
518 int err; 518 int err;
519 char c; 519 char c;
@@ -556,7 +556,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
556 container_of(itr, struct intel_pt_recording, itr); 556 container_of(itr, struct intel_pt_recording, itr);
557 struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu; 557 struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu;
558 bool have_timing_info, need_immediate = false; 558 bool have_timing_info, need_immediate = false;
559 struct perf_evsel *evsel, *intel_pt_evsel = NULL; 559 struct evsel *evsel, *intel_pt_evsel = NULL;
560 const struct perf_cpu_map *cpus = evlist->cpus; 560 const struct perf_cpu_map *cpus = evlist->cpus;
561 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; 561 bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
562 u64 tsc_bit; 562 u64 tsc_bit;
@@ -685,7 +685,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
685 !target__has_task(&opts->target); 685 !target__has_task(&opts->target);
686 686
687 if (!cpu_wide && perf_can_record_cpu_wide()) { 687 if (!cpu_wide && perf_can_record_cpu_wide()) {
688 struct perf_evsel *switch_evsel; 688 struct evsel *switch_evsel;
689 689
690 err = parse_events(evlist, "dummy:u", NULL); 690 err = parse_events(evlist, "dummy:u", NULL);
691 if (err) 691 if (err)
@@ -743,7 +743,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
743 743
744 /* Add dummy event to keep tracking */ 744 /* Add dummy event to keep tracking */
745 if (opts->full_auxtrace) { 745 if (opts->full_auxtrace) {
746 struct perf_evsel *tracking_evsel; 746 struct evsel *tracking_evsel;
747 747
748 err = parse_events(evlist, "dummy:u", NULL); 748 err = parse_events(evlist, "dummy:u", NULL);
749 if (err) 749 if (err)
@@ -784,7 +784,7 @@ static int intel_pt_snapshot_start(struct auxtrace_record *itr)
784{ 784{
785 struct intel_pt_recording *ptr = 785 struct intel_pt_recording *ptr =
786 container_of(itr, struct intel_pt_recording, itr); 786 container_of(itr, struct intel_pt_recording, itr);
787 struct perf_evsel *evsel; 787 struct evsel *evsel;
788 788
789 evlist__for_each_entry(ptr->evlist, evsel) { 789 evlist__for_each_entry(ptr->evlist, evsel) {
790 if (evsel->attr.type == ptr->intel_pt_pmu->type) 790 if (evsel->attr.type == ptr->intel_pt_pmu->type)
@@ -797,7 +797,7 @@ static int intel_pt_snapshot_finish(struct auxtrace_record *itr)
797{ 797{
798 struct intel_pt_recording *ptr = 798 struct intel_pt_recording *ptr =
799 container_of(itr, struct intel_pt_recording, itr); 799 container_of(itr, struct intel_pt_recording, itr);
800 struct perf_evsel *evsel; 800 struct evsel *evsel;
801 801
802 evlist__for_each_entry(ptr->evlist, evsel) { 802 evlist__for_each_entry(ptr->evlist, evsel) {
803 if (evsel->attr.type == ptr->intel_pt_pmu->type) 803 if (evsel->attr.type == ptr->intel_pt_pmu->type)
@@ -1070,7 +1070,7 @@ static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
1070{ 1070{
1071 struct intel_pt_recording *ptr = 1071 struct intel_pt_recording *ptr =
1072 container_of(itr, struct intel_pt_recording, itr); 1072 container_of(itr, struct intel_pt_recording, itr);
1073 struct perf_evsel *evsel; 1073 struct evsel *evsel;
1074 1074
1075 evlist__for_each_entry(ptr->evlist, evsel) { 1075 evlist__for_each_entry(ptr->evlist, evsel) {
1076 if (evsel->attr.type == ptr->intel_pt_pmu->type) 1076 if (evsel->attr.type == ptr->intel_pt_pmu->type)
diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c
index 865a9762f22e..54a3f2373c35 100644
--- a/tools/perf/arch/x86/util/kvm-stat.c
+++ b/tools/perf/arch/x86/util/kvm-stat.c
@@ -27,7 +27,7 @@ const char *kvm_exit_trace = "kvm:kvm_exit";
27 * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry 27 * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry
28 * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...). 28 * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...).
29 */ 29 */
30static void mmio_event_get_key(struct perf_evsel *evsel, struct perf_sample *sample, 30static void mmio_event_get_key(struct evsel *evsel, struct perf_sample *sample,
31 struct event_key *key) 31 struct event_key *key)
32{ 32{
33 key->key = perf_evsel__intval(evsel, sample, "gpa"); 33 key->key = perf_evsel__intval(evsel, sample, "gpa");
@@ -38,7 +38,7 @@ static void mmio_event_get_key(struct perf_evsel *evsel, struct perf_sample *sam
38#define KVM_TRACE_MMIO_READ 1 38#define KVM_TRACE_MMIO_READ 1
39#define KVM_TRACE_MMIO_WRITE 2 39#define KVM_TRACE_MMIO_WRITE 2
40 40
41static bool mmio_event_begin(struct perf_evsel *evsel, 41static bool mmio_event_begin(struct evsel *evsel,
42 struct perf_sample *sample, struct event_key *key) 42 struct perf_sample *sample, struct event_key *key)
43{ 43{
44 /* MMIO read begin event in kernel. */ 44 /* MMIO read begin event in kernel. */
@@ -55,7 +55,7 @@ static bool mmio_event_begin(struct perf_evsel *evsel,
55 return false; 55 return false;
56} 56}
57 57
58static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, 58static bool mmio_event_end(struct evsel *evsel, struct perf_sample *sample,
59 struct event_key *key) 59 struct event_key *key)
60{ 60{
61 /* MMIO write end event in kernel. */ 61 /* MMIO write end event in kernel. */
@@ -89,7 +89,7 @@ static struct kvm_events_ops mmio_events = {
89}; 89};
90 90
91 /* The time of emulation pio access is from kvm_pio to kvm_entry. */ 91 /* The time of emulation pio access is from kvm_pio to kvm_entry. */
92static void ioport_event_get_key(struct perf_evsel *evsel, 92static void ioport_event_get_key(struct evsel *evsel,
93 struct perf_sample *sample, 93 struct perf_sample *sample,
94 struct event_key *key) 94 struct event_key *key)
95{ 95{
@@ -97,7 +97,7 @@ static void ioport_event_get_key(struct perf_evsel *evsel,
97 key->info = perf_evsel__intval(evsel, sample, "rw"); 97 key->info = perf_evsel__intval(evsel, sample, "rw");
98} 98}
99 99
100static bool ioport_event_begin(struct perf_evsel *evsel, 100static bool ioport_event_begin(struct evsel *evsel,
101 struct perf_sample *sample, 101 struct perf_sample *sample,
102 struct event_key *key) 102 struct event_key *key)
103{ 103{
@@ -109,7 +109,7 @@ static bool ioport_event_begin(struct perf_evsel *evsel,
109 return false; 109 return false;
110} 110}
111 111
112static bool ioport_event_end(struct perf_evsel *evsel, 112static bool ioport_event_end(struct evsel *evsel,
113 struct perf_sample *sample __maybe_unused, 113 struct perf_sample *sample __maybe_unused,
114 struct event_key *key __maybe_unused) 114 struct event_key *key __maybe_unused)
115{ 115{
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index e0aa14faf2b5..9bb637165bf9 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -156,7 +156,7 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
156 struct hist_entry *he = iter->he; 156 struct hist_entry *he = iter->he;
157 struct branch_info *bi; 157 struct branch_info *bi;
158 struct perf_sample *sample = iter->sample; 158 struct perf_sample *sample = iter->sample;
159 struct perf_evsel *evsel = iter->evsel; 159 struct evsel *evsel = iter->evsel;
160 int err; 160 int err;
161 161
162 bi = he->branch_info; 162 bi = he->branch_info;
@@ -171,7 +171,7 @@ out:
171 return err; 171 return err;
172} 172}
173 173
174static int process_branch_callback(struct perf_evsel *evsel, 174static int process_branch_callback(struct evsel *evsel,
175 struct perf_sample *sample, 175 struct perf_sample *sample,
176 struct addr_location *al __maybe_unused, 176 struct addr_location *al __maybe_unused,
177 struct perf_annotate *ann, 177 struct perf_annotate *ann,
@@ -208,7 +208,7 @@ static bool has_annotation(struct perf_annotate *ann)
208 return ui__has_annotation() || ann->use_stdio2; 208 return ui__has_annotation() || ann->use_stdio2;
209} 209}
210 210
211static int perf_evsel__add_sample(struct perf_evsel *evsel, 211static int perf_evsel__add_sample(struct evsel *evsel,
212 struct perf_sample *sample, 212 struct perf_sample *sample,
213 struct addr_location *al, 213 struct addr_location *al,
214 struct perf_annotate *ann, 214 struct perf_annotate *ann,
@@ -257,7 +257,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
257static int process_sample_event(struct perf_tool *tool, 257static int process_sample_event(struct perf_tool *tool,
258 union perf_event *event, 258 union perf_event *event,
259 struct perf_sample *sample, 259 struct perf_sample *sample,
260 struct perf_evsel *evsel, 260 struct evsel *evsel,
261 struct machine *machine) 261 struct machine *machine)
262{ 262{
263 struct perf_annotate *ann = container_of(tool, struct perf_annotate, tool); 263 struct perf_annotate *ann = container_of(tool, struct perf_annotate, tool);
@@ -293,7 +293,7 @@ static int process_feature_event(struct perf_session *session,
293} 293}
294 294
295static int hist_entry__tty_annotate(struct hist_entry *he, 295static int hist_entry__tty_annotate(struct hist_entry *he,
296 struct perf_evsel *evsel, 296 struct evsel *evsel,
297 struct perf_annotate *ann) 297 struct perf_annotate *ann)
298{ 298{
299 if (!ann->use_stdio2) 299 if (!ann->use_stdio2)
@@ -303,7 +303,7 @@ static int hist_entry__tty_annotate(struct hist_entry *he,
303} 303}
304 304
305static void hists__find_annotations(struct hists *hists, 305static void hists__find_annotations(struct hists *hists,
306 struct perf_evsel *evsel, 306 struct evsel *evsel,
307 struct perf_annotate *ann) 307 struct perf_annotate *ann)
308{ 308{
309 struct rb_node *nd = rb_first_cached(&hists->entries), *next; 309 struct rb_node *nd = rb_first_cached(&hists->entries), *next;
@@ -333,7 +333,7 @@ find_next:
333 if (use_browser == 2) { 333 if (use_browser == 2) {
334 int ret; 334 int ret;
335 int (*annotate)(struct hist_entry *he, 335 int (*annotate)(struct hist_entry *he,
336 struct perf_evsel *evsel, 336 struct evsel *evsel,
337 struct hist_browser_timer *hbt); 337 struct hist_browser_timer *hbt);
338 338
339 annotate = dlsym(perf_gtk_handle, 339 annotate = dlsym(perf_gtk_handle,
@@ -387,7 +387,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
387{ 387{
388 int ret; 388 int ret;
389 struct perf_session *session = ann->session; 389 struct perf_session *session = ann->session;
390 struct perf_evsel *pos; 390 struct evsel *pos;
391 u64 total_nr_samples; 391 u64 total_nr_samples;
392 392
393 if (ann->cpu_list) { 393 if (ann->cpu_list) {
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 52035dacf253..d251a486f329 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -248,7 +248,7 @@ static void compute_stats(struct c2c_hist_entry *c2c_he,
248static int process_sample_event(struct perf_tool *tool __maybe_unused, 248static int process_sample_event(struct perf_tool *tool __maybe_unused,
249 union perf_event *event, 249 union perf_event *event,
250 struct perf_sample *sample, 250 struct perf_sample *sample,
251 struct perf_evsel *evsel, 251 struct evsel *evsel,
252 struct machine *machine) 252 struct machine *machine)
253{ 253{
254 struct c2c_hists *c2c_hists = &c2c.hists; 254 struct c2c_hists *c2c_hists = &c2c.hists;
@@ -2237,7 +2237,7 @@ static void print_pareto(FILE *out)
2237static void print_c2c_info(FILE *out, struct perf_session *session) 2237static void print_c2c_info(FILE *out, struct perf_session *session)
2238{ 2238{
2239 struct perf_evlist *evlist = session->evlist; 2239 struct perf_evlist *evlist = session->evlist;
2240 struct perf_evsel *evsel; 2240 struct evsel *evsel;
2241 bool first = true; 2241 bool first = true;
2242 2242
2243 fprintf(out, "=================================================\n"); 2243 fprintf(out, "=================================================\n");
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index f6f5dd15bea7..c3b4b8196e00 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -376,7 +376,7 @@ struct hist_entry_ops block_hist_ops = {
376static int diff__process_sample_event(struct perf_tool *tool, 376static int diff__process_sample_event(struct perf_tool *tool,
377 union perf_event *event, 377 union perf_event *event,
378 struct perf_sample *sample, 378 struct perf_sample *sample,
379 struct perf_evsel *evsel, 379 struct evsel *evsel,
380 struct machine *machine) 380 struct machine *machine)
381{ 381{
382 struct perf_diff *pdiff = container_of(tool, struct perf_diff, tool); 382 struct perf_diff *pdiff = container_of(tool, struct perf_diff, tool);
@@ -448,10 +448,10 @@ static struct perf_diff pdiff = {
448 }, 448 },
449}; 449};
450 450
451static struct perf_evsel *evsel_match(struct perf_evsel *evsel, 451static struct evsel *evsel_match(struct evsel *evsel,
452 struct perf_evlist *evlist) 452 struct perf_evlist *evlist)
453{ 453{
454 struct perf_evsel *e; 454 struct evsel *e;
455 455
456 evlist__for_each_entry(evlist, e) { 456 evlist__for_each_entry(evlist, e) {
457 if (perf_evsel__match2(evsel, e)) 457 if (perf_evsel__match2(evsel, e))
@@ -463,7 +463,7 @@ static struct perf_evsel *evsel_match(struct perf_evsel *evsel,
463 463
464static void perf_evlist__collapse_resort(struct perf_evlist *evlist) 464static void perf_evlist__collapse_resort(struct perf_evlist *evlist)
465{ 465{
466 struct perf_evsel *evsel; 466 struct evsel *evsel;
467 467
468 evlist__for_each_entry(evlist, evsel) { 468 evlist__for_each_entry(evlist, evsel) {
469 struct hists *hists = evsel__hists(evsel); 469 struct hists *hists = evsel__hists(evsel);
@@ -1010,7 +1010,7 @@ static void data__fprintf(void)
1010static void data_process(void) 1010static void data_process(void)
1011{ 1011{
1012 struct perf_evlist *evlist_base = data__files[0].session->evlist; 1012 struct perf_evlist *evlist_base = data__files[0].session->evlist;
1013 struct perf_evsel *evsel_base; 1013 struct evsel *evsel_base;
1014 bool first = true; 1014 bool first = true;
1015 1015
1016 evlist__for_each_entry(evlist_base, evsel_base) { 1016 evlist__for_each_entry(evlist_base, evsel_base) {
@@ -1020,7 +1020,7 @@ static void data_process(void)
1020 1020
1021 data__for_each_file_new(i, d) { 1021 data__for_each_file_new(i, d) {
1022 struct perf_evlist *evlist = d->session->evlist; 1022 struct perf_evlist *evlist = d->session->evlist;
1023 struct perf_evsel *evsel; 1023 struct evsel *evsel;
1024 struct hists *hists; 1024 struct hists *hists;
1025 1025
1026 evsel = evsel_match(evsel_base, evlist); 1026 evsel = evsel_match(evsel_base, evlist);
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index 6e4f63b0da4a..e4cb61dc6315 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -21,7 +21,7 @@
21static int __cmd_evlist(const char *file_name, struct perf_attr_details *details) 21static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
22{ 22{
23 struct perf_session *session; 23 struct perf_session *session;
24 struct perf_evsel *pos; 24 struct evsel *pos;
25 struct perf_data data = { 25 struct perf_data data = {
26 .path = file_name, 26 .path = file_name,
27 .mode = PERF_DATA_MODE_READ, 27 .mode = PERF_DATA_MODE_READ,
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index f4591a1438b4..646a1bf790fc 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -215,13 +215,13 @@ static int perf_event__drop_aux(struct perf_tool *tool,
215typedef int (*inject_handler)(struct perf_tool *tool, 215typedef int (*inject_handler)(struct perf_tool *tool,
216 union perf_event *event, 216 union perf_event *event,
217 struct perf_sample *sample, 217 struct perf_sample *sample,
218 struct perf_evsel *evsel, 218 struct evsel *evsel,
219 struct machine *machine); 219 struct machine *machine);
220 220
221static int perf_event__repipe_sample(struct perf_tool *tool, 221static int perf_event__repipe_sample(struct perf_tool *tool,
222 union perf_event *event, 222 union perf_event *event,
223 struct perf_sample *sample, 223 struct perf_sample *sample,
224 struct perf_evsel *evsel, 224 struct evsel *evsel,
225 struct machine *machine) 225 struct machine *machine)
226{ 226{
227 if (evsel && evsel->handler) { 227 if (evsel && evsel->handler) {
@@ -424,7 +424,7 @@ static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
424static int perf_event__inject_buildid(struct perf_tool *tool, 424static int perf_event__inject_buildid(struct perf_tool *tool,
425 union perf_event *event, 425 union perf_event *event,
426 struct perf_sample *sample, 426 struct perf_sample *sample,
427 struct perf_evsel *evsel __maybe_unused, 427 struct evsel *evsel __maybe_unused,
428 struct machine *machine) 428 struct machine *machine)
429{ 429{
430 struct addr_location al; 430 struct addr_location al;
@@ -465,7 +465,7 @@ repipe:
465static int perf_inject__sched_process_exit(struct perf_tool *tool, 465static int perf_inject__sched_process_exit(struct perf_tool *tool,
466 union perf_event *event __maybe_unused, 466 union perf_event *event __maybe_unused,
467 struct perf_sample *sample, 467 struct perf_sample *sample,
468 struct perf_evsel *evsel __maybe_unused, 468 struct evsel *evsel __maybe_unused,
469 struct machine *machine __maybe_unused) 469 struct machine *machine __maybe_unused)
470{ 470{
471 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); 471 struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
@@ -485,7 +485,7 @@ static int perf_inject__sched_process_exit(struct perf_tool *tool,
485static int perf_inject__sched_switch(struct perf_tool *tool, 485static int perf_inject__sched_switch(struct perf_tool *tool,
486 union perf_event *event, 486 union perf_event *event,
487 struct perf_sample *sample, 487 struct perf_sample *sample,
488 struct perf_evsel *evsel, 488 struct evsel *evsel,
489 struct machine *machine) 489 struct machine *machine)
490{ 490{
491 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); 491 struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
@@ -509,7 +509,7 @@ static int perf_inject__sched_switch(struct perf_tool *tool,
509static int perf_inject__sched_stat(struct perf_tool *tool, 509static int perf_inject__sched_stat(struct perf_tool *tool,
510 union perf_event *event __maybe_unused, 510 union perf_event *event __maybe_unused,
511 struct perf_sample *sample, 511 struct perf_sample *sample,
512 struct perf_evsel *evsel, 512 struct evsel *evsel,
513 struct machine *machine) 513 struct machine *machine)
514{ 514{
515 struct event_entry *ent; 515 struct event_entry *ent;
@@ -541,7 +541,7 @@ static void sig_handler(int sig __maybe_unused)
541 session_done = 1; 541 session_done = 1;
542} 542}
543 543
544static int perf_evsel__check_stype(struct perf_evsel *evsel, 544static int perf_evsel__check_stype(struct evsel *evsel,
545 u64 sample_type, const char *sample_msg) 545 u64 sample_type, const char *sample_msg)
546{ 546{
547 struct perf_event_attr *attr = &evsel->attr; 547 struct perf_event_attr *attr = &evsel->attr;
@@ -559,7 +559,7 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel,
559static int drop_sample(struct perf_tool *tool __maybe_unused, 559static int drop_sample(struct perf_tool *tool __maybe_unused,
560 union perf_event *event __maybe_unused, 560 union perf_event *event __maybe_unused,
561 struct perf_sample *sample __maybe_unused, 561 struct perf_sample *sample __maybe_unused,
562 struct perf_evsel *evsel __maybe_unused, 562 struct evsel *evsel __maybe_unused,
563 struct machine *machine __maybe_unused) 563 struct machine *machine __maybe_unused)
564{ 564{
565 return 0; 565 return 0;
@@ -568,7 +568,7 @@ static int drop_sample(struct perf_tool *tool __maybe_unused,
568static void strip_init(struct perf_inject *inject) 568static void strip_init(struct perf_inject *inject)
569{ 569{
570 struct perf_evlist *evlist = inject->session->evlist; 570 struct perf_evlist *evlist = inject->session->evlist;
571 struct perf_evsel *evsel; 571 struct evsel *evsel;
572 572
573 inject->tool.context_switch = perf_event__drop; 573 inject->tool.context_switch = perf_event__drop;
574 574
@@ -576,7 +576,7 @@ static void strip_init(struct perf_inject *inject)
576 evsel->handler = drop_sample; 576 evsel->handler = drop_sample;
577} 577}
578 578
579static bool has_tracking(struct perf_evsel *evsel) 579static bool has_tracking(struct evsel *evsel)
580{ 580{
581 return evsel->attr.mmap || evsel->attr.mmap2 || evsel->attr.comm || 581 return evsel->attr.mmap || evsel->attr.mmap2 || evsel->attr.comm ||
582 evsel->attr.task; 582 evsel->attr.task;
@@ -591,9 +591,9 @@ static bool has_tracking(struct perf_evsel *evsel)
591 * and it has a compatible sample type. 591 * and it has a compatible sample type.
592 */ 592 */
593static bool ok_to_remove(struct perf_evlist *evlist, 593static bool ok_to_remove(struct perf_evlist *evlist,
594 struct perf_evsel *evsel_to_remove) 594 struct evsel *evsel_to_remove)
595{ 595{
596 struct perf_evsel *evsel; 596 struct evsel *evsel;
597 int cnt = 0; 597 int cnt = 0;
598 bool ok = false; 598 bool ok = false;
599 599
@@ -615,7 +615,7 @@ static bool ok_to_remove(struct perf_evlist *evlist,
615static void strip_fini(struct perf_inject *inject) 615static void strip_fini(struct perf_inject *inject)
616{ 616{
617 struct perf_evlist *evlist = inject->session->evlist; 617 struct perf_evlist *evlist = inject->session->evlist;
618 struct perf_evsel *evsel, *tmp; 618 struct evsel *evsel, *tmp;
619 619
620 /* Remove non-synthesized evsels if possible */ 620 /* Remove non-synthesized evsels if possible */
621 evlist__for_each_entry_safe(evlist, tmp, evsel) { 621 evlist__for_each_entry_safe(evlist, tmp, evsel) {
@@ -651,7 +651,7 @@ static int __cmd_inject(struct perf_inject *inject)
651 if (inject->build_ids) { 651 if (inject->build_ids) {
652 inject->tool.sample = perf_event__inject_buildid; 652 inject->tool.sample = perf_event__inject_buildid;
653 } else if (inject->sched_stat) { 653 } else if (inject->sched_stat) {
654 struct perf_evsel *evsel; 654 struct evsel *evsel;
655 655
656 evlist__for_each_entry(session->evlist, evsel) { 656 evlist__for_each_entry(session->evlist, evsel) {
657 const char *name = perf_evsel__name(evsel); 657 const char *name = perf_evsel__name(evsel);
@@ -712,7 +712,7 @@ static int __cmd_inject(struct perf_inject *inject)
712 * remove the evsel. 712 * remove the evsel.
713 */ 713 */
714 if (inject->itrace_synth_opts.set) { 714 if (inject->itrace_synth_opts.set) {
715 struct perf_evsel *evsel; 715 struct evsel *evsel;
716 716
717 perf_header__clear_feat(&session->header, 717 perf_header__clear_feat(&session->header,
718 HEADER_AUXTRACE); 718 HEADER_AUXTRACE);
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 9e5e60898083..46f828936120 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -166,7 +166,7 @@ static int insert_caller_stat(unsigned long call_site,
166 return 0; 166 return 0;
167} 167}
168 168
169static int perf_evsel__process_alloc_event(struct perf_evsel *evsel, 169static int perf_evsel__process_alloc_event(struct evsel *evsel,
170 struct perf_sample *sample) 170 struct perf_sample *sample)
171{ 171{
172 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"), 172 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"),
@@ -185,7 +185,7 @@ static int perf_evsel__process_alloc_event(struct perf_evsel *evsel,
185 return 0; 185 return 0;
186} 186}
187 187
188static int perf_evsel__process_alloc_node_event(struct perf_evsel *evsel, 188static int perf_evsel__process_alloc_node_event(struct evsel *evsel,
189 struct perf_sample *sample) 189 struct perf_sample *sample)
190{ 190{
191 int ret = perf_evsel__process_alloc_event(evsel, sample); 191 int ret = perf_evsel__process_alloc_event(evsel, sample);
@@ -229,7 +229,7 @@ static struct alloc_stat *search_alloc_stat(unsigned long ptr,
229 return NULL; 229 return NULL;
230} 230}
231 231
232static int perf_evsel__process_free_event(struct perf_evsel *evsel, 232static int perf_evsel__process_free_event(struct evsel *evsel,
233 struct perf_sample *sample) 233 struct perf_sample *sample)
234{ 234{
235 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr"); 235 unsigned long ptr = perf_evsel__intval(evsel, sample, "ptr");
@@ -381,7 +381,7 @@ static int build_alloc_func_list(void)
381 * Find first non-memory allocation function from callchain. 381 * Find first non-memory allocation function from callchain.
382 * The allocation functions are in the 'alloc_func_list'. 382 * The allocation functions are in the 'alloc_func_list'.
383 */ 383 */
384static u64 find_callsite(struct perf_evsel *evsel, struct perf_sample *sample) 384static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
385{ 385{
386 struct addr_location al; 386 struct addr_location al;
387 struct machine *machine = &kmem_session->machines.host; 387 struct machine *machine = &kmem_session->machines.host;
@@ -728,7 +728,7 @@ static char *compact_gfp_string(unsigned long gfp_flags)
728 return NULL; 728 return NULL;
729} 729}
730 730
731static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample, 731static int parse_gfp_flags(struct evsel *evsel, struct perf_sample *sample,
732 unsigned int gfp_flags) 732 unsigned int gfp_flags)
733{ 733{
734 struct tep_record record = { 734 struct tep_record record = {
@@ -779,7 +779,7 @@ static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample,
779 return 0; 779 return 0;
780} 780}
781 781
782static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel, 782static int perf_evsel__process_page_alloc_event(struct evsel *evsel,
783 struct perf_sample *sample) 783 struct perf_sample *sample)
784{ 784{
785 u64 page; 785 u64 page;
@@ -852,7 +852,7 @@ static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel,
852 return 0; 852 return 0;
853} 853}
854 854
855static int perf_evsel__process_page_free_event(struct perf_evsel *evsel, 855static int perf_evsel__process_page_free_event(struct evsel *evsel,
856 struct perf_sample *sample) 856 struct perf_sample *sample)
857{ 857{
858 u64 page; 858 u64 page;
@@ -930,13 +930,13 @@ static bool perf_kmem__skip_sample(struct perf_sample *sample)
930 return false; 930 return false;
931} 931}
932 932
933typedef int (*tracepoint_handler)(struct perf_evsel *evsel, 933typedef int (*tracepoint_handler)(struct evsel *evsel,
934 struct perf_sample *sample); 934 struct perf_sample *sample);
935 935
936static int process_sample_event(struct perf_tool *tool __maybe_unused, 936static int process_sample_event(struct perf_tool *tool __maybe_unused,
937 union perf_event *event, 937 union perf_event *event,
938 struct perf_sample *sample, 938 struct perf_sample *sample,
939 struct perf_evsel *evsel, 939 struct evsel *evsel,
940 struct machine *machine) 940 struct machine *machine)
941{ 941{
942 int err = 0; 942 int err = 0;
@@ -1363,8 +1363,8 @@ static void sort_result(void)
1363static int __cmd_kmem(struct perf_session *session) 1363static int __cmd_kmem(struct perf_session *session)
1364{ 1364{
1365 int err = -EINVAL; 1365 int err = -EINVAL;
1366 struct perf_evsel *evsel; 1366 struct evsel *evsel;
1367 const struct perf_evsel_str_handler kmem_tracepoints[] = { 1367 const struct evsel_str_handler kmem_tracepoints[] = {
1368 /* slab allocator */ 1368 /* slab allocator */
1369 { "kmem:kmalloc", perf_evsel__process_alloc_event, }, 1369 { "kmem:kmalloc", perf_evsel__process_alloc_event, },
1370 { "kmem:kmem_cache_alloc", perf_evsel__process_alloc_event, }, 1370 { "kmem:kmem_cache_alloc", perf_evsel__process_alloc_event, },
@@ -1967,7 +1967,7 @@ int cmd_kmem(int argc, const char **argv)
1967 } 1967 }
1968 1968
1969 if (kmem_page) { 1969 if (kmem_page) {
1970 struct perf_evsel *evsel; 1970 struct evsel *evsel;
1971 1971
1972 evsel = perf_evlist__find_tracepoint_by_name(session->evlist, 1972 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
1973 "kmem:mm_page_alloc"); 1973 "kmem:mm_page_alloc");
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index b33c83489120..cf8f27d05296 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -57,7 +57,7 @@ static const char *get_filename_for_perf_kvm(void)
57#ifdef HAVE_KVM_STAT_SUPPORT 57#ifdef HAVE_KVM_STAT_SUPPORT
58#include "util/kvm-stat.h" 58#include "util/kvm-stat.h"
59 59
60void exit_event_get_key(struct perf_evsel *evsel, 60void exit_event_get_key(struct evsel *evsel,
61 struct perf_sample *sample, 61 struct perf_sample *sample,
62 struct event_key *key) 62 struct event_key *key)
63{ 63{
@@ -65,12 +65,12 @@ void exit_event_get_key(struct perf_evsel *evsel,
65 key->key = perf_evsel__intval(evsel, sample, kvm_exit_reason); 65 key->key = perf_evsel__intval(evsel, sample, kvm_exit_reason);
66} 66}
67 67
68bool kvm_exit_event(struct perf_evsel *evsel) 68bool kvm_exit_event(struct evsel *evsel)
69{ 69{
70 return !strcmp(evsel->name, kvm_exit_trace); 70 return !strcmp(evsel->name, kvm_exit_trace);
71} 71}
72 72
73bool exit_event_begin(struct perf_evsel *evsel, 73bool exit_event_begin(struct evsel *evsel,
74 struct perf_sample *sample, struct event_key *key) 74 struct perf_sample *sample, struct event_key *key)
75{ 75{
76 if (kvm_exit_event(evsel)) { 76 if (kvm_exit_event(evsel)) {
@@ -81,12 +81,12 @@ bool exit_event_begin(struct perf_evsel *evsel,
81 return false; 81 return false;
82} 82}
83 83
84bool kvm_entry_event(struct perf_evsel *evsel) 84bool kvm_entry_event(struct evsel *evsel)
85{ 85{
86 return !strcmp(evsel->name, kvm_entry_trace); 86 return !strcmp(evsel->name, kvm_entry_trace);
87} 87}
88 88
89bool exit_event_end(struct perf_evsel *evsel, 89bool exit_event_end(struct evsel *evsel,
90 struct perf_sample *sample __maybe_unused, 90 struct perf_sample *sample __maybe_unused,
91 struct event_key *key __maybe_unused) 91 struct event_key *key __maybe_unused)
92{ 92{
@@ -286,7 +286,7 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id,
286} 286}
287 287
288static bool is_child_event(struct perf_kvm_stat *kvm, 288static bool is_child_event(struct perf_kvm_stat *kvm,
289 struct perf_evsel *evsel, 289 struct evsel *evsel,
290 struct perf_sample *sample, 290 struct perf_sample *sample,
291 struct event_key *key) 291 struct event_key *key)
292{ 292{
@@ -396,7 +396,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
396 396
397static 397static
398struct vcpu_event_record *per_vcpu_record(struct thread *thread, 398struct vcpu_event_record *per_vcpu_record(struct thread *thread,
399 struct perf_evsel *evsel, 399 struct evsel *evsel,
400 struct perf_sample *sample) 400 struct perf_sample *sample)
401{ 401{
402 /* Only kvm_entry records vcpu id. */ 402 /* Only kvm_entry records vcpu id. */
@@ -419,7 +419,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread,
419 419
420static bool handle_kvm_event(struct perf_kvm_stat *kvm, 420static bool handle_kvm_event(struct perf_kvm_stat *kvm,
421 struct thread *thread, 421 struct thread *thread,
422 struct perf_evsel *evsel, 422 struct evsel *evsel,
423 struct perf_sample *sample) 423 struct perf_sample *sample)
424{ 424{
425 struct vcpu_event_record *vcpu_record; 425 struct vcpu_event_record *vcpu_record;
@@ -672,7 +672,7 @@ static bool skip_sample(struct perf_kvm_stat *kvm,
672static int process_sample_event(struct perf_tool *tool, 672static int process_sample_event(struct perf_tool *tool,
673 union perf_event *event, 673 union perf_event *event,
674 struct perf_sample *sample, 674 struct perf_sample *sample,
675 struct perf_evsel *evsel, 675 struct evsel *evsel,
676 struct machine *machine) 676 struct machine *machine)
677{ 677{
678 int err = 0; 678 int err = 0;
@@ -1011,7 +1011,7 @@ out:
1011static int kvm_live_open_events(struct perf_kvm_stat *kvm) 1011static int kvm_live_open_events(struct perf_kvm_stat *kvm)
1012{ 1012{
1013 int err, rc = -1; 1013 int err, rc = -1;
1014 struct perf_evsel *pos; 1014 struct evsel *pos;
1015 struct perf_evlist *evlist = kvm->evlist; 1015 struct perf_evlist *evlist = kvm->evlist;
1016 char sbuf[STRERR_BUFSIZE]; 1016 char sbuf[STRERR_BUFSIZE];
1017 1017
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 574e30ec6d7c..38500bff4423 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -347,16 +347,16 @@ alloc_failed:
347} 347}
348 348
349struct trace_lock_handler { 349struct trace_lock_handler {
350 int (*acquire_event)(struct perf_evsel *evsel, 350 int (*acquire_event)(struct evsel *evsel,
351 struct perf_sample *sample); 351 struct perf_sample *sample);
352 352
353 int (*acquired_event)(struct perf_evsel *evsel, 353 int (*acquired_event)(struct evsel *evsel,
354 struct perf_sample *sample); 354 struct perf_sample *sample);
355 355
356 int (*contended_event)(struct perf_evsel *evsel, 356 int (*contended_event)(struct evsel *evsel,
357 struct perf_sample *sample); 357 struct perf_sample *sample);
358 358
359 int (*release_event)(struct perf_evsel *evsel, 359 int (*release_event)(struct evsel *evsel,
360 struct perf_sample *sample); 360 struct perf_sample *sample);
361}; 361};
362 362
@@ -396,7 +396,7 @@ enum acquire_flags {
396 READ_LOCK = 2, 396 READ_LOCK = 2,
397}; 397};
398 398
399static int report_lock_acquire_event(struct perf_evsel *evsel, 399static int report_lock_acquire_event(struct evsel *evsel,
400 struct perf_sample *sample) 400 struct perf_sample *sample)
401{ 401{
402 void *addr; 402 void *addr;
@@ -468,7 +468,7 @@ end:
468 return 0; 468 return 0;
469} 469}
470 470
471static int report_lock_acquired_event(struct perf_evsel *evsel, 471static int report_lock_acquired_event(struct evsel *evsel,
472 struct perf_sample *sample) 472 struct perf_sample *sample)
473{ 473{
474 void *addr; 474 void *addr;
@@ -531,7 +531,7 @@ end:
531 return 0; 531 return 0;
532} 532}
533 533
534static int report_lock_contended_event(struct perf_evsel *evsel, 534static int report_lock_contended_event(struct evsel *evsel,
535 struct perf_sample *sample) 535 struct perf_sample *sample)
536{ 536{
537 void *addr; 537 void *addr;
@@ -586,7 +586,7 @@ end:
586 return 0; 586 return 0;
587} 587}
588 588
589static int report_lock_release_event(struct perf_evsel *evsel, 589static int report_lock_release_event(struct evsel *evsel,
590 struct perf_sample *sample) 590 struct perf_sample *sample)
591{ 591{
592 void *addr; 592 void *addr;
@@ -656,7 +656,7 @@ static struct trace_lock_handler report_lock_ops = {
656 656
657static struct trace_lock_handler *trace_handler; 657static struct trace_lock_handler *trace_handler;
658 658
659static int perf_evsel__process_lock_acquire(struct perf_evsel *evsel, 659static int perf_evsel__process_lock_acquire(struct evsel *evsel,
660 struct perf_sample *sample) 660 struct perf_sample *sample)
661{ 661{
662 if (trace_handler->acquire_event) 662 if (trace_handler->acquire_event)
@@ -664,7 +664,7 @@ static int perf_evsel__process_lock_acquire(struct perf_evsel *evsel,
664 return 0; 664 return 0;
665} 665}
666 666
667static int perf_evsel__process_lock_acquired(struct perf_evsel *evsel, 667static int perf_evsel__process_lock_acquired(struct evsel *evsel,
668 struct perf_sample *sample) 668 struct perf_sample *sample)
669{ 669{
670 if (trace_handler->acquired_event) 670 if (trace_handler->acquired_event)
@@ -672,7 +672,7 @@ static int perf_evsel__process_lock_acquired(struct perf_evsel *evsel,
672 return 0; 672 return 0;
673} 673}
674 674
675static int perf_evsel__process_lock_contended(struct perf_evsel *evsel, 675static int perf_evsel__process_lock_contended(struct evsel *evsel,
676 struct perf_sample *sample) 676 struct perf_sample *sample)
677{ 677{
678 if (trace_handler->contended_event) 678 if (trace_handler->contended_event)
@@ -680,7 +680,7 @@ static int perf_evsel__process_lock_contended(struct perf_evsel *evsel,
680 return 0; 680 return 0;
681} 681}
682 682
683static int perf_evsel__process_lock_release(struct perf_evsel *evsel, 683static int perf_evsel__process_lock_release(struct evsel *evsel,
684 struct perf_sample *sample) 684 struct perf_sample *sample)
685{ 685{
686 if (trace_handler->release_event) 686 if (trace_handler->release_event)
@@ -806,13 +806,13 @@ static int dump_info(void)
806 return rc; 806 return rc;
807} 807}
808 808
809typedef int (*tracepoint_handler)(struct perf_evsel *evsel, 809typedef int (*tracepoint_handler)(struct evsel *evsel,
810 struct perf_sample *sample); 810 struct perf_sample *sample);
811 811
812static int process_sample_event(struct perf_tool *tool __maybe_unused, 812static int process_sample_event(struct perf_tool *tool __maybe_unused,
813 union perf_event *event, 813 union perf_event *event,
814 struct perf_sample *sample, 814 struct perf_sample *sample,
815 struct perf_evsel *evsel, 815 struct evsel *evsel,
816 struct machine *machine) 816 struct machine *machine)
817{ 817{
818 int err = 0; 818 int err = 0;
@@ -847,7 +847,7 @@ static void sort_result(void)
847 } 847 }
848} 848}
849 849
850static const struct perf_evsel_str_handler lock_tracepoints[] = { 850static const struct evsel_str_handler lock_tracepoints[] = {
851 { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */ 851 { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */
852 { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ 852 { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */
853 { "lock:lock_contended", perf_evsel__process_lock_contended, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ 853 { "lock:lock_contended", perf_evsel__process_lock_contended, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index f45c8b502f63..9e60eda9297d 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -230,7 +230,7 @@ out_put:
230static int process_sample_event(struct perf_tool *tool, 230static int process_sample_event(struct perf_tool *tool,
231 union perf_event *event, 231 union perf_event *event,
232 struct perf_sample *sample, 232 struct perf_sample *sample,
233 struct perf_evsel *evsel __maybe_unused, 233 struct evsel *evsel __maybe_unused,
234 struct machine *machine) 234 struct machine *machine)
235{ 235{
236 return dump_raw_samples(tool, event, sample, machine); 236 return dump_raw_samples(tool, event, sample, machine);
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bcfc16450608..7ba3a2c32e54 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -713,7 +713,7 @@ static int record__mmap(struct record *rec)
713static int record__open(struct record *rec) 713static int record__open(struct record *rec)
714{ 714{
715 char msg[BUFSIZ]; 715 char msg[BUFSIZ];
716 struct perf_evsel *pos; 716 struct evsel *pos;
717 struct perf_evlist *evlist = rec->evlist; 717 struct perf_evlist *evlist = rec->evlist;
718 struct perf_session *session = rec->session; 718 struct perf_session *session = rec->session;
719 struct record_opts *opts = &rec->opts; 719 struct record_opts *opts = &rec->opts;
@@ -782,7 +782,7 @@ out:
782static int process_sample_event(struct perf_tool *tool, 782static int process_sample_event(struct perf_tool *tool,
783 union perf_event *event, 783 union perf_event *event,
784 struct perf_sample *sample, 784 struct perf_sample *sample,
785 struct perf_evsel *evsel, 785 struct evsel *evsel,
786 struct machine *machine) 786 struct machine *machine)
787{ 787{
788 struct record *rec = container_of(tool, struct record, tool); 788 struct record *rec = container_of(tool, struct record, tool);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index abf0b9b8f566..96a506f0d4c1 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -128,7 +128,7 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
128 int err = 0; 128 int err = 0;
129 struct report *rep = arg; 129 struct report *rep = arg;
130 struct hist_entry *he = iter->he; 130 struct hist_entry *he = iter->he;
131 struct perf_evsel *evsel = iter->evsel; 131 struct evsel *evsel = iter->evsel;
132 struct perf_sample *sample = iter->sample; 132 struct perf_sample *sample = iter->sample;
133 struct mem_info *mi; 133 struct mem_info *mi;
134 struct branch_info *bi; 134 struct branch_info *bi;
@@ -172,7 +172,7 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
172 struct report *rep = arg; 172 struct report *rep = arg;
173 struct branch_info *bi; 173 struct branch_info *bi;
174 struct perf_sample *sample = iter->sample; 174 struct perf_sample *sample = iter->sample;
175 struct perf_evsel *evsel = iter->evsel; 175 struct evsel *evsel = iter->evsel;
176 int err; 176 int err;
177 177
178 if (!ui__has_annotation() && !rep->symbol_ipc) 178 if (!ui__has_annotation() && !rep->symbol_ipc)
@@ -225,7 +225,7 @@ static int process_feature_event(struct perf_session *session,
225static int process_sample_event(struct perf_tool *tool, 225static int process_sample_event(struct perf_tool *tool,
226 union perf_event *event, 226 union perf_event *event,
227 struct perf_sample *sample, 227 struct perf_sample *sample,
228 struct perf_evsel *evsel, 228 struct evsel *evsel,
229 struct machine *machine) 229 struct machine *machine)
230{ 230{
231 struct report *rep = container_of(tool, struct report, tool); 231 struct report *rep = container_of(tool, struct report, tool);
@@ -292,7 +292,7 @@ out_put:
292static int process_read_event(struct perf_tool *tool, 292static int process_read_event(struct perf_tool *tool,
293 union perf_event *event, 293 union perf_event *event,
294 struct perf_sample *sample __maybe_unused, 294 struct perf_sample *sample __maybe_unused,
295 struct perf_evsel *evsel, 295 struct evsel *evsel,
296 struct machine *machine __maybe_unused) 296 struct machine *machine __maybe_unused)
297{ 297{
298 struct report *rep = container_of(tool, struct report, tool); 298 struct report *rep = container_of(tool, struct report, tool);
@@ -400,7 +400,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
400 char unit; 400 char unit;
401 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 401 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
402 u64 nr_events = hists->stats.total_period; 402 u64 nr_events = hists->stats.total_period;
403 struct perf_evsel *evsel = hists_to_evsel(hists); 403 struct evsel *evsel = hists_to_evsel(hists);
404 char buf[512]; 404 char buf[512];
405 size_t size = sizeof(buf); 405 size_t size = sizeof(buf);
406 int socked_id = hists->socket_filter; 406 int socked_id = hists->socket_filter;
@@ -414,7 +414,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
414 } 414 }
415 415
416 if (perf_evsel__is_group_event(evsel)) { 416 if (perf_evsel__is_group_event(evsel)) {
417 struct perf_evsel *pos; 417 struct evsel *pos;
418 418
419 perf_evsel__group_desc(evsel, buf, size); 419 perf_evsel__group_desc(evsel, buf, size);
420 evname = buf; 420 evname = buf;
@@ -463,7 +463,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
463 struct report *rep, 463 struct report *rep,
464 const char *help) 464 const char *help)
465{ 465{
466 struct perf_evsel *pos; 466 struct evsel *pos;
467 467
468 if (!quiet) { 468 if (!quiet) {
469 fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", 469 fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
@@ -586,7 +586,7 @@ static int report__browse_hists(struct report *rep)
586static int report__collapse_hists(struct report *rep) 586static int report__collapse_hists(struct report *rep)
587{ 587{
588 struct ui_progress prog; 588 struct ui_progress prog;
589 struct perf_evsel *pos; 589 struct evsel *pos;
590 int ret = 0; 590 int ret = 0;
591 591
592 ui_progress__init(&prog, rep->nr_entries, "Merging related events..."); 592 ui_progress__init(&prog, rep->nr_entries, "Merging related events...");
@@ -623,7 +623,7 @@ static int hists__resort_cb(struct hist_entry *he, void *arg)
623 struct symbol *sym = he->ms.sym; 623 struct symbol *sym = he->ms.sym;
624 624
625 if (rep->symbol_ipc && sym && !sym->annotate2) { 625 if (rep->symbol_ipc && sym && !sym->annotate2) {
626 struct perf_evsel *evsel = hists_to_evsel(he->hists); 626 struct evsel *evsel = hists_to_evsel(he->hists);
627 627
628 symbol__annotate2(sym, he->ms.map, evsel, 628 symbol__annotate2(sym, he->ms.map, evsel,
629 &annotation__default_options, NULL); 629 &annotation__default_options, NULL);
@@ -635,7 +635,7 @@ static int hists__resort_cb(struct hist_entry *he, void *arg)
635static void report__output_resort(struct report *rep) 635static void report__output_resort(struct report *rep)
636{ 636{
637 struct ui_progress prog; 637 struct ui_progress prog;
638 struct perf_evsel *pos; 638 struct evsel *pos;
639 639
640 ui_progress__init(&prog, rep->nr_entries, "Sorting events for output..."); 640 ui_progress__init(&prog, rep->nr_entries, "Sorting events for output...");
641 641
@@ -818,7 +818,7 @@ static int __cmd_report(struct report *rep)
818{ 818{
819 int ret; 819 int ret;
820 struct perf_session *session = rep->session; 820 struct perf_session *session = rep->session;
821 struct perf_evsel *pos; 821 struct evsel *pos;
822 struct perf_data *data = session->data; 822 struct perf_data *data = session->data;
823 823
824 signal(SIGINT, sig_handler); 824 signal(SIGINT, sig_handler);
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ac6a0c5d6d6b..55779f496d27 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -133,13 +133,13 @@ typedef int (*sort_fn_t)(struct work_atoms *, struct work_atoms *);
133struct perf_sched; 133struct perf_sched;
134 134
135struct trace_sched_handler { 135struct trace_sched_handler {
136 int (*switch_event)(struct perf_sched *sched, struct perf_evsel *evsel, 136 int (*switch_event)(struct perf_sched *sched, struct evsel *evsel,
137 struct perf_sample *sample, struct machine *machine); 137 struct perf_sample *sample, struct machine *machine);
138 138
139 int (*runtime_event)(struct perf_sched *sched, struct perf_evsel *evsel, 139 int (*runtime_event)(struct perf_sched *sched, struct evsel *evsel,
140 struct perf_sample *sample, struct machine *machine); 140 struct perf_sample *sample, struct machine *machine);
141 141
142 int (*wakeup_event)(struct perf_sched *sched, struct perf_evsel *evsel, 142 int (*wakeup_event)(struct perf_sched *sched, struct evsel *evsel,
143 struct perf_sample *sample, struct machine *machine); 143 struct perf_sample *sample, struct machine *machine);
144 144
145 /* PERF_RECORD_FORK event, not sched_process_fork tracepoint */ 145 /* PERF_RECORD_FORK event, not sched_process_fork tracepoint */
@@ -147,7 +147,7 @@ struct trace_sched_handler {
147 struct machine *machine); 147 struct machine *machine);
148 148
149 int (*migrate_task_event)(struct perf_sched *sched, 149 int (*migrate_task_event)(struct perf_sched *sched,
150 struct perf_evsel *evsel, 150 struct evsel *evsel,
151 struct perf_sample *sample, 151 struct perf_sample *sample,
152 struct machine *machine); 152 struct machine *machine);
153}; 153};
@@ -799,7 +799,7 @@ static void test_calibrations(struct perf_sched *sched)
799 799
800static int 800static int
801replay_wakeup_event(struct perf_sched *sched, 801replay_wakeup_event(struct perf_sched *sched,
802 struct perf_evsel *evsel, struct perf_sample *sample, 802 struct evsel *evsel, struct perf_sample *sample,
803 struct machine *machine __maybe_unused) 803 struct machine *machine __maybe_unused)
804{ 804{
805 const char *comm = perf_evsel__strval(evsel, sample, "comm"); 805 const char *comm = perf_evsel__strval(evsel, sample, "comm");
@@ -820,7 +820,7 @@ replay_wakeup_event(struct perf_sched *sched,
820} 820}
821 821
822static int replay_switch_event(struct perf_sched *sched, 822static int replay_switch_event(struct perf_sched *sched,
823 struct perf_evsel *evsel, 823 struct evsel *evsel,
824 struct perf_sample *sample, 824 struct perf_sample *sample,
825 struct machine *machine __maybe_unused) 825 struct machine *machine __maybe_unused)
826{ 826{
@@ -1093,7 +1093,7 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp)
1093} 1093}
1094 1094
1095static int latency_switch_event(struct perf_sched *sched, 1095static int latency_switch_event(struct perf_sched *sched,
1096 struct perf_evsel *evsel, 1096 struct evsel *evsel,
1097 struct perf_sample *sample, 1097 struct perf_sample *sample,
1098 struct machine *machine) 1098 struct machine *machine)
1099{ 1099{
@@ -1163,7 +1163,7 @@ out_put:
1163} 1163}
1164 1164
1165static int latency_runtime_event(struct perf_sched *sched, 1165static int latency_runtime_event(struct perf_sched *sched,
1166 struct perf_evsel *evsel, 1166 struct evsel *evsel,
1167 struct perf_sample *sample, 1167 struct perf_sample *sample,
1168 struct machine *machine) 1168 struct machine *machine)
1169{ 1169{
@@ -1198,7 +1198,7 @@ out_put:
1198} 1198}
1199 1199
1200static int latency_wakeup_event(struct perf_sched *sched, 1200static int latency_wakeup_event(struct perf_sched *sched,
1201 struct perf_evsel *evsel, 1201 struct evsel *evsel,
1202 struct perf_sample *sample, 1202 struct perf_sample *sample,
1203 struct machine *machine) 1203 struct machine *machine)
1204{ 1204{
@@ -1259,7 +1259,7 @@ out_put:
1259} 1259}
1260 1260
1261static int latency_migrate_task_event(struct perf_sched *sched, 1261static int latency_migrate_task_event(struct perf_sched *sched,
1262 struct perf_evsel *evsel, 1262 struct evsel *evsel,
1263 struct perf_sample *sample, 1263 struct perf_sample *sample,
1264 struct machine *machine) 1264 struct machine *machine)
1265{ 1265{
@@ -1470,7 +1470,7 @@ again:
1470} 1470}
1471 1471
1472static int process_sched_wakeup_event(struct perf_tool *tool, 1472static int process_sched_wakeup_event(struct perf_tool *tool,
1473 struct perf_evsel *evsel, 1473 struct evsel *evsel,
1474 struct perf_sample *sample, 1474 struct perf_sample *sample,
1475 struct machine *machine) 1475 struct machine *machine)
1476{ 1476{
@@ -1514,7 +1514,7 @@ map__findnew_thread(struct perf_sched *sched, struct machine *machine, pid_t pid
1514 return thread; 1514 return thread;
1515} 1515}
1516 1516
1517static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, 1517static int map_switch_event(struct perf_sched *sched, struct evsel *evsel,
1518 struct perf_sample *sample, struct machine *machine) 1518 struct perf_sample *sample, struct machine *machine)
1519{ 1519{
1520 const u32 next_pid = perf_evsel__intval(evsel, sample, "next_pid"); 1520 const u32 next_pid = perf_evsel__intval(evsel, sample, "next_pid");
@@ -1655,7 +1655,7 @@ out:
1655} 1655}
1656 1656
1657static int process_sched_switch_event(struct perf_tool *tool, 1657static int process_sched_switch_event(struct perf_tool *tool,
1658 struct perf_evsel *evsel, 1658 struct evsel *evsel,
1659 struct perf_sample *sample, 1659 struct perf_sample *sample,
1660 struct machine *machine) 1660 struct machine *machine)
1661{ 1661{
@@ -1681,7 +1681,7 @@ static int process_sched_switch_event(struct perf_tool *tool,
1681} 1681}
1682 1682
1683static int process_sched_runtime_event(struct perf_tool *tool, 1683static int process_sched_runtime_event(struct perf_tool *tool,
1684 struct perf_evsel *evsel, 1684 struct evsel *evsel,
1685 struct perf_sample *sample, 1685 struct perf_sample *sample,
1686 struct machine *machine) 1686 struct machine *machine)
1687{ 1687{
@@ -1711,7 +1711,7 @@ static int perf_sched__process_fork_event(struct perf_tool *tool,
1711} 1711}
1712 1712
1713static int process_sched_migrate_task_event(struct perf_tool *tool, 1713static int process_sched_migrate_task_event(struct perf_tool *tool,
1714 struct perf_evsel *evsel, 1714 struct evsel *evsel,
1715 struct perf_sample *sample, 1715 struct perf_sample *sample,
1716 struct machine *machine) 1716 struct machine *machine)
1717{ 1717{
@@ -1724,14 +1724,14 @@ static int process_sched_migrate_task_event(struct perf_tool *tool,
1724} 1724}
1725 1725
1726typedef int (*tracepoint_handler)(struct perf_tool *tool, 1726typedef int (*tracepoint_handler)(struct perf_tool *tool,
1727 struct perf_evsel *evsel, 1727 struct evsel *evsel,
1728 struct perf_sample *sample, 1728 struct perf_sample *sample,
1729 struct machine *machine); 1729 struct machine *machine);
1730 1730
1731static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_unused, 1731static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_unused,
1732 union perf_event *event __maybe_unused, 1732 union perf_event *event __maybe_unused,
1733 struct perf_sample *sample, 1733 struct perf_sample *sample,
1734 struct perf_evsel *evsel, 1734 struct evsel *evsel,
1735 struct machine *machine) 1735 struct machine *machine)
1736{ 1736{
1737 int err = 0; 1737 int err = 0;
@@ -1777,7 +1777,7 @@ static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused,
1777 1777
1778static int perf_sched__read_events(struct perf_sched *sched) 1778static int perf_sched__read_events(struct perf_sched *sched)
1779{ 1779{
1780 const struct perf_evsel_str_handler handlers[] = { 1780 const struct evsel_str_handler handlers[] = {
1781 { "sched:sched_switch", process_sched_switch_event, }, 1781 { "sched:sched_switch", process_sched_switch_event, },
1782 { "sched:sched_stat_runtime", process_sched_runtime_event, }, 1782 { "sched:sched_stat_runtime", process_sched_runtime_event, },
1783 { "sched:sched_wakeup", process_sched_wakeup_event, }, 1783 { "sched:sched_wakeup", process_sched_wakeup_event, },
@@ -1839,7 +1839,7 @@ static inline void print_sched_time(unsigned long long nsecs, int width)
1839 * returns runtime data for event, allocating memory for it the 1839 * returns runtime data for event, allocating memory for it the
1840 * first time it is used. 1840 * first time it is used.
1841 */ 1841 */
1842static struct evsel_runtime *perf_evsel__get_runtime(struct perf_evsel *evsel) 1842static struct evsel_runtime *perf_evsel__get_runtime(struct evsel *evsel)
1843{ 1843{
1844 struct evsel_runtime *r = evsel->priv; 1844 struct evsel_runtime *r = evsel->priv;
1845 1845
@@ -1854,7 +1854,7 @@ static struct evsel_runtime *perf_evsel__get_runtime(struct perf_evsel *evsel)
1854/* 1854/*
1855 * save last time event was seen per cpu 1855 * save last time event was seen per cpu
1856 */ 1856 */
1857static void perf_evsel__save_time(struct perf_evsel *evsel, 1857static void perf_evsel__save_time(struct evsel *evsel,
1858 u64 timestamp, u32 cpu) 1858 u64 timestamp, u32 cpu)
1859{ 1859{
1860 struct evsel_runtime *r = perf_evsel__get_runtime(evsel); 1860 struct evsel_runtime *r = perf_evsel__get_runtime(evsel);
@@ -1881,7 +1881,7 @@ static void perf_evsel__save_time(struct perf_evsel *evsel,
1881} 1881}
1882 1882
1883/* returns last time this event was seen on the given cpu */ 1883/* returns last time this event was seen on the given cpu */
1884static u64 perf_evsel__get_time(struct perf_evsel *evsel, u32 cpu) 1884static u64 perf_evsel__get_time(struct evsel *evsel, u32 cpu)
1885{ 1885{
1886 struct evsel_runtime *r = perf_evsel__get_runtime(evsel); 1886 struct evsel_runtime *r = perf_evsel__get_runtime(evsel);
1887 1887
@@ -1988,7 +1988,7 @@ static char task_state_char(struct thread *thread, int state)
1988} 1988}
1989 1989
1990static void timehist_print_sample(struct perf_sched *sched, 1990static void timehist_print_sample(struct perf_sched *sched,
1991 struct perf_evsel *evsel, 1991 struct evsel *evsel,
1992 struct perf_sample *sample, 1992 struct perf_sample *sample,
1993 struct addr_location *al, 1993 struct addr_location *al,
1994 struct thread *thread, 1994 struct thread *thread,
@@ -2121,7 +2121,7 @@ static void timehist_update_runtime_stats(struct thread_runtime *r,
2121} 2121}
2122 2122
2123static bool is_idle_sample(struct perf_sample *sample, 2123static bool is_idle_sample(struct perf_sample *sample,
2124 struct perf_evsel *evsel) 2124 struct evsel *evsel)
2125{ 2125{
2126 /* pid 0 == swapper == idle task */ 2126 /* pid 0 == swapper == idle task */
2127 if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0) 2127 if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0)
@@ -2132,7 +2132,7 @@ static bool is_idle_sample(struct perf_sample *sample,
2132 2132
2133static void save_task_callchain(struct perf_sched *sched, 2133static void save_task_callchain(struct perf_sched *sched,
2134 struct perf_sample *sample, 2134 struct perf_sample *sample,
2135 struct perf_evsel *evsel, 2135 struct evsel *evsel,
2136 struct machine *machine) 2136 struct machine *machine)
2137{ 2137{
2138 struct callchain_cursor *cursor = &callchain_cursor; 2138 struct callchain_cursor *cursor = &callchain_cursor;
@@ -2286,7 +2286,7 @@ static void save_idle_callchain(struct perf_sched *sched,
2286static struct thread *timehist_get_thread(struct perf_sched *sched, 2286static struct thread *timehist_get_thread(struct perf_sched *sched,
2287 struct perf_sample *sample, 2287 struct perf_sample *sample,
2288 struct machine *machine, 2288 struct machine *machine,
2289 struct perf_evsel *evsel) 2289 struct evsel *evsel)
2290{ 2290{
2291 struct thread *thread; 2291 struct thread *thread;
2292 2292
@@ -2332,7 +2332,7 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
2332 2332
2333static bool timehist_skip_sample(struct perf_sched *sched, 2333static bool timehist_skip_sample(struct perf_sched *sched,
2334 struct thread *thread, 2334 struct thread *thread,
2335 struct perf_evsel *evsel, 2335 struct evsel *evsel,
2336 struct perf_sample *sample) 2336 struct perf_sample *sample)
2337{ 2337{
2338 bool rc = false; 2338 bool rc = false;
@@ -2354,7 +2354,7 @@ static bool timehist_skip_sample(struct perf_sched *sched,
2354} 2354}
2355 2355
2356static void timehist_print_wakeup_event(struct perf_sched *sched, 2356static void timehist_print_wakeup_event(struct perf_sched *sched,
2357 struct perf_evsel *evsel, 2357 struct evsel *evsel,
2358 struct perf_sample *sample, 2358 struct perf_sample *sample,
2359 struct machine *machine, 2359 struct machine *machine,
2360 struct thread *awakened) 2360 struct thread *awakened)
@@ -2389,7 +2389,7 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,
2389 2389
2390static int timehist_sched_wakeup_event(struct perf_tool *tool, 2390static int timehist_sched_wakeup_event(struct perf_tool *tool,
2391 union perf_event *event __maybe_unused, 2391 union perf_event *event __maybe_unused,
2392 struct perf_evsel *evsel, 2392 struct evsel *evsel,
2393 struct perf_sample *sample, 2393 struct perf_sample *sample,
2394 struct machine *machine) 2394 struct machine *machine)
2395{ 2395{
@@ -2419,7 +2419,7 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
2419} 2419}
2420 2420
2421static void timehist_print_migration_event(struct perf_sched *sched, 2421static void timehist_print_migration_event(struct perf_sched *sched,
2422 struct perf_evsel *evsel, 2422 struct evsel *evsel,
2423 struct perf_sample *sample, 2423 struct perf_sample *sample,
2424 struct machine *machine, 2424 struct machine *machine,
2425 struct thread *migrated) 2425 struct thread *migrated)
@@ -2473,7 +2473,7 @@ static void timehist_print_migration_event(struct perf_sched *sched,
2473 2473
2474static int timehist_migrate_task_event(struct perf_tool *tool, 2474static int timehist_migrate_task_event(struct perf_tool *tool,
2475 union perf_event *event __maybe_unused, 2475 union perf_event *event __maybe_unused,
2476 struct perf_evsel *evsel, 2476 struct evsel *evsel,
2477 struct perf_sample *sample, 2477 struct perf_sample *sample,
2478 struct machine *machine) 2478 struct machine *machine)
2479{ 2479{
@@ -2501,7 +2501,7 @@ static int timehist_migrate_task_event(struct perf_tool *tool,
2501 2501
2502static int timehist_sched_change_event(struct perf_tool *tool, 2502static int timehist_sched_change_event(struct perf_tool *tool,
2503 union perf_event *event, 2503 union perf_event *event,
2504 struct perf_evsel *evsel, 2504 struct evsel *evsel,
2505 struct perf_sample *sample, 2505 struct perf_sample *sample,
2506 struct machine *machine) 2506 struct machine *machine)
2507{ 2507{
@@ -2627,7 +2627,7 @@ out:
2627 2627
2628static int timehist_sched_switch_event(struct perf_tool *tool, 2628static int timehist_sched_switch_event(struct perf_tool *tool,
2629 union perf_event *event, 2629 union perf_event *event,
2630 struct perf_evsel *evsel, 2630 struct evsel *evsel,
2631 struct perf_sample *sample, 2631 struct perf_sample *sample,
2632 struct machine *machine __maybe_unused) 2632 struct machine *machine __maybe_unused)
2633{ 2633{
@@ -2897,14 +2897,14 @@ static void timehist_print_summary(struct perf_sched *sched,
2897 2897
2898typedef int (*sched_handler)(struct perf_tool *tool, 2898typedef int (*sched_handler)(struct perf_tool *tool,
2899 union perf_event *event, 2899 union perf_event *event,
2900 struct perf_evsel *evsel, 2900 struct evsel *evsel,
2901 struct perf_sample *sample, 2901 struct perf_sample *sample,
2902 struct machine *machine); 2902 struct machine *machine);
2903 2903
2904static int perf_timehist__process_sample(struct perf_tool *tool, 2904static int perf_timehist__process_sample(struct perf_tool *tool,
2905 union perf_event *event, 2905 union perf_event *event,
2906 struct perf_sample *sample, 2906 struct perf_sample *sample,
2907 struct perf_evsel *evsel, 2907 struct evsel *evsel,
2908 struct machine *machine) 2908 struct machine *machine)
2909{ 2909{
2910 struct perf_sched *sched = container_of(tool, struct perf_sched, tool); 2910 struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
@@ -2926,7 +2926,7 @@ static int perf_timehist__process_sample(struct perf_tool *tool,
2926static int timehist_check_attr(struct perf_sched *sched, 2926static int timehist_check_attr(struct perf_sched *sched,
2927 struct perf_evlist *evlist) 2927 struct perf_evlist *evlist)
2928{ 2928{
2929 struct perf_evsel *evsel; 2929 struct evsel *evsel;
2930 struct evsel_runtime *er; 2930 struct evsel_runtime *er;
2931 2931
2932 list_for_each_entry(evsel, &evlist->entries, node) { 2932 list_for_each_entry(evsel, &evlist->entries, node) {
@@ -2948,12 +2948,12 @@ static int timehist_check_attr(struct perf_sched *sched,
2948 2948
2949static int perf_sched__timehist(struct perf_sched *sched) 2949static int perf_sched__timehist(struct perf_sched *sched)
2950{ 2950{
2951 const struct perf_evsel_str_handler handlers[] = { 2951 const struct evsel_str_handler handlers[] = {
2952 { "sched:sched_switch", timehist_sched_switch_event, }, 2952 { "sched:sched_switch", timehist_sched_switch_event, },
2953 { "sched:sched_wakeup", timehist_sched_wakeup_event, }, 2953 { "sched:sched_wakeup", timehist_sched_wakeup_event, },
2954 { "sched:sched_wakeup_new", timehist_sched_wakeup_event, }, 2954 { "sched:sched_wakeup_new", timehist_sched_wakeup_event, },
2955 }; 2955 };
2956 const struct perf_evsel_str_handler migrate_handlers[] = { 2956 const struct evsel_str_handler migrate_handlers[] = {
2957 { "sched:sched_migrate_task", timehist_migrate_task_event, }, 2957 { "sched:sched_migrate_task", timehist_migrate_task_event, },
2958 }; 2958 };
2959 struct perf_data data = { 2959 struct perf_data data = {
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index fccc960df92b..4f9c8bb7620d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -242,7 +242,7 @@ static struct {
242 }, 242 },
243}; 243};
244 244
245struct perf_evsel_script { 245struct evsel_script {
246 char *filename; 246 char *filename;
247 FILE *fp; 247 FILE *fp;
248 u64 samples; 248 u64 samples;
@@ -251,15 +251,15 @@ struct perf_evsel_script {
251 int gnum; 251 int gnum;
252}; 252};
253 253
254static inline struct perf_evsel_script *evsel_script(struct perf_evsel *evsel) 254static inline struct evsel_script *evsel_script(struct evsel *evsel)
255{ 255{
256 return (struct perf_evsel_script *)evsel->priv; 256 return (struct evsel_script *)evsel->priv;
257} 257}
258 258
259static struct perf_evsel_script *perf_evsel_script__new(struct perf_evsel *evsel, 259static struct evsel_script *perf_evsel_script__new(struct evsel *evsel,
260 struct perf_data *data) 260 struct perf_data *data)
261{ 261{
262 struct perf_evsel_script *es = zalloc(sizeof(*es)); 262 struct evsel_script *es = zalloc(sizeof(*es));
263 263
264 if (es != NULL) { 264 if (es != NULL) {
265 if (asprintf(&es->filename, "%s.%s.dump", data->file.path, perf_evsel__name(evsel)) < 0) 265 if (asprintf(&es->filename, "%s.%s.dump", data->file.path, perf_evsel__name(evsel)) < 0)
@@ -277,7 +277,7 @@ out_free:
277 return NULL; 277 return NULL;
278} 278}
279 279
280static void perf_evsel_script__delete(struct perf_evsel_script *es) 280static void perf_evsel_script__delete(struct evsel_script *es)
281{ 281{
282 zfree(&es->filename); 282 zfree(&es->filename);
283 fclose(es->fp); 283 fclose(es->fp);
@@ -285,7 +285,7 @@ static void perf_evsel_script__delete(struct perf_evsel_script *es)
285 free(es); 285 free(es);
286} 286}
287 287
288static int perf_evsel_script__fprintf(struct perf_evsel_script *es, FILE *fp) 288static int perf_evsel_script__fprintf(struct evsel_script *es, FILE *fp)
289{ 289{
290 struct stat st; 290 struct stat st;
291 291
@@ -340,7 +340,7 @@ static const char *output_field2str(enum perf_output_field field)
340 340
341#define PRINT_FIELD(x) (output[output_type(attr->type)].fields & PERF_OUTPUT_##x) 341#define PRINT_FIELD(x) (output[output_type(attr->type)].fields & PERF_OUTPUT_##x)
342 342
343static int perf_evsel__do_check_stype(struct perf_evsel *evsel, 343static int perf_evsel__do_check_stype(struct evsel *evsel,
344 u64 sample_type, const char *sample_msg, 344 u64 sample_type, const char *sample_msg,
345 enum perf_output_field field, 345 enum perf_output_field field,
346 bool allow_user_set) 346 bool allow_user_set)
@@ -372,7 +372,7 @@ static int perf_evsel__do_check_stype(struct perf_evsel *evsel,
372 return 0; 372 return 0;
373} 373}
374 374
375static int perf_evsel__check_stype(struct perf_evsel *evsel, 375static int perf_evsel__check_stype(struct evsel *evsel,
376 u64 sample_type, const char *sample_msg, 376 u64 sample_type, const char *sample_msg,
377 enum perf_output_field field) 377 enum perf_output_field field)
378{ 378{
@@ -380,7 +380,7 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel,
380 false); 380 false);
381} 381}
382 382
383static int perf_evsel__check_attr(struct perf_evsel *evsel, 383static int perf_evsel__check_attr(struct evsel *evsel,
384 struct perf_session *session) 384 struct perf_session *session)
385{ 385{
386 struct perf_event_attr *attr = &evsel->attr; 386 struct perf_event_attr *attr = &evsel->attr;
@@ -507,7 +507,7 @@ static void set_print_ip_opts(struct perf_event_attr *attr)
507static int perf_session__check_output_opt(struct perf_session *session) 507static int perf_session__check_output_opt(struct perf_session *session)
508{ 508{
509 unsigned int j; 509 unsigned int j;
510 struct perf_evsel *evsel; 510 struct evsel *evsel;
511 511
512 for (j = 0; j < OUTPUT_TYPE_MAX; ++j) { 512 for (j = 0; j < OUTPUT_TYPE_MAX; ++j) {
513 evsel = perf_session__find_first_evtype(session, attr_type(j)); 513 evsel = perf_session__find_first_evtype(session, attr_type(j));
@@ -614,7 +614,7 @@ static int perf_sample__fprintf_uregs(struct perf_sample *sample,
614 614
615static int perf_sample__fprintf_start(struct perf_sample *sample, 615static int perf_sample__fprintf_start(struct perf_sample *sample,
616 struct thread *thread, 616 struct thread *thread,
617 struct perf_evsel *evsel, 617 struct evsel *evsel,
618 u32 type, FILE *fp) 618 u32 type, FILE *fp)
619{ 619{
620 struct perf_event_attr *attr = &evsel->attr; 620 struct perf_event_attr *attr = &evsel->attr;
@@ -1162,7 +1162,7 @@ out:
1162} 1162}
1163 1163
1164static const char *resolve_branch_sym(struct perf_sample *sample, 1164static const char *resolve_branch_sym(struct perf_sample *sample,
1165 struct perf_evsel *evsel, 1165 struct evsel *evsel,
1166 struct thread *thread, 1166 struct thread *thread,
1167 struct addr_location *al, 1167 struct addr_location *al,
1168 u64 *ip) 1168 u64 *ip)
@@ -1191,7 +1191,7 @@ static const char *resolve_branch_sym(struct perf_sample *sample,
1191} 1191}
1192 1192
1193static int perf_sample__fprintf_callindent(struct perf_sample *sample, 1193static int perf_sample__fprintf_callindent(struct perf_sample *sample,
1194 struct perf_evsel *evsel, 1194 struct evsel *evsel,
1195 struct thread *thread, 1195 struct thread *thread,
1196 struct addr_location *al, FILE *fp) 1196 struct addr_location *al, FILE *fp)
1197{ 1197{
@@ -1285,7 +1285,7 @@ static int perf_sample__fprintf_ipc(struct perf_sample *sample,
1285} 1285}
1286 1286
1287static int perf_sample__fprintf_bts(struct perf_sample *sample, 1287static int perf_sample__fprintf_bts(struct perf_sample *sample,
1288 struct perf_evsel *evsel, 1288 struct evsel *evsel,
1289 struct thread *thread, 1289 struct thread *thread,
1290 struct addr_location *al, 1290 struct addr_location *al,
1291 struct machine *machine, FILE *fp) 1291 struct machine *machine, FILE *fp)
@@ -1593,7 +1593,7 @@ static int perf_sample__fprintf_synth_cbr(struct perf_sample *sample, FILE *fp)
1593} 1593}
1594 1594
1595static int perf_sample__fprintf_synth(struct perf_sample *sample, 1595static int perf_sample__fprintf_synth(struct perf_sample *sample,
1596 struct perf_evsel *evsel, FILE *fp) 1596 struct evsel *evsel, FILE *fp)
1597{ 1597{
1598 switch (evsel->attr.config) { 1598 switch (evsel->attr.config) {
1599 case PERF_SYNTH_INTEL_PTWRITE: 1599 case PERF_SYNTH_INTEL_PTWRITE:
@@ -1638,7 +1638,7 @@ struct perf_script {
1638 1638
1639static int perf_evlist__max_name_len(struct perf_evlist *evlist) 1639static int perf_evlist__max_name_len(struct perf_evlist *evlist)
1640{ 1640{
1641 struct perf_evsel *evsel; 1641 struct evsel *evsel;
1642 int max = 0; 1642 int max = 0;
1643 1643
1644 evlist__for_each_entry(evlist, evsel) { 1644 evlist__for_each_entry(evlist, evsel) {
@@ -1670,7 +1670,7 @@ static int data_src__fprintf(u64 data_src, FILE *fp)
1670struct metric_ctx { 1670struct metric_ctx {
1671 struct perf_sample *sample; 1671 struct perf_sample *sample;
1672 struct thread *thread; 1672 struct thread *thread;
1673 struct perf_evsel *evsel; 1673 struct evsel *evsel;
1674 FILE *fp; 1674 FILE *fp;
1675}; 1675};
1676 1676
@@ -1705,7 +1705,7 @@ static void script_new_line(struct perf_stat_config *config __maybe_unused,
1705 1705
1706static void perf_sample__fprint_metric(struct perf_script *script, 1706static void perf_sample__fprint_metric(struct perf_script *script,
1707 struct thread *thread, 1707 struct thread *thread,
1708 struct perf_evsel *evsel, 1708 struct evsel *evsel,
1709 struct perf_sample *sample, 1709 struct perf_sample *sample,
1710 FILE *fp) 1710 FILE *fp)
1711{ 1711{
@@ -1720,7 +1720,7 @@ static void perf_sample__fprint_metric(struct perf_script *script,
1720 }, 1720 },
1721 .force_header = false, 1721 .force_header = false,
1722 }; 1722 };
1723 struct perf_evsel *ev2; 1723 struct evsel *ev2;
1724 u64 val; 1724 u64 val;
1725 1725
1726 if (!evsel->stats) 1726 if (!evsel->stats)
@@ -1747,7 +1747,7 @@ static void perf_sample__fprint_metric(struct perf_script *script,
1747} 1747}
1748 1748
1749static bool show_event(struct perf_sample *sample, 1749static bool show_event(struct perf_sample *sample,
1750 struct perf_evsel *evsel, 1750 struct evsel *evsel,
1751 struct thread *thread, 1751 struct thread *thread,
1752 struct addr_location *al) 1752 struct addr_location *al)
1753{ 1753{
@@ -1788,14 +1788,14 @@ static bool show_event(struct perf_sample *sample,
1788} 1788}
1789 1789
1790static void process_event(struct perf_script *script, 1790static void process_event(struct perf_script *script,
1791 struct perf_sample *sample, struct perf_evsel *evsel, 1791 struct perf_sample *sample, struct evsel *evsel,
1792 struct addr_location *al, 1792 struct addr_location *al,
1793 struct machine *machine) 1793 struct machine *machine)
1794{ 1794{
1795 struct thread *thread = al->thread; 1795 struct thread *thread = al->thread;
1796 struct perf_event_attr *attr = &evsel->attr; 1796 struct perf_event_attr *attr = &evsel->attr;
1797 unsigned int type = output_type(attr->type); 1797 unsigned int type = output_type(attr->type);
1798 struct perf_evsel_script *es = evsel->priv; 1798 struct evsel_script *es = evsel->priv;
1799 FILE *fp = es->fp; 1799 FILE *fp = es->fp;
1800 1800
1801 if (output[type].fields == 0) 1801 if (output[type].fields == 0)
@@ -1897,7 +1897,7 @@ static void process_event(struct perf_script *script,
1897 1897
1898static struct scripting_ops *scripting_ops; 1898static struct scripting_ops *scripting_ops;
1899 1899
1900static void __process_stat(struct perf_evsel *counter, u64 tstamp) 1900static void __process_stat(struct evsel *counter, u64 tstamp)
1901{ 1901{
1902 int nthreads = thread_map__nr(counter->threads); 1902 int nthreads = thread_map__nr(counter->threads);
1903 int ncpus = perf_evsel__nr_cpus(counter); 1903 int ncpus = perf_evsel__nr_cpus(counter);
@@ -1931,7 +1931,7 @@ static void __process_stat(struct perf_evsel *counter, u64 tstamp)
1931 } 1931 }
1932} 1932}
1933 1933
1934static void process_stat(struct perf_evsel *counter, u64 tstamp) 1934static void process_stat(struct evsel *counter, u64 tstamp)
1935{ 1935{
1936 if (scripting_ops && scripting_ops->process_stat) 1936 if (scripting_ops && scripting_ops->process_stat)
1937 scripting_ops->process_stat(&stat_config, counter, tstamp); 1937 scripting_ops->process_stat(&stat_config, counter, tstamp);
@@ -1973,7 +1973,7 @@ static bool filter_cpu(struct perf_sample *sample)
1973static int process_sample_event(struct perf_tool *tool, 1973static int process_sample_event(struct perf_tool *tool,
1974 union perf_event *event, 1974 union perf_event *event,
1975 struct perf_sample *sample, 1975 struct perf_sample *sample,
1976 struct perf_evsel *evsel, 1976 struct evsel *evsel,
1977 struct machine *machine) 1977 struct machine *machine)
1978{ 1978{
1979 struct perf_script *scr = container_of(tool, struct perf_script, tool); 1979 struct perf_script *scr = container_of(tool, struct perf_script, tool);
@@ -2022,9 +2022,9 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,
2022{ 2022{
2023 struct perf_script *scr = container_of(tool, struct perf_script, tool); 2023 struct perf_script *scr = container_of(tool, struct perf_script, tool);
2024 struct perf_evlist *evlist; 2024 struct perf_evlist *evlist;
2025 struct perf_evsel *evsel, *pos; 2025 struct evsel *evsel, *pos;
2026 int err; 2026 int err;
2027 static struct perf_evsel_script *es; 2027 static struct evsel_script *es;
2028 2028
2029 err = perf_event__process_attr(tool, event, pevlist); 2029 err = perf_event__process_attr(tool, event, pevlist);
2030 if (err) 2030 if (err)
@@ -2071,7 +2071,7 @@ static int process_comm_event(struct perf_tool *tool,
2071 struct thread *thread; 2071 struct thread *thread;
2072 struct perf_script *script = container_of(tool, struct perf_script, tool); 2072 struct perf_script *script = container_of(tool, struct perf_script, tool);
2073 struct perf_session *session = script->session; 2073 struct perf_session *session = script->session;
2074 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2074 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2075 int ret = -1; 2075 int ret = -1;
2076 2076
2077 thread = machine__findnew_thread(machine, event->comm.pid, event->comm.tid); 2077 thread = machine__findnew_thread(machine, event->comm.pid, event->comm.tid);
@@ -2108,7 +2108,7 @@ static int process_namespaces_event(struct perf_tool *tool,
2108 struct thread *thread; 2108 struct thread *thread;
2109 struct perf_script *script = container_of(tool, struct perf_script, tool); 2109 struct perf_script *script = container_of(tool, struct perf_script, tool);
2110 struct perf_session *session = script->session; 2110 struct perf_session *session = script->session;
2111 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2111 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2112 int ret = -1; 2112 int ret = -1;
2113 2113
2114 thread = machine__findnew_thread(machine, event->namespaces.pid, 2114 thread = machine__findnew_thread(machine, event->namespaces.pid,
@@ -2146,7 +2146,7 @@ static int process_fork_event(struct perf_tool *tool,
2146 struct thread *thread; 2146 struct thread *thread;
2147 struct perf_script *script = container_of(tool, struct perf_script, tool); 2147 struct perf_script *script = container_of(tool, struct perf_script, tool);
2148 struct perf_session *session = script->session; 2148 struct perf_session *session = script->session;
2149 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2149 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2150 2150
2151 if (perf_event__process_fork(tool, event, sample, machine) < 0) 2151 if (perf_event__process_fork(tool, event, sample, machine) < 0)
2152 return -1; 2152 return -1;
@@ -2181,7 +2181,7 @@ static int process_exit_event(struct perf_tool *tool,
2181 struct thread *thread; 2181 struct thread *thread;
2182 struct perf_script *script = container_of(tool, struct perf_script, tool); 2182 struct perf_script *script = container_of(tool, struct perf_script, tool);
2183 struct perf_session *session = script->session; 2183 struct perf_session *session = script->session;
2184 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2184 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2185 2185
2186 thread = machine__findnew_thread(machine, event->fork.pid, event->fork.tid); 2186 thread = machine__findnew_thread(machine, event->fork.pid, event->fork.tid);
2187 if (thread == NULL) { 2187 if (thread == NULL) {
@@ -2216,7 +2216,7 @@ static int process_mmap_event(struct perf_tool *tool,
2216 struct thread *thread; 2216 struct thread *thread;
2217 struct perf_script *script = container_of(tool, struct perf_script, tool); 2217 struct perf_script *script = container_of(tool, struct perf_script, tool);
2218 struct perf_session *session = script->session; 2218 struct perf_session *session = script->session;
2219 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2219 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2220 2220
2221 if (perf_event__process_mmap(tool, event, sample, machine) < 0) 2221 if (perf_event__process_mmap(tool, event, sample, machine) < 0)
2222 return -1; 2222 return -1;
@@ -2250,7 +2250,7 @@ static int process_mmap2_event(struct perf_tool *tool,
2250 struct thread *thread; 2250 struct thread *thread;
2251 struct perf_script *script = container_of(tool, struct perf_script, tool); 2251 struct perf_script *script = container_of(tool, struct perf_script, tool);
2252 struct perf_session *session = script->session; 2252 struct perf_session *session = script->session;
2253 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2253 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2254 2254
2255 if (perf_event__process_mmap2(tool, event, sample, machine) < 0) 2255 if (perf_event__process_mmap2(tool, event, sample, machine) < 0)
2256 return -1; 2256 return -1;
@@ -2284,7 +2284,7 @@ static int process_switch_event(struct perf_tool *tool,
2284 struct thread *thread; 2284 struct thread *thread;
2285 struct perf_script *script = container_of(tool, struct perf_script, tool); 2285 struct perf_script *script = container_of(tool, struct perf_script, tool);
2286 struct perf_session *session = script->session; 2286 struct perf_session *session = script->session;
2287 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2287 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2288 2288
2289 if (perf_event__process_switch(tool, event, sample, machine) < 0) 2289 if (perf_event__process_switch(tool, event, sample, machine) < 0)
2290 return -1; 2290 return -1;
@@ -2319,7 +2319,7 @@ process_lost_event(struct perf_tool *tool,
2319{ 2319{
2320 struct perf_script *script = container_of(tool, struct perf_script, tool); 2320 struct perf_script *script = container_of(tool, struct perf_script, tool);
2321 struct perf_session *session = script->session; 2321 struct perf_session *session = script->session;
2322 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2322 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2323 struct thread *thread; 2323 struct thread *thread;
2324 2324
2325 thread = machine__findnew_thread(machine, sample->pid, 2325 thread = machine__findnew_thread(machine, sample->pid,
@@ -2355,7 +2355,7 @@ process_bpf_events(struct perf_tool *tool __maybe_unused,
2355 struct thread *thread; 2355 struct thread *thread;
2356 struct perf_script *script = container_of(tool, struct perf_script, tool); 2356 struct perf_script *script = container_of(tool, struct perf_script, tool);
2357 struct perf_session *session = script->session; 2357 struct perf_session *session = script->session;
2358 struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); 2358 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
2359 2359
2360 if (machine__process_ksymbol(machine, event, sample) < 0) 2360 if (machine__process_ksymbol(machine, event, sample) < 0)
2361 return -1; 2361 return -1;
@@ -2389,7 +2389,7 @@ static void sig_handler(int sig __maybe_unused)
2389static void perf_script__fclose_per_event_dump(struct perf_script *script) 2389static void perf_script__fclose_per_event_dump(struct perf_script *script)
2390{ 2390{
2391 struct perf_evlist *evlist = script->session->evlist; 2391 struct perf_evlist *evlist = script->session->evlist;
2392 struct perf_evsel *evsel; 2392 struct evsel *evsel;
2393 2393
2394 evlist__for_each_entry(evlist, evsel) { 2394 evlist__for_each_entry(evlist, evsel) {
2395 if (!evsel->priv) 2395 if (!evsel->priv)
@@ -2401,7 +2401,7 @@ static void perf_script__fclose_per_event_dump(struct perf_script *script)
2401 2401
2402static int perf_script__fopen_per_event_dump(struct perf_script *script) 2402static int perf_script__fopen_per_event_dump(struct perf_script *script)
2403{ 2403{
2404 struct perf_evsel *evsel; 2404 struct evsel *evsel;
2405 2405
2406 evlist__for_each_entry(script->session->evlist, evsel) { 2406 evlist__for_each_entry(script->session->evlist, evsel) {
2407 /* 2407 /*
@@ -2428,8 +2428,8 @@ out_err_fclose:
2428 2428
2429static int perf_script__setup_per_event_dump(struct perf_script *script) 2429static int perf_script__setup_per_event_dump(struct perf_script *script)
2430{ 2430{
2431 struct perf_evsel *evsel; 2431 struct evsel *evsel;
2432 static struct perf_evsel_script es_stdout; 2432 static struct evsel_script es_stdout;
2433 2433
2434 if (script->per_event_dump) 2434 if (script->per_event_dump)
2435 return perf_script__fopen_per_event_dump(script); 2435 return perf_script__fopen_per_event_dump(script);
@@ -2444,10 +2444,10 @@ static int perf_script__setup_per_event_dump(struct perf_script *script)
2444 2444
2445static void perf_script__exit_per_event_dump_stats(struct perf_script *script) 2445static void perf_script__exit_per_event_dump_stats(struct perf_script *script)
2446{ 2446{
2447 struct perf_evsel *evsel; 2447 struct evsel *evsel;
2448 2448
2449 evlist__for_each_entry(script->session->evlist, evsel) { 2449 evlist__for_each_entry(script->session->evlist, evsel) {
2450 struct perf_evsel_script *es = evsel->priv; 2450 struct evsel_script *es = evsel->priv;
2451 2451
2452 perf_evsel_script__fprintf(es, stdout); 2452 perf_evsel_script__fprintf(es, stdout);
2453 perf_evsel_script__delete(es); 2453 perf_evsel_script__delete(es);
@@ -3003,7 +3003,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
3003{ 3003{
3004 char filename[MAXPATHLEN], evname[128]; 3004 char filename[MAXPATHLEN], evname[128];
3005 char line[BUFSIZ], *p; 3005 char line[BUFSIZ], *p;
3006 struct perf_evsel *pos; 3006 struct evsel *pos;
3007 int match, len; 3007 int match, len;
3008 FILE *fp; 3008 FILE *fp;
3009 3009
@@ -3236,7 +3236,7 @@ static int process_stat_round_event(struct perf_session *session,
3236 union perf_event *event) 3236 union perf_event *event)
3237{ 3237{
3238 struct stat_round_event *round = &event->stat_round; 3238 struct stat_round_event *round = &event->stat_round;
3239 struct perf_evsel *counter; 3239 struct evsel *counter;
3240 3240
3241 evlist__for_each_entry(session->evlist, counter) { 3241 evlist__for_each_entry(session->evlist, counter) {
3242 perf_stat_process_counter(&stat_config, counter); 3242 perf_stat_process_counter(&stat_config, counter);
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2b9518a38baf..e0ba97018ad7 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -234,7 +234,7 @@ static int write_stat_round_event(u64 tm, u64 type)
234#define SID(e, x, y) xyarray__entry(e->sample_id, x, y) 234#define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
235 235
236static int 236static int
237perf_evsel__write_stat_event(struct perf_evsel *counter, u32 cpu, u32 thread, 237perf_evsel__write_stat_event(struct evsel *counter, u32 cpu, u32 thread,
238 struct perf_counts_values *count) 238 struct perf_counts_values *count)
239{ 239{
240 struct perf_sample_id *sid = SID(counter, cpu, thread); 240 struct perf_sample_id *sid = SID(counter, cpu, thread);
@@ -243,7 +243,7 @@ perf_evsel__write_stat_event(struct perf_evsel *counter, u32 cpu, u32 thread,
243 process_synthesized_event, NULL); 243 process_synthesized_event, NULL);
244} 244}
245 245
246static int read_single_counter(struct perf_evsel *counter, int cpu, 246static int read_single_counter(struct evsel *counter, int cpu,
247 int thread, struct timespec *rs) 247 int thread, struct timespec *rs)
248{ 248{
249 if (counter->tool_event == PERF_TOOL_DURATION_TIME) { 249 if (counter->tool_event == PERF_TOOL_DURATION_TIME) {
@@ -261,7 +261,7 @@ static int read_single_counter(struct perf_evsel *counter, int cpu,
261 * Read out the results of a single counter: 261 * Read out the results of a single counter:
262 * do not aggregate counts across CPUs in system-wide mode 262 * do not aggregate counts across CPUs in system-wide mode
263 */ 263 */
264static int read_counter(struct perf_evsel *counter, struct timespec *rs) 264static int read_counter(struct evsel *counter, struct timespec *rs)
265{ 265{
266 int nthreads = thread_map__nr(evsel_list->threads); 266 int nthreads = thread_map__nr(evsel_list->threads);
267 int ncpus, cpu, thread; 267 int ncpus, cpu, thread;
@@ -319,7 +319,7 @@ static int read_counter(struct perf_evsel *counter, struct timespec *rs)
319 319
320static void read_counters(struct timespec *rs) 320static void read_counters(struct timespec *rs)
321{ 321{
322 struct perf_evsel *counter; 322 struct evsel *counter;
323 int ret; 323 int ret;
324 324
325 evlist__for_each_entry(evsel_list, counter) { 325 evlist__for_each_entry(evsel_list, counter) {
@@ -389,7 +389,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused, siginfo_t *inf
389 workload_exec_errno = info->si_value.sival_int; 389 workload_exec_errno = info->si_value.sival_int;
390} 390}
391 391
392static bool perf_evsel__should_store_id(struct perf_evsel *counter) 392static bool perf_evsel__should_store_id(struct evsel *counter)
393{ 393{
394 return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID; 394 return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID;
395} 395}
@@ -423,7 +423,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
423 int timeout = stat_config.timeout; 423 int timeout = stat_config.timeout;
424 char msg[BUFSIZ]; 424 char msg[BUFSIZ];
425 unsigned long long t0, t1; 425 unsigned long long t0, t1;
426 struct perf_evsel *counter; 426 struct evsel *counter;
427 struct timespec ts; 427 struct timespec ts;
428 size_t l; 428 size_t l;
429 int status = 0; 429 int status = 0;
@@ -868,7 +868,7 @@ static int perf_stat__get_core_cached(struct perf_stat_config *config,
868 868
869static bool term_percore_set(void) 869static bool term_percore_set(void)
870{ 870{
871 struct perf_evsel *counter; 871 struct evsel *counter;
872 872
873 evlist__for_each_entry(evsel_list, counter) { 873 evlist__for_each_entry(evsel_list, counter) {
874 if (counter->percore) 874 if (counter->percore)
@@ -1462,7 +1462,7 @@ static int process_stat_round_event(struct perf_session *session,
1462 union perf_event *event) 1462 union perf_event *event)
1463{ 1463{
1464 struct stat_round_event *stat_round = &event->stat_round; 1464 struct stat_round_event *stat_round = &event->stat_round;
1465 struct perf_evsel *counter; 1465 struct evsel *counter;
1466 struct timespec tsh, *ts = NULL; 1466 struct timespec tsh, *ts = NULL;
1467 const char **argv = session->header.env.cmdline_argv; 1467 const char **argv = session->header.env.cmdline_argv;
1468 int argc = session->header.env.nr_cmdline; 1468 int argc = session->header.env.nr_cmdline;
@@ -1676,7 +1676,7 @@ static void setup_system_wide(int forks)
1676 if (!forks) 1676 if (!forks)
1677 target.system_wide = true; 1677 target.system_wide = true;
1678 else { 1678 else {
1679 struct perf_evsel *counter; 1679 struct evsel *counter;
1680 1680
1681 evlist__for_each_entry(evsel_list, counter) { 1681 evlist__for_each_entry(evsel_list, counter) {
1682 if (!counter->system_wide) 1682 if (!counter->system_wide)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 4bde3fa245d1..f5f70c83d304 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -545,14 +545,14 @@ exit:
545} 545}
546 546
547typedef int (*tracepoint_handler)(struct timechart *tchart, 547typedef int (*tracepoint_handler)(struct timechart *tchart,
548 struct perf_evsel *evsel, 548 struct evsel *evsel,
549 struct perf_sample *sample, 549 struct perf_sample *sample,
550 const char *backtrace); 550 const char *backtrace);
551 551
552static int process_sample_event(struct perf_tool *tool, 552static int process_sample_event(struct perf_tool *tool,
553 union perf_event *event, 553 union perf_event *event,
554 struct perf_sample *sample, 554 struct perf_sample *sample,
555 struct perf_evsel *evsel, 555 struct evsel *evsel,
556 struct machine *machine) 556 struct machine *machine)
557{ 557{
558 struct timechart *tchart = container_of(tool, struct timechart, tool); 558 struct timechart *tchart = container_of(tool, struct timechart, tool);
@@ -575,7 +575,7 @@ static int process_sample_event(struct perf_tool *tool,
575 575
576static int 576static int
577process_sample_cpu_idle(struct timechart *tchart __maybe_unused, 577process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
578 struct perf_evsel *evsel, 578 struct evsel *evsel,
579 struct perf_sample *sample, 579 struct perf_sample *sample,
580 const char *backtrace __maybe_unused) 580 const char *backtrace __maybe_unused)
581{ 581{
@@ -591,7 +591,7 @@ process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
591 591
592static int 592static int
593process_sample_cpu_frequency(struct timechart *tchart, 593process_sample_cpu_frequency(struct timechart *tchart,
594 struct perf_evsel *evsel, 594 struct evsel *evsel,
595 struct perf_sample *sample, 595 struct perf_sample *sample,
596 const char *backtrace __maybe_unused) 596 const char *backtrace __maybe_unused)
597{ 597{
@@ -604,7 +604,7 @@ process_sample_cpu_frequency(struct timechart *tchart,
604 604
605static int 605static int
606process_sample_sched_wakeup(struct timechart *tchart, 606process_sample_sched_wakeup(struct timechart *tchart,
607 struct perf_evsel *evsel, 607 struct evsel *evsel,
608 struct perf_sample *sample, 608 struct perf_sample *sample,
609 const char *backtrace) 609 const char *backtrace)
610{ 610{
@@ -618,7 +618,7 @@ process_sample_sched_wakeup(struct timechart *tchart,
618 618
619static int 619static int
620process_sample_sched_switch(struct timechart *tchart, 620process_sample_sched_switch(struct timechart *tchart,
621 struct perf_evsel *evsel, 621 struct evsel *evsel,
622 struct perf_sample *sample, 622 struct perf_sample *sample,
623 const char *backtrace) 623 const char *backtrace)
624{ 624{
@@ -634,7 +634,7 @@ process_sample_sched_switch(struct timechart *tchart,
634#ifdef SUPPORT_OLD_POWER_EVENTS 634#ifdef SUPPORT_OLD_POWER_EVENTS
635static int 635static int
636process_sample_power_start(struct timechart *tchart __maybe_unused, 636process_sample_power_start(struct timechart *tchart __maybe_unused,
637 struct perf_evsel *evsel, 637 struct evsel *evsel,
638 struct perf_sample *sample, 638 struct perf_sample *sample,
639 const char *backtrace __maybe_unused) 639 const char *backtrace __maybe_unused)
640{ 640{
@@ -647,7 +647,7 @@ process_sample_power_start(struct timechart *tchart __maybe_unused,
647 647
648static int 648static int
649process_sample_power_end(struct timechart *tchart, 649process_sample_power_end(struct timechart *tchart,
650 struct perf_evsel *evsel __maybe_unused, 650 struct evsel *evsel __maybe_unused,
651 struct perf_sample *sample, 651 struct perf_sample *sample,
652 const char *backtrace __maybe_unused) 652 const char *backtrace __maybe_unused)
653{ 653{
@@ -657,7 +657,7 @@ process_sample_power_end(struct timechart *tchart,
657 657
658static int 658static int
659process_sample_power_frequency(struct timechart *tchart, 659process_sample_power_frequency(struct timechart *tchart,
660 struct perf_evsel *evsel, 660 struct evsel *evsel,
661 struct perf_sample *sample, 661 struct perf_sample *sample,
662 const char *backtrace __maybe_unused) 662 const char *backtrace __maybe_unused)
663{ 663{
@@ -840,7 +840,7 @@ static int pid_end_io_sample(struct timechart *tchart, int pid, int type,
840 840
841static int 841static int
842process_enter_read(struct timechart *tchart, 842process_enter_read(struct timechart *tchart,
843 struct perf_evsel *evsel, 843 struct evsel *evsel,
844 struct perf_sample *sample) 844 struct perf_sample *sample)
845{ 845{
846 long fd = perf_evsel__intval(evsel, sample, "fd"); 846 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -850,7 +850,7 @@ process_enter_read(struct timechart *tchart,
850 850
851static int 851static int
852process_exit_read(struct timechart *tchart, 852process_exit_read(struct timechart *tchart,
853 struct perf_evsel *evsel, 853 struct evsel *evsel,
854 struct perf_sample *sample) 854 struct perf_sample *sample)
855{ 855{
856 long ret = perf_evsel__intval(evsel, sample, "ret"); 856 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -860,7 +860,7 @@ process_exit_read(struct timechart *tchart,
860 860
861static int 861static int
862process_enter_write(struct timechart *tchart, 862process_enter_write(struct timechart *tchart,
863 struct perf_evsel *evsel, 863 struct evsel *evsel,
864 struct perf_sample *sample) 864 struct perf_sample *sample)
865{ 865{
866 long fd = perf_evsel__intval(evsel, sample, "fd"); 866 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -870,7 +870,7 @@ process_enter_write(struct timechart *tchart,
870 870
871static int 871static int
872process_exit_write(struct timechart *tchart, 872process_exit_write(struct timechart *tchart,
873 struct perf_evsel *evsel, 873 struct evsel *evsel,
874 struct perf_sample *sample) 874 struct perf_sample *sample)
875{ 875{
876 long ret = perf_evsel__intval(evsel, sample, "ret"); 876 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -880,7 +880,7 @@ process_exit_write(struct timechart *tchart,
880 880
881static int 881static int
882process_enter_sync(struct timechart *tchart, 882process_enter_sync(struct timechart *tchart,
883 struct perf_evsel *evsel, 883 struct evsel *evsel,
884 struct perf_sample *sample) 884 struct perf_sample *sample)
885{ 885{
886 long fd = perf_evsel__intval(evsel, sample, "fd"); 886 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -890,7 +890,7 @@ process_enter_sync(struct timechart *tchart,
890 890
891static int 891static int
892process_exit_sync(struct timechart *tchart, 892process_exit_sync(struct timechart *tchart,
893 struct perf_evsel *evsel, 893 struct evsel *evsel,
894 struct perf_sample *sample) 894 struct perf_sample *sample)
895{ 895{
896 long ret = perf_evsel__intval(evsel, sample, "ret"); 896 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -900,7 +900,7 @@ process_exit_sync(struct timechart *tchart,
900 900
901static int 901static int
902process_enter_tx(struct timechart *tchart, 902process_enter_tx(struct timechart *tchart,
903 struct perf_evsel *evsel, 903 struct evsel *evsel,
904 struct perf_sample *sample) 904 struct perf_sample *sample)
905{ 905{
906 long fd = perf_evsel__intval(evsel, sample, "fd"); 906 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -910,7 +910,7 @@ process_enter_tx(struct timechart *tchart,
910 910
911static int 911static int
912process_exit_tx(struct timechart *tchart, 912process_exit_tx(struct timechart *tchart,
913 struct perf_evsel *evsel, 913 struct evsel *evsel,
914 struct perf_sample *sample) 914 struct perf_sample *sample)
915{ 915{
916 long ret = perf_evsel__intval(evsel, sample, "ret"); 916 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -920,7 +920,7 @@ process_exit_tx(struct timechart *tchart,
920 920
921static int 921static int
922process_enter_rx(struct timechart *tchart, 922process_enter_rx(struct timechart *tchart,
923 struct perf_evsel *evsel, 923 struct evsel *evsel,
924 struct perf_sample *sample) 924 struct perf_sample *sample)
925{ 925{
926 long fd = perf_evsel__intval(evsel, sample, "fd"); 926 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -930,7 +930,7 @@ process_enter_rx(struct timechart *tchart,
930 930
931static int 931static int
932process_exit_rx(struct timechart *tchart, 932process_exit_rx(struct timechart *tchart,
933 struct perf_evsel *evsel, 933 struct evsel *evsel,
934 struct perf_sample *sample) 934 struct perf_sample *sample)
935{ 935{
936 long ret = perf_evsel__intval(evsel, sample, "ret"); 936 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -940,7 +940,7 @@ process_exit_rx(struct timechart *tchart,
940 940
941static int 941static int
942process_enter_poll(struct timechart *tchart, 942process_enter_poll(struct timechart *tchart,
943 struct perf_evsel *evsel, 943 struct evsel *evsel,
944 struct perf_sample *sample) 944 struct perf_sample *sample)
945{ 945{
946 long fd = perf_evsel__intval(evsel, sample, "fd"); 946 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -950,7 +950,7 @@ process_enter_poll(struct timechart *tchart,
950 950
951static int 951static int
952process_exit_poll(struct timechart *tchart, 952process_exit_poll(struct timechart *tchart,
953 struct perf_evsel *evsel, 953 struct evsel *evsel,
954 struct perf_sample *sample) 954 struct perf_sample *sample)
955{ 955{
956 long ret = perf_evsel__intval(evsel, sample, "ret"); 956 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -1534,7 +1534,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
1534 1534
1535static int __cmd_timechart(struct timechart *tchart, const char *output_name) 1535static int __cmd_timechart(struct timechart *tchart, const char *output_name)
1536{ 1536{
1537 const struct perf_evsel_str_handler power_tracepoints[] = { 1537 const struct evsel_str_handler power_tracepoints[] = {
1538 { "power:cpu_idle", process_sample_cpu_idle }, 1538 { "power:cpu_idle", process_sample_cpu_idle },
1539 { "power:cpu_frequency", process_sample_cpu_frequency }, 1539 { "power:cpu_frequency", process_sample_cpu_frequency },
1540 { "sched:sched_wakeup", process_sample_sched_wakeup }, 1540 { "sched:sched_wakeup", process_sample_sched_wakeup },
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index b46b3c9f57a0..2f22f313985e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -101,7 +101,7 @@ static void perf_top__resize(struct perf_top *top)
101 101
102static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he) 102static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
103{ 103{
104 struct perf_evsel *evsel; 104 struct evsel *evsel;
105 struct symbol *sym; 105 struct symbol *sym;
106 struct annotation *notes; 106 struct annotation *notes;
107 struct map *map; 107 struct map *map;
@@ -186,7 +186,7 @@ static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
186static void perf_top__record_precise_ip(struct perf_top *top, 186static void perf_top__record_precise_ip(struct perf_top *top,
187 struct hist_entry *he, 187 struct hist_entry *he,
188 struct perf_sample *sample, 188 struct perf_sample *sample,
189 struct perf_evsel *evsel, u64 ip) 189 struct evsel *evsel, u64 ip)
190{ 190{
191 struct annotation *notes; 191 struct annotation *notes;
192 struct symbol *sym = he->ms.sym; 192 struct symbol *sym = he->ms.sym;
@@ -228,7 +228,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
228static void perf_top__show_details(struct perf_top *top) 228static void perf_top__show_details(struct perf_top *top)
229{ 229{
230 struct hist_entry *he = top->sym_filter_entry; 230 struct hist_entry *he = top->sym_filter_entry;
231 struct perf_evsel *evsel; 231 struct evsel *evsel;
232 struct annotation *notes; 232 struct annotation *notes;
233 struct symbol *symbol; 233 struct symbol *symbol;
234 int more; 234 int more;
@@ -270,7 +270,7 @@ static void perf_top__print_sym_table(struct perf_top *top)
270 char bf[160]; 270 char bf[160];
271 int printed = 0; 271 int printed = 0;
272 const int win_width = top->winsize.ws_col - 1; 272 const int win_width = top->winsize.ws_col - 1;
273 struct perf_evsel *evsel = top->sym_evsel; 273 struct evsel *evsel = top->sym_evsel;
274 struct hists *hists = evsel__hists(evsel); 274 struct hists *hists = evsel__hists(evsel);
275 275
276 puts(CONSOLE_CLEAR); 276 puts(CONSOLE_CLEAR);
@@ -554,7 +554,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
554static void perf_top__sort_new_samples(void *arg) 554static void perf_top__sort_new_samples(void *arg)
555{ 555{
556 struct perf_top *t = arg; 556 struct perf_top *t = arg;
557 struct perf_evsel *evsel = t->sym_evsel; 557 struct evsel *evsel = t->sym_evsel;
558 struct hists *hists; 558 struct hists *hists;
559 559
560 if (t->evlist->selected != NULL) 560 if (t->evlist->selected != NULL)
@@ -586,7 +586,7 @@ static void stop_top(void)
586 586
587static void *display_thread_tui(void *arg) 587static void *display_thread_tui(void *arg)
588{ 588{
589 struct perf_evsel *pos; 589 struct evsel *pos;
590 struct perf_top *top = arg; 590 struct perf_top *top = arg;
591 const char *help = "For a higher level overview, try: perf top --sort comm,dso"; 591 const char *help = "For a higher level overview, try: perf top --sort comm,dso";
592 struct hist_browser_timer hbt = { 592 struct hist_browser_timer hbt = {
@@ -693,7 +693,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
693{ 693{
694 struct perf_top *top = arg; 694 struct perf_top *top = arg;
695 struct hist_entry *he = iter->he; 695 struct hist_entry *he = iter->he;
696 struct perf_evsel *evsel = iter->evsel; 696 struct evsel *evsel = iter->evsel;
697 697
698 if (perf_hpp_list.sym && single) 698 if (perf_hpp_list.sym && single)
699 perf_top__record_precise_ip(top, he, iter->sample, evsel, al->addr); 699 perf_top__record_precise_ip(top, he, iter->sample, evsel, al->addr);
@@ -705,7 +705,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
705 705
706static void perf_event__process_sample(struct perf_tool *tool, 706static void perf_event__process_sample(struct perf_tool *tool,
707 const union perf_event *event, 707 const union perf_event *event,
708 struct perf_evsel *evsel, 708 struct evsel *evsel,
709 struct perf_sample *sample, 709 struct perf_sample *sample,
710 struct machine *machine) 710 struct machine *machine)
711{ 711{
@@ -813,7 +813,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
813 813
814static void 814static void
815perf_top__process_lost(struct perf_top *top, union perf_event *event, 815perf_top__process_lost(struct perf_top *top, union perf_event *event,
816 struct perf_evsel *evsel) 816 struct evsel *evsel)
817{ 817{
818 struct hists *hists = evsel__hists(evsel); 818 struct hists *hists = evsel__hists(evsel);
819 819
@@ -825,7 +825,7 @@ perf_top__process_lost(struct perf_top *top, union perf_event *event,
825static void 825static void
826perf_top__process_lost_samples(struct perf_top *top, 826perf_top__process_lost_samples(struct perf_top *top,
827 union perf_event *event, 827 union perf_event *event,
828 struct perf_evsel *evsel) 828 struct evsel *evsel)
829{ 829{
830 struct hists *hists = evsel__hists(evsel); 830 struct hists *hists = evsel__hists(evsel);
831 831
@@ -912,7 +912,7 @@ static int perf_top__overwrite_check(struct perf_top *top)
912 struct perf_evlist *evlist = top->evlist; 912 struct perf_evlist *evlist = top->evlist;
913 struct perf_evsel_config_term *term; 913 struct perf_evsel_config_term *term;
914 struct list_head *config_terms; 914 struct list_head *config_terms;
915 struct perf_evsel *evsel; 915 struct evsel *evsel;
916 int set, overwrite = -1; 916 int set, overwrite = -1;
917 917
918 evlist__for_each_entry(evlist, evsel) { 918 evlist__for_each_entry(evlist, evsel) {
@@ -952,11 +952,11 @@ static int perf_top__overwrite_check(struct perf_top *top)
952} 952}
953 953
954static int perf_top_overwrite_fallback(struct perf_top *top, 954static int perf_top_overwrite_fallback(struct perf_top *top,
955 struct perf_evsel *evsel) 955 struct evsel *evsel)
956{ 956{
957 struct record_opts *opts = &top->record_opts; 957 struct record_opts *opts = &top->record_opts;
958 struct perf_evlist *evlist = top->evlist; 958 struct perf_evlist *evlist = top->evlist;
959 struct perf_evsel *counter; 959 struct evsel *counter;
960 960
961 if (!opts->overwrite) 961 if (!opts->overwrite)
962 return 0; 962 return 0;
@@ -975,7 +975,7 @@ static int perf_top_overwrite_fallback(struct perf_top *top,
975static int perf_top__start_counters(struct perf_top *top) 975static int perf_top__start_counters(struct perf_top *top)
976{ 976{
977 char msg[BUFSIZ]; 977 char msg[BUFSIZ];
978 struct perf_evsel *counter; 978 struct evsel *counter;
979 struct perf_evlist *evlist = top->evlist; 979 struct perf_evlist *evlist = top->evlist;
980 struct record_opts *opts = &top->record_opts; 980 struct record_opts *opts = &top->record_opts;
981 981
@@ -1104,7 +1104,7 @@ static int deliver_event(struct ordered_events *qe,
1104 struct perf_session *session = top->session; 1104 struct perf_session *session = top->session;
1105 union perf_event *event = qevent->event; 1105 union perf_event *event = qevent->event;
1106 struct perf_sample sample; 1106 struct perf_sample sample;
1107 struct perf_evsel *evsel; 1107 struct evsel *evsel;
1108 struct machine *machine; 1108 struct machine *machine;
1109 int ret = -1; 1109 int ret = -1;
1110 1110
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index ca28c48f812e..fde7eff811f9 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -86,7 +86,7 @@ struct trace {
86 *sys_exit; 86 *sys_exit;
87 } prog_array; 87 } prog_array;
88 struct { 88 struct {
89 struct perf_evsel *sys_enter, 89 struct evsel *sys_enter,
90 *sys_exit, 90 *sys_exit,
91 *augmented; 91 *augmented;
92 } events; 92 } events;
@@ -242,7 +242,7 @@ struct syscall_tp {
242 }; 242 };
243}; 243};
244 244
245static int perf_evsel__init_tp_uint_field(struct perf_evsel *evsel, 245static int perf_evsel__init_tp_uint_field(struct evsel *evsel,
246 struct tp_field *field, 246 struct tp_field *field,
247 const char *name) 247 const char *name)
248{ 248{
@@ -258,7 +258,7 @@ static int perf_evsel__init_tp_uint_field(struct perf_evsel *evsel,
258 ({ struct syscall_tp *sc = evsel->priv;\ 258 ({ struct syscall_tp *sc = evsel->priv;\
259 perf_evsel__init_tp_uint_field(evsel, &sc->name, #name); }) 259 perf_evsel__init_tp_uint_field(evsel, &sc->name, #name); })
260 260
261static int perf_evsel__init_tp_ptr_field(struct perf_evsel *evsel, 261static int perf_evsel__init_tp_ptr_field(struct evsel *evsel,
262 struct tp_field *field, 262 struct tp_field *field,
263 const char *name) 263 const char *name)
264{ 264{
@@ -274,13 +274,13 @@ static int perf_evsel__init_tp_ptr_field(struct perf_evsel *evsel,
274 ({ struct syscall_tp *sc = evsel->priv;\ 274 ({ struct syscall_tp *sc = evsel->priv;\
275 perf_evsel__init_tp_ptr_field(evsel, &sc->name, #name); }) 275 perf_evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
276 276
277static void perf_evsel__delete_priv(struct perf_evsel *evsel) 277static void perf_evsel__delete_priv(struct evsel *evsel)
278{ 278{
279 zfree(&evsel->priv); 279 zfree(&evsel->priv);
280 perf_evsel__delete(evsel); 280 perf_evsel__delete(evsel);
281} 281}
282 282
283static int perf_evsel__init_syscall_tp(struct perf_evsel *evsel) 283static int perf_evsel__init_syscall_tp(struct evsel *evsel)
284{ 284{
285 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp)); 285 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp));
286 286
@@ -297,7 +297,7 @@ out_delete:
297 return -ENOENT; 297 return -ENOENT;
298} 298}
299 299
300static int perf_evsel__init_augmented_syscall_tp(struct perf_evsel *evsel, struct perf_evsel *tp) 300static int perf_evsel__init_augmented_syscall_tp(struct evsel *evsel, struct evsel *tp)
301{ 301{
302 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp)); 302 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp));
303 303
@@ -319,21 +319,21 @@ out_delete:
319 return -EINVAL; 319 return -EINVAL;
320} 320}
321 321
322static int perf_evsel__init_augmented_syscall_tp_args(struct perf_evsel *evsel) 322static int perf_evsel__init_augmented_syscall_tp_args(struct evsel *evsel)
323{ 323{
324 struct syscall_tp *sc = evsel->priv; 324 struct syscall_tp *sc = evsel->priv;
325 325
326 return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64)); 326 return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64));
327} 327}
328 328
329static int perf_evsel__init_augmented_syscall_tp_ret(struct perf_evsel *evsel) 329static int perf_evsel__init_augmented_syscall_tp_ret(struct evsel *evsel)
330{ 330{
331 struct syscall_tp *sc = evsel->priv; 331 struct syscall_tp *sc = evsel->priv;
332 332
333 return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap); 333 return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap);
334} 334}
335 335
336static int perf_evsel__init_raw_syscall_tp(struct perf_evsel *evsel, void *handler) 336static int perf_evsel__init_raw_syscall_tp(struct evsel *evsel, void *handler)
337{ 337{
338 evsel->priv = malloc(sizeof(struct syscall_tp)); 338 evsel->priv = malloc(sizeof(struct syscall_tp));
339 if (evsel->priv != NULL) { 339 if (evsel->priv != NULL) {
@@ -351,9 +351,9 @@ out_delete:
351 return -ENOENT; 351 return -ENOENT;
352} 352}
353 353
354static struct perf_evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *handler) 354static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *handler)
355{ 355{
356 struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); 356 struct evsel *evsel = perf_evsel__newtp("raw_syscalls", direction);
357 357
358 /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ 358 /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */
359 if (IS_ERR(evsel)) 359 if (IS_ERR(evsel))
@@ -1775,12 +1775,12 @@ next_arg:
1775 return printed; 1775 return printed;
1776} 1776}
1777 1777
1778typedef int (*tracepoint_handler)(struct trace *trace, struct perf_evsel *evsel, 1778typedef int (*tracepoint_handler)(struct trace *trace, struct evsel *evsel,
1779 union perf_event *event, 1779 union perf_event *event,
1780 struct perf_sample *sample); 1780 struct perf_sample *sample);
1781 1781
1782static struct syscall *trace__syscall_info(struct trace *trace, 1782static struct syscall *trace__syscall_info(struct trace *trace,
1783 struct perf_evsel *evsel, int id) 1783 struct evsel *evsel, int id)
1784{ 1784{
1785 int err = 0; 1785 int err = 0;
1786 1786
@@ -1886,7 +1886,7 @@ static int trace__printf_interrupted_entry(struct trace *trace)
1886 return printed; 1886 return printed;
1887} 1887}
1888 1888
1889static int trace__fprintf_sample(struct trace *trace, struct perf_evsel *evsel, 1889static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel,
1890 struct perf_sample *sample, struct thread *thread) 1890 struct perf_sample *sample, struct thread *thread)
1891{ 1891{
1892 int printed = 0; 1892 int printed = 0;
@@ -1929,7 +1929,7 @@ static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sam
1929 return augmented_args; 1929 return augmented_args;
1930} 1930}
1931 1931
1932static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, 1932static int trace__sys_enter(struct trace *trace, struct evsel *evsel,
1933 union perf_event *event __maybe_unused, 1933 union perf_event *event __maybe_unused,
1934 struct perf_sample *sample) 1934 struct perf_sample *sample)
1935{ 1935{
@@ -2008,7 +2008,7 @@ out_put:
2008 return err; 2008 return err;
2009} 2009}
2010 2010
2011static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evsel, 2011static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel,
2012 struct perf_sample *sample) 2012 struct perf_sample *sample)
2013{ 2013{
2014 struct thread_trace *ttrace; 2014 struct thread_trace *ttrace;
@@ -2041,7 +2041,7 @@ out_put:
2041 return err; 2041 return err;
2042} 2042}
2043 2043
2044static int trace__resolve_callchain(struct trace *trace, struct perf_evsel *evsel, 2044static int trace__resolve_callchain(struct trace *trace, struct evsel *evsel,
2045 struct perf_sample *sample, 2045 struct perf_sample *sample,
2046 struct callchain_cursor *cursor) 2046 struct callchain_cursor *cursor)
2047{ 2047{
@@ -2069,7 +2069,7 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
2069 return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output); 2069 return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
2070} 2070}
2071 2071
2072static const char *errno_to_name(struct perf_evsel *evsel, int err) 2072static const char *errno_to_name(struct evsel *evsel, int err)
2073{ 2073{
2074 struct perf_env *env = perf_evsel__env(evsel); 2074 struct perf_env *env = perf_evsel__env(evsel);
2075 const char *arch_name = perf_env__arch(env); 2075 const char *arch_name = perf_env__arch(env);
@@ -2077,7 +2077,7 @@ static const char *errno_to_name(struct perf_evsel *evsel, int err)
2077 return arch_syscalls__strerrno(arch_name, err); 2077 return arch_syscalls__strerrno(arch_name, err);
2078} 2078}
2079 2079
2080static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, 2080static int trace__sys_exit(struct trace *trace, struct evsel *evsel,
2081 union perf_event *event __maybe_unused, 2081 union perf_event *event __maybe_unused,
2082 struct perf_sample *sample) 2082 struct perf_sample *sample)
2083{ 2083{
@@ -2211,7 +2211,7 @@ out_put:
2211 return err; 2211 return err;
2212} 2212}
2213 2213
2214static int trace__vfs_getname(struct trace *trace, struct perf_evsel *evsel, 2214static int trace__vfs_getname(struct trace *trace, struct evsel *evsel,
2215 union perf_event *event __maybe_unused, 2215 union perf_event *event __maybe_unused,
2216 struct perf_sample *sample) 2216 struct perf_sample *sample)
2217{ 2217{
@@ -2272,7 +2272,7 @@ out:
2272 return 0; 2272 return 0;
2273} 2273}
2274 2274
2275static int trace__sched_stat_runtime(struct trace *trace, struct perf_evsel *evsel, 2275static int trace__sched_stat_runtime(struct trace *trace, struct evsel *evsel,
2276 union perf_event *event __maybe_unused, 2276 union perf_event *event __maybe_unused,
2277 struct perf_sample *sample) 2277 struct perf_sample *sample)
2278{ 2278{
@@ -2334,7 +2334,7 @@ static void bpf_output__fprintf(struct trace *trace,
2334 ++trace->nr_events_printed; 2334 ++trace->nr_events_printed;
2335} 2335}
2336 2336
2337static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel, 2337static int trace__event_handler(struct trace *trace, struct evsel *evsel,
2338 union perf_event *event __maybe_unused, 2338 union perf_event *event __maybe_unused,
2339 struct perf_sample *sample) 2339 struct perf_sample *sample)
2340{ 2340{
@@ -2436,7 +2436,7 @@ static void print_location(FILE *f, struct perf_sample *sample,
2436} 2436}
2437 2437
2438static int trace__pgfault(struct trace *trace, 2438static int trace__pgfault(struct trace *trace,
2439 struct perf_evsel *evsel, 2439 struct evsel *evsel,
2440 union perf_event *event __maybe_unused, 2440 union perf_event *event __maybe_unused,
2441 struct perf_sample *sample) 2441 struct perf_sample *sample)
2442{ 2442{
@@ -2511,7 +2511,7 @@ out_put:
2511} 2511}
2512 2512
2513static void trace__set_base_time(struct trace *trace, 2513static void trace__set_base_time(struct trace *trace,
2514 struct perf_evsel *evsel, 2514 struct evsel *evsel,
2515 struct perf_sample *sample) 2515 struct perf_sample *sample)
2516{ 2516{
2517 /* 2517 /*
@@ -2530,7 +2530,7 @@ static void trace__set_base_time(struct trace *trace,
2530static int trace__process_sample(struct perf_tool *tool, 2530static int trace__process_sample(struct perf_tool *tool,
2531 union perf_event *event, 2531 union perf_event *event,
2532 struct perf_sample *sample, 2532 struct perf_sample *sample,
2533 struct perf_evsel *evsel, 2533 struct evsel *evsel,
2534 struct machine *machine __maybe_unused) 2534 struct machine *machine __maybe_unused)
2535{ 2535{
2536 struct trace *trace = container_of(tool, struct trace, tool); 2536 struct trace *trace = container_of(tool, struct trace, tool);
@@ -2619,7 +2619,7 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp);
2619static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) 2619static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist)
2620{ 2620{
2621 bool found = false; 2621 bool found = false;
2622 struct perf_evsel *evsel, *tmp; 2622 struct evsel *evsel, *tmp;
2623 struct parse_events_error err = { .idx = 0, }; 2623 struct parse_events_error err = { .idx = 0, };
2624 int ret = parse_events(evlist, "probe:vfs_getname*", &err); 2624 int ret = parse_events(evlist, "probe:vfs_getname*", &err);
2625 2625
@@ -2644,9 +2644,9 @@ static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist)
2644 return found; 2644 return found;
2645} 2645}
2646 2646
2647static struct perf_evsel *perf_evsel__new_pgfault(u64 config) 2647static struct evsel *perf_evsel__new_pgfault(u64 config)
2648{ 2648{
2649 struct perf_evsel *evsel; 2649 struct evsel *evsel;
2650 struct perf_event_attr attr = { 2650 struct perf_event_attr attr = {
2651 .type = PERF_TYPE_SOFTWARE, 2651 .type = PERF_TYPE_SOFTWARE,
2652 .mmap_data = 1, 2652 .mmap_data = 1,
@@ -2667,7 +2667,7 @@ static struct perf_evsel *perf_evsel__new_pgfault(u64 config)
2667static void trace__handle_event(struct trace *trace, union perf_event *event, struct perf_sample *sample) 2667static void trace__handle_event(struct trace *trace, union perf_event *event, struct perf_sample *sample)
2668{ 2668{
2669 const u32 type = event->header.type; 2669 const u32 type = event->header.type;
2670 struct perf_evsel *evsel; 2670 struct evsel *evsel;
2671 2671
2672 if (type != PERF_RECORD_SAMPLE) { 2672 if (type != PERF_RECORD_SAMPLE) {
2673 trace__process_event(trace, trace->host, event, sample); 2673 trace__process_event(trace, trace->host, event, sample);
@@ -2700,7 +2700,7 @@ static int trace__add_syscall_newtp(struct trace *trace)
2700{ 2700{
2701 int ret = -1; 2701 int ret = -1;
2702 struct perf_evlist *evlist = trace->evlist; 2702 struct perf_evlist *evlist = trace->evlist;
2703 struct perf_evsel *sys_enter, *sys_exit; 2703 struct evsel *sys_enter, *sys_exit;
2704 2704
2705 sys_enter = perf_evsel__raw_syscall_newtp("sys_enter", trace__sys_enter); 2705 sys_enter = perf_evsel__raw_syscall_newtp("sys_enter", trace__sys_enter);
2706 if (sys_enter == NULL) 2706 if (sys_enter == NULL)
@@ -2748,7 +2748,7 @@ out_delete_sys_enter:
2748static int trace__set_ev_qualifier_tp_filter(struct trace *trace) 2748static int trace__set_ev_qualifier_tp_filter(struct trace *trace)
2749{ 2749{
2750 int err = -1; 2750 int err = -1;
2751 struct perf_evsel *sys_exit; 2751 struct evsel *sys_exit;
2752 char *filter = asprintf_expr_inout_ints("id", !trace->not_ev_qualifier, 2752 char *filter = asprintf_expr_inout_ints("id", !trace->not_ev_qualifier,
2753 trace->ev_qualifier_ids.nr, 2753 trace->ev_qualifier_ids.nr,
2754 trace->ev_qualifier_ids.entries); 2754 trace->ev_qualifier_ids.entries);
@@ -3251,7 +3251,7 @@ static int ordered_events__deliver_event(struct ordered_events *oe,
3251static int trace__run(struct trace *trace, int argc, const char **argv) 3251static int trace__run(struct trace *trace, int argc, const char **argv)
3252{ 3252{
3253 struct perf_evlist *evlist = trace->evlist; 3253 struct perf_evlist *evlist = trace->evlist;
3254 struct perf_evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL; 3254 struct evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL;
3255 int err = -1, i; 3255 int err = -1, i;
3256 unsigned long before; 3256 unsigned long before;
3257 const bool forks = argc > 0; 3257 const bool forks = argc > 0;
@@ -3543,7 +3543,7 @@ out_errno:
3543 3543
3544static int trace__replay(struct trace *trace) 3544static int trace__replay(struct trace *trace)
3545{ 3545{
3546 const struct perf_evsel_str_handler handlers[] = { 3546 const struct evsel_str_handler handlers[] = {
3547 { "probe:vfs_getname", trace__vfs_getname, }, 3547 { "probe:vfs_getname", trace__vfs_getname, },
3548 }; 3548 };
3549 struct perf_data data = { 3549 struct perf_data data = {
@@ -3552,7 +3552,7 @@ static int trace__replay(struct trace *trace)
3552 .force = trace->force, 3552 .force = trace->force,
3553 }; 3553 };
3554 struct perf_session *session; 3554 struct perf_session *session;
3555 struct perf_evsel *evsel; 3555 struct evsel *evsel;
3556 int err = -1; 3556 int err = -1;
3557 3557
3558 trace->tool.sample = trace__process_sample; 3558 trace->tool.sample = trace__process_sample;
@@ -3845,7 +3845,7 @@ static int parse_pagefaults(const struct option *opt, const char *str,
3845 3845
3846static void evlist__set_evsel_handler(struct perf_evlist *evlist, void *handler) 3846static void evlist__set_evsel_handler(struct perf_evlist *evlist, void *handler)
3847{ 3847{
3848 struct perf_evsel *evsel; 3848 struct evsel *evsel;
3849 3849
3850 evlist__for_each_entry(evlist, evsel) 3850 evlist__for_each_entry(evlist, evsel)
3851 evsel->handler = handler; 3851 evsel->handler = handler;
@@ -3853,7 +3853,7 @@ static void evlist__set_evsel_handler(struct perf_evlist *evlist, void *handler)
3853 3853
3854static int evlist__set_syscall_tp_fields(struct perf_evlist *evlist) 3854static int evlist__set_syscall_tp_fields(struct perf_evlist *evlist)
3855{ 3855{
3856 struct perf_evsel *evsel; 3856 struct evsel *evsel;
3857 3857
3858 evlist__for_each_entry(evlist, evsel) { 3858 evlist__for_each_entry(evlist, evsel) {
3859 if (evsel->priv || !evsel->tp_format) 3859 if (evsel->priv || !evsel->tp_format)
@@ -4161,7 +4161,7 @@ int cmd_trace(int argc, const char **argv)
4161 }; 4161 };
4162 bool __maybe_unused max_stack_user_set = true; 4162 bool __maybe_unused max_stack_user_set = true;
4163 bool mmap_pages_user_set = true; 4163 bool mmap_pages_user_set = true;
4164 struct perf_evsel *evsel; 4164 struct evsel *evsel;
4165 const char * const trace_subcommands[] = { "record", NULL }; 4165 const char * const trace_subcommands[] = { "record", NULL };
4166 int err = -1; 4166 int err = -1;
4167 char bf[BUFSIZ]; 4167 char bf[BUFSIZ];
@@ -4305,7 +4305,7 @@ int cmd_trace(int argc, const char **argv)
4305 4305
4306 if (trace.syscalls.events.augmented->priv == NULL && 4306 if (trace.syscalls.events.augmented->priv == NULL &&
4307 strstr(perf_evsel__name(evsel), "syscalls:sys_enter")) { 4307 strstr(perf_evsel__name(evsel), "syscalls:sys_enter")) {
4308 struct perf_evsel *augmented = trace.syscalls.events.augmented; 4308 struct evsel *augmented = trace.syscalls.events.augmented;
4309 if (perf_evsel__init_augmented_syscall_tp(augmented, evsel) || 4309 if (perf_evsel__init_augmented_syscall_tp(augmented, evsel) ||
4310 perf_evsel__init_augmented_syscall_tp_args(augmented)) 4310 perf_evsel__init_augmented_syscall_tp_args(augmented))
4311 goto out; 4311 goto out;
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 1a9c3becf5ff..921af318507c 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -83,7 +83,7 @@ int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __m
83 int ret = TEST_SKIP, err, sample_count = 0, comm_count = 0; 83 int ret = TEST_SKIP, err, sample_count = 0, comm_count = 0;
84 char pid[16], sbuf[STRERR_BUFSIZE]; 84 char pid[16], sbuf[STRERR_BUFSIZE];
85 struct perf_evlist *evlist; 85 struct perf_evlist *evlist;
86 struct perf_evsel *evsel __maybe_unused; 86 struct evsel *evsel __maybe_unused;
87 struct parse_events_error parse_error; 87 struct parse_events_error parse_error;
88 struct record_opts opts = { 88 struct record_opts opts = {
89 .target = { 89 .target = {
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 88c218eacc43..062d23bba2df 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -555,7 +555,7 @@ static int do_test_code_reading(bool try_kcore)
555 struct perf_thread_map *threads = NULL; 555 struct perf_thread_map *threads = NULL;
556 struct perf_cpu_map *cpus = NULL; 556 struct perf_cpu_map *cpus = NULL;
557 struct perf_evlist *evlist = NULL; 557 struct perf_evlist *evlist = NULL;
558 struct perf_evsel *evsel = NULL; 558 struct evsel *evsel = NULL;
559 int err = -1, ret; 559 int err = -1, ret;
560 pid_t pid; 560 pid_t pid;
561 struct map *map; 561 struct map *map;
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c
index 684ad56f7b0f..45fe674233d7 100644
--- a/tools/perf/tests/event-times.c
+++ b/tools/perf/tests/event-times.c
@@ -14,7 +14,7 @@
14 14
15static int attach__enable_on_exec(struct perf_evlist *evlist) 15static int attach__enable_on_exec(struct perf_evlist *evlist)
16{ 16{
17 struct perf_evsel *evsel = perf_evlist__last(evlist); 17 struct evsel *evsel = perf_evlist__last(evlist);
18 struct target target = { 18 struct target target = {
19 .uid = UINT_MAX, 19 .uid = UINT_MAX,
20 }; 20 };
@@ -56,7 +56,7 @@ static int detach__enable_on_exec(struct perf_evlist *evlist)
56 56
57static int attach__current_disabled(struct perf_evlist *evlist) 57static int attach__current_disabled(struct perf_evlist *evlist)
58{ 58{
59 struct perf_evsel *evsel = perf_evlist__last(evlist); 59 struct evsel *evsel = perf_evlist__last(evlist);
60 struct perf_thread_map *threads; 60 struct perf_thread_map *threads;
61 int err; 61 int err;
62 62
@@ -82,7 +82,7 @@ static int attach__current_disabled(struct perf_evlist *evlist)
82 82
83static int attach__current_enabled(struct perf_evlist *evlist) 83static int attach__current_enabled(struct perf_evlist *evlist)
84{ 84{
85 struct perf_evsel *evsel = perf_evlist__last(evlist); 85 struct evsel *evsel = perf_evlist__last(evlist);
86 struct perf_thread_map *threads; 86 struct perf_thread_map *threads;
87 int err; 87 int err;
88 88
@@ -102,14 +102,14 @@ static int attach__current_enabled(struct perf_evlist *evlist)
102 102
103static int detach__disable(struct perf_evlist *evlist) 103static int detach__disable(struct perf_evlist *evlist)
104{ 104{
105 struct perf_evsel *evsel = perf_evlist__last(evlist); 105 struct evsel *evsel = perf_evlist__last(evlist);
106 106
107 return perf_evsel__enable(evsel); 107 return perf_evsel__enable(evsel);
108} 108}
109 109
110static int attach__cpu_disabled(struct perf_evlist *evlist) 110static int attach__cpu_disabled(struct perf_evlist *evlist)
111{ 111{
112 struct perf_evsel *evsel = perf_evlist__last(evlist); 112 struct evsel *evsel = perf_evlist__last(evlist);
113 struct perf_cpu_map *cpus; 113 struct perf_cpu_map *cpus;
114 int err; 114 int err;
115 115
@@ -138,7 +138,7 @@ static int attach__cpu_disabled(struct perf_evlist *evlist)
138 138
139static int attach__cpu_enabled(struct perf_evlist *evlist) 139static int attach__cpu_enabled(struct perf_evlist *evlist)
140{ 140{
141 struct perf_evsel *evsel = perf_evlist__last(evlist); 141 struct evsel *evsel = perf_evlist__last(evlist);
142 struct perf_cpu_map *cpus; 142 struct perf_cpu_map *cpus;
143 int err; 143 int err;
144 144
@@ -163,7 +163,7 @@ static int test_times(int (attach)(struct perf_evlist *),
163{ 163{
164 struct perf_counts_values count; 164 struct perf_counts_values count;
165 struct perf_evlist *evlist = NULL; 165 struct perf_evlist *evlist = NULL;
166 struct perf_evsel *evsel; 166 struct evsel *evsel;
167 int err = -1, i; 167 int err = -1, i;
168 168
169 evlist = perf_evlist__new(); 169 evlist = perf_evlist__new();
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index b5042f019ec4..0e5a2e8195e4 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -80,7 +80,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
80int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused) 80int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused)
81{ 81{
82 struct perf_evlist *evlist; 82 struct perf_evlist *evlist;
83 struct perf_evsel *evsel; 83 struct evsel *evsel;
84 struct event_name tmp; 84 struct event_name tmp;
85 85
86 evlist = perf_evlist__new_default(); 86 evlist = perf_evlist__new_default();
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c
index a104728ebf25..bb38489eda1e 100644
--- a/tools/perf/tests/evsel-roundtrip-name.c
+++ b/tools/perf/tests/evsel-roundtrip-name.c
@@ -11,7 +11,7 @@ static int perf_evsel__roundtrip_cache_name_test(void)
11{ 11{
12 char name[128]; 12 char name[128];
13 int type, op, err = 0, ret = 0, i, idx; 13 int type, op, err = 0, ret = 0, i, idx;
14 struct perf_evsel *evsel; 14 struct evsel *evsel;
15 struct perf_evlist *evlist = perf_evlist__new(); 15 struct perf_evlist *evlist = perf_evlist__new();
16 16
17 if (evlist == NULL) 17 if (evlist == NULL)
@@ -67,7 +67,7 @@ static int perf_evsel__roundtrip_cache_name_test(void)
67static int __perf_evsel__name_array_test(const char *names[], int nr_names) 67static int __perf_evsel__name_array_test(const char *names[], int nr_names)
68{ 68{
69 int i, err; 69 int i, err;
70 struct perf_evsel *evsel; 70 struct evsel *evsel;
71 struct perf_evlist *evlist = perf_evlist__new(); 71 struct perf_evlist *evlist = perf_evlist__new();
72 72
73 if (evlist == NULL) 73 if (evlist == NULL)
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c
index 71f60c0f9faa..0170e9d2e329 100644
--- a/tools/perf/tests/evsel-tp-sched.c
+++ b/tools/perf/tests/evsel-tp-sched.c
@@ -5,7 +5,7 @@
5#include "tests.h" 5#include "tests.h"
6#include "debug.h" 6#include "debug.h"
7 7
8static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, 8static int perf_evsel__test_field(struct evsel *evsel, const char *name,
9 int size, bool should_be_signed) 9 int size, bool should_be_signed)
10{ 10{
11 struct tep_format_field *field = perf_evsel__field(evsel, name); 11 struct tep_format_field *field = perf_evsel__field(evsel, name);
@@ -35,7 +35,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,
35 35
36int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused) 36int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused)
37{ 37{
38 struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch"); 38 struct evsel *evsel = perf_evsel__newtp("sched", "sched_switch");
39 int ret = 0; 39 int ret = 0;
40 40
41 if (IS_ERR(evsel)) { 41 if (IS_ERR(evsel)) {
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 7a2eed6c783e..b62bf7c3bea2 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -80,7 +80,7 @@ static u64 fake_callchains[][10] = {
80static int add_hist_entries(struct hists *hists, struct machine *machine) 80static int add_hist_entries(struct hists *hists, struct machine *machine)
81{ 81{
82 struct addr_location al; 82 struct addr_location al;
83 struct perf_evsel *evsel = hists_to_evsel(hists); 83 struct evsel *evsel = hists_to_evsel(hists);
84 struct perf_sample sample = { .period = 1000, }; 84 struct perf_sample sample = { .period = 1000, };
85 size_t i; 85 size_t i;
86 86
@@ -147,7 +147,7 @@ static void del_hist_entries(struct hists *hists)
147 } 147 }
148} 148}
149 149
150typedef int (*test_fn_t)(struct perf_evsel *, struct machine *); 150typedef int (*test_fn_t)(struct evsel *, struct machine *);
151 151
152#define COMM(he) (thread__comm_str(he->thread)) 152#define COMM(he) (thread__comm_str(he->thread))
153#define DSO(he) (he->ms.map->dso->short_name) 153#define DSO(he) (he->ms.map->dso->short_name)
@@ -247,7 +247,7 @@ static int do_test(struct hists *hists, struct result *expected, size_t nr_expec
247} 247}
248 248
249/* NO callchain + NO children */ 249/* NO callchain + NO children */
250static int test1(struct perf_evsel *evsel, struct machine *machine) 250static int test1(struct evsel *evsel, struct machine *machine)
251{ 251{
252 int err; 252 int err;
253 struct hists *hists = evsel__hists(evsel); 253 struct hists *hists = evsel__hists(evsel);
@@ -298,7 +298,7 @@ out:
298} 298}
299 299
300/* callcain + NO children */ 300/* callcain + NO children */
301static int test2(struct perf_evsel *evsel, struct machine *machine) 301static int test2(struct evsel *evsel, struct machine *machine)
302{ 302{
303 int err; 303 int err;
304 struct hists *hists = evsel__hists(evsel); 304 struct hists *hists = evsel__hists(evsel);
@@ -446,7 +446,7 @@ out:
446} 446}
447 447
448/* NO callchain + children */ 448/* NO callchain + children */
449static int test3(struct perf_evsel *evsel, struct machine *machine) 449static int test3(struct evsel *evsel, struct machine *machine)
450{ 450{
451 int err; 451 int err;
452 struct hists *hists = evsel__hists(evsel); 452 struct hists *hists = evsel__hists(evsel);
@@ -503,7 +503,7 @@ out:
503} 503}
504 504
505/* callchain + children */ 505/* callchain + children */
506static int test4(struct perf_evsel *evsel, struct machine *machine) 506static int test4(struct evsel *evsel, struct machine *machine)
507{ 507{
508 int err; 508 int err;
509 struct hists *hists = evsel__hists(evsel); 509 struct hists *hists = evsel__hists(evsel);
@@ -694,7 +694,7 @@ int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_u
694 int err = TEST_FAIL; 694 int err = TEST_FAIL;
695 struct machines machines; 695 struct machines machines;
696 struct machine *machine; 696 struct machine *machine;
697 struct perf_evsel *evsel; 697 struct evsel *evsel;
698 struct perf_evlist *evlist = perf_evlist__new(); 698 struct perf_evlist *evlist = perf_evlist__new();
699 size_t i; 699 size_t i;
700 test_fn_t testcases[] = { 700 test_fn_t testcases[] = {
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 975844807fe2..3e679bb8da7f 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -50,7 +50,7 @@ static struct sample fake_samples[] = {
50static int add_hist_entries(struct perf_evlist *evlist, 50static int add_hist_entries(struct perf_evlist *evlist,
51 struct machine *machine) 51 struct machine *machine)
52{ 52{
53 struct perf_evsel *evsel; 53 struct evsel *evsel;
54 struct addr_location al; 54 struct addr_location al;
55 struct perf_sample sample = { .period = 100, }; 55 struct perf_sample sample = { .period = 100, };
56 size_t i; 56 size_t i;
@@ -108,7 +108,7 @@ int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unu
108 int err = TEST_FAIL; 108 int err = TEST_FAIL;
109 struct machines machines; 109 struct machines machines;
110 struct machine *machine; 110 struct machine *machine;
111 struct perf_evsel *evsel; 111 struct evsel *evsel;
112 struct perf_evlist *evlist = perf_evlist__new(); 112 struct perf_evlist *evlist = perf_evlist__new();
113 113
114 TEST_ASSERT_VAL("No memory", evlist); 114 TEST_ASSERT_VAL("No memory", evlist);
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index af633db63f4d..078ee9876980 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -64,7 +64,7 @@ static struct sample fake_samples[][5] = {
64 64
65static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) 65static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
66{ 66{
67 struct perf_evsel *evsel; 67 struct evsel *evsel;
68 struct addr_location al; 68 struct addr_location al;
69 struct hist_entry *he; 69 struct hist_entry *he;
70 struct perf_sample sample = { .period = 1, .weight = 1, }; 70 struct perf_sample sample = { .period = 1, .weight = 1, };
@@ -271,7 +271,7 @@ int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unuse
271 struct hists *hists, *first_hists; 271 struct hists *hists, *first_hists;
272 struct machines machines; 272 struct machines machines;
273 struct machine *machine = NULL; 273 struct machine *machine = NULL;
274 struct perf_evsel *evsel, *first; 274 struct evsel *evsel, *first;
275 struct perf_evlist *evlist = perf_evlist__new(); 275 struct perf_evlist *evlist = perf_evlist__new();
276 276
277 if (evlist == NULL) 277 if (evlist == NULL)
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index 0a510c524a5d..5cd4b1baa9d1 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -50,7 +50,7 @@ static struct sample fake_samples[] = {
50static int add_hist_entries(struct hists *hists, struct machine *machine) 50static int add_hist_entries(struct hists *hists, struct machine *machine)
51{ 51{
52 struct addr_location al; 52 struct addr_location al;
53 struct perf_evsel *evsel = hists_to_evsel(hists); 53 struct evsel *evsel = hists_to_evsel(hists);
54 struct perf_sample sample = { .period = 100, }; 54 struct perf_sample sample = { .period = 100, };
55 size_t i; 55 size_t i;
56 56
@@ -113,7 +113,7 @@ static void del_hist_entries(struct hists *hists)
113 } 113 }
114} 114}
115 115
116typedef int (*test_fn_t)(struct perf_evsel *, struct machine *); 116typedef int (*test_fn_t)(struct evsel *, struct machine *);
117 117
118#define COMM(he) (thread__comm_str(he->thread)) 118#define COMM(he) (thread__comm_str(he->thread))
119#define DSO(he) (he->ms.map->dso->short_name) 119#define DSO(he) (he->ms.map->dso->short_name)
@@ -122,7 +122,7 @@ typedef int (*test_fn_t)(struct perf_evsel *, struct machine *);
122#define PID(he) (he->thread->tid) 122#define PID(he) (he->thread->tid)
123 123
124/* default sort keys (no field) */ 124/* default sort keys (no field) */
125static int test1(struct perf_evsel *evsel, struct machine *machine) 125static int test1(struct evsel *evsel, struct machine *machine)
126{ 126{
127 int err; 127 int err;
128 struct hists *hists = evsel__hists(evsel); 128 struct hists *hists = evsel__hists(evsel);
@@ -224,7 +224,7 @@ out:
224} 224}
225 225
226/* mixed fields and sort keys */ 226/* mixed fields and sort keys */
227static int test2(struct perf_evsel *evsel, struct machine *machine) 227static int test2(struct evsel *evsel, struct machine *machine)
228{ 228{
229 int err; 229 int err;
230 struct hists *hists = evsel__hists(evsel); 230 struct hists *hists = evsel__hists(evsel);
@@ -280,7 +280,7 @@ out:
280} 280}
281 281
282/* fields only (no sort key) */ 282/* fields only (no sort key) */
283static int test3(struct perf_evsel *evsel, struct machine *machine) 283static int test3(struct evsel *evsel, struct machine *machine)
284{ 284{
285 int err; 285 int err;
286 struct hists *hists = evsel__hists(evsel); 286 struct hists *hists = evsel__hists(evsel);
@@ -354,7 +354,7 @@ out:
354} 354}
355 355
356/* handle duplicate 'dso' field */ 356/* handle duplicate 'dso' field */
357static int test4(struct perf_evsel *evsel, struct machine *machine) 357static int test4(struct evsel *evsel, struct machine *machine)
358{ 358{
359 int err; 359 int err;
360 struct hists *hists = evsel__hists(evsel); 360 struct hists *hists = evsel__hists(evsel);
@@ -456,7 +456,7 @@ out:
456} 456}
457 457
458/* full sort keys w/o overhead field */ 458/* full sort keys w/o overhead field */
459static int test5(struct perf_evsel *evsel, struct machine *machine) 459static int test5(struct evsel *evsel, struct machine *machine)
460{ 460{
461 int err; 461 int err;
462 struct hists *hists = evsel__hists(evsel); 462 struct hists *hists = evsel__hists(evsel);
@@ -580,7 +580,7 @@ int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unu
580 int err = TEST_FAIL; 580 int err = TEST_FAIL;
581 struct machines machines; 581 struct machines machines;
582 struct machine *machine; 582 struct machine *machine;
583 struct perf_evsel *evsel; 583 struct evsel *evsel;
584 struct perf_evlist *evlist = perf_evlist__new(); 584 struct perf_evlist *evlist = perf_evlist__new();
585 size_t i; 585 size_t i;
586 test_fn_t testcases[] = { 586 test_fn_t testcases[] = {
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index e1e5e32cbb53..8ada3e63f1ba 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -68,7 +68,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un
68 struct perf_thread_map *threads = NULL; 68 struct perf_thread_map *threads = NULL;
69 struct perf_cpu_map *cpus = NULL; 69 struct perf_cpu_map *cpus = NULL;
70 struct perf_evlist *evlist = NULL; 70 struct perf_evlist *evlist = NULL;
71 struct perf_evsel *evsel = NULL; 71 struct evsel *evsel = NULL;
72 int found, err = -1; 72 int found, err = -1;
73 const char *comm; 73 const char *comm;
74 74
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index c1e2fe087b67..76ee42eb1355 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -36,7 +36,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
36#define nsyscalls ARRAY_SIZE(syscall_names) 36#define nsyscalls ARRAY_SIZE(syscall_names)
37 unsigned int nr_events[nsyscalls], 37 unsigned int nr_events[nsyscalls],
38 expected_nr_events[nsyscalls], i, j; 38 expected_nr_events[nsyscalls], i, j;
39 struct perf_evsel *evsels[nsyscalls], *evsel; 39 struct evsel *evsels[nsyscalls], *evsel;
40 char sbuf[STRERR_BUFSIZE]; 40 char sbuf[STRERR_BUFSIZE];
41 struct perf_mmap *md; 41 struct perf_mmap *md;
42 42
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index 9cd5bf63bec1..4bf73896695a 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -21,7 +21,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int
21{ 21{
22 int err = -1, fd, cpu; 22 int err = -1, fd, cpu;
23 struct perf_cpu_map *cpus; 23 struct perf_cpu_map *cpus;
24 struct perf_evsel *evsel; 24 struct evsel *evsel;
25 unsigned int nr_openat_calls = 111, i; 25 unsigned int nr_openat_calls = 111, i;
26 cpu_set_t cpu_set; 26 cpu_set_t cpu_set;
27 struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); 27 struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
index 344dc3ac2469..2e467448e220 100644
--- a/tools/perf/tests/openat-syscall-tp-fields.c
+++ b/tools/perf/tests/openat-syscall-tp-fields.c
@@ -33,7 +33,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest
33 const char *filename = "/etc/passwd"; 33 const char *filename = "/etc/passwd";
34 int flags = O_RDONLY | O_DIRECTORY; 34 int flags = O_RDONLY | O_DIRECTORY;
35 struct perf_evlist *evlist = perf_evlist__new(); 35 struct perf_evlist *evlist = perf_evlist__new();
36 struct perf_evsel *evsel; 36 struct evsel *evsel;
37 int err = -1, i, nr_events = 0, nr_polls = 0; 37 int err = -1, i, nr_events = 0, nr_polls = 0;
38 char sbuf[STRERR_BUFSIZE]; 38 char sbuf[STRERR_BUFSIZE];
39 39
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 652b8328ca93..f3efadd05863 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -14,7 +14,7 @@
14int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __maybe_unused) 14int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __maybe_unused)
15{ 15{
16 int err = -1, fd; 16 int err = -1, fd;
17 struct perf_evsel *evsel; 17 struct evsel *evsel;
18 unsigned int nr_openat_calls = 111, i; 18 unsigned int nr_openat_calls = 111, i;
19 struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); 19 struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
20 char sbuf[STRERR_BUFSIZE]; 20 char sbuf[STRERR_BUFSIZE];
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 8f3c80e13584..f55ab43d51bd 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
47static int test__checkevent_tracepoint(struct perf_evlist *evlist) 47static int test__checkevent_tracepoint(struct perf_evlist *evlist)
48{ 48{
49 struct perf_evsel *evsel = perf_evlist__first(evlist); 49 struct evsel *evsel = perf_evlist__first(evlist);
50 50
51 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 51 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->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);
@@ -59,7 +59,7 @@ static int test__checkevent_tracepoint(struct perf_evlist *evlist)
59 59
60static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist) 60static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist)
61{ 61{
62 struct perf_evsel *evsel; 62 struct evsel *evsel;
63 63
64 TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); 64 TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
65 TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); 65 TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
@@ -77,7 +77,7 @@ static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist)
77 77
78static int test__checkevent_raw(struct perf_evlist *evlist) 78static int test__checkevent_raw(struct perf_evlist *evlist)
79{ 79{
80 struct perf_evsel *evsel = perf_evlist__first(evlist); 80 struct evsel *evsel = perf_evlist__first(evlist);
81 81
82 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 82 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
83 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 83 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
@@ -87,7 +87,7 @@ static int test__checkevent_raw(struct perf_evlist *evlist)
87 87
88static int test__checkevent_numeric(struct perf_evlist *evlist) 88static int test__checkevent_numeric(struct perf_evlist *evlist)
89{ 89{
90 struct perf_evsel *evsel = perf_evlist__first(evlist); 90 struct evsel *evsel = perf_evlist__first(evlist);
91 91
92 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 92 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
93 TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type); 93 TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type);
@@ -97,7 +97,7 @@ static int test__checkevent_numeric(struct perf_evlist *evlist)
97 97
98static int test__checkevent_symbolic_name(struct perf_evlist *evlist) 98static int test__checkevent_symbolic_name(struct perf_evlist *evlist)
99{ 99{
100 struct perf_evsel *evsel = perf_evlist__first(evlist); 100 struct evsel *evsel = perf_evlist__first(evlist);
101 101
102 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 102 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
103 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); 103 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
@@ -108,7 +108,7 @@ static int test__checkevent_symbolic_name(struct perf_evlist *evlist)
108 108
109static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist) 109static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist)
110{ 110{
111 struct perf_evsel *evsel = perf_evlist__first(evlist); 111 struct evsel *evsel = perf_evlist__first(evlist);
112 112
113 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 113 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
114 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); 114 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
@@ -129,7 +129,7 @@ static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist)
129 129
130static int test__checkevent_symbolic_alias(struct perf_evlist *evlist) 130static int test__checkevent_symbolic_alias(struct perf_evlist *evlist)
131{ 131{
132 struct perf_evsel *evsel = perf_evlist__first(evlist); 132 struct evsel *evsel = perf_evlist__first(evlist);
133 133
134 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 134 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
135 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type); 135 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
@@ -140,7 +140,7 @@ static int test__checkevent_symbolic_alias(struct perf_evlist *evlist)
140 140
141static int test__checkevent_genhw(struct perf_evlist *evlist) 141static int test__checkevent_genhw(struct perf_evlist *evlist)
142{ 142{
143 struct perf_evsel *evsel = perf_evlist__first(evlist); 143 struct evsel *evsel = perf_evlist__first(evlist);
144 144
145 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 145 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
146 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->attr.type); 146 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->attr.type);
@@ -150,7 +150,7 @@ static int test__checkevent_genhw(struct perf_evlist *evlist)
150 150
151static int test__checkevent_breakpoint(struct perf_evlist *evlist) 151static int test__checkevent_breakpoint(struct perf_evlist *evlist)
152{ 152{
153 struct perf_evsel *evsel = perf_evlist__first(evlist); 153 struct evsel *evsel = perf_evlist__first(evlist);
154 154
155 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 155 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
156 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); 156 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
@@ -164,7 +164,7 @@ static int test__checkevent_breakpoint(struct perf_evlist *evlist)
164 164
165static int test__checkevent_breakpoint_x(struct perf_evlist *evlist) 165static int test__checkevent_breakpoint_x(struct perf_evlist *evlist)
166{ 166{
167 struct perf_evsel *evsel = perf_evlist__first(evlist); 167 struct evsel *evsel = perf_evlist__first(evlist);
168 168
169 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 169 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
170 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); 170 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
@@ -177,7 +177,7 @@ static int test__checkevent_breakpoint_x(struct perf_evlist *evlist)
177 177
178static int test__checkevent_breakpoint_r(struct perf_evlist *evlist) 178static int test__checkevent_breakpoint_r(struct perf_evlist *evlist)
179{ 179{
180 struct perf_evsel *evsel = perf_evlist__first(evlist); 180 struct evsel *evsel = perf_evlist__first(evlist);
181 181
182 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 182 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->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 perf_evlist *evlist)
192 192
193static int test__checkevent_breakpoint_w(struct perf_evlist *evlist) 193static int test__checkevent_breakpoint_w(struct perf_evlist *evlist)
194{ 194{
195 struct perf_evsel *evsel = perf_evlist__first(evlist); 195 struct evsel *evsel = perf_evlist__first(evlist);
196 196
197 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 197 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->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 perf_evlist *evlist)
207 207
208static int test__checkevent_breakpoint_rw(struct perf_evlist *evlist) 208static int test__checkevent_breakpoint_rw(struct perf_evlist *evlist)
209{ 209{
210 struct perf_evsel *evsel = perf_evlist__first(evlist); 210 struct evsel *evsel = perf_evlist__first(evlist);
211 211
212 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 212 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->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 perf_evlist *evlist)
222 222
223static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist) 223static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist)
224{ 224{
225 struct perf_evsel *evsel = perf_evlist__first(evlist); 225 struct evsel *evsel = perf_evlist__first(evlist);
226 226
227 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 227 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
228 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 228 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
@@ -235,7 +235,7 @@ static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist)
235static int 235static int
236test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist) 236test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist)
237{ 237{
238 struct perf_evsel *evsel; 238 struct evsel *evsel;
239 239
240 TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); 240 TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1);
241 241
@@ -253,7 +253,7 @@ test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist)
253 253
254static int test__checkevent_raw_modifier(struct perf_evlist *evlist) 254static int test__checkevent_raw_modifier(struct perf_evlist *evlist)
255{ 255{
256 struct perf_evsel *evsel = perf_evlist__first(evlist); 256 struct evsel *evsel = perf_evlist__first(evlist);
257 257
258 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 258 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
259 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 259 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
@@ -265,7 +265,7 @@ static int test__checkevent_raw_modifier(struct perf_evlist *evlist)
265 265
266static int test__checkevent_numeric_modifier(struct perf_evlist *evlist) 266static int test__checkevent_numeric_modifier(struct perf_evlist *evlist)
267{ 267{
268 struct perf_evsel *evsel = perf_evlist__first(evlist); 268 struct evsel *evsel = perf_evlist__first(evlist);
269 269
270 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 270 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
271 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 271 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -277,7 +277,7 @@ static int test__checkevent_numeric_modifier(struct perf_evlist *evlist)
277 277
278static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) 278static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
279{ 279{
280 struct perf_evsel *evsel = perf_evlist__first(evlist); 280 struct evsel *evsel = perf_evlist__first(evlist);
281 281
282 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 282 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
283 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 283 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -289,7 +289,7 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
289 289
290static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) 290static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist)
291{ 291{
292 struct perf_evsel *evsel = perf_evlist__first(evlist); 292 struct evsel *evsel = perf_evlist__first(evlist);
293 293
294 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); 294 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
295 TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); 295 TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
@@ -299,7 +299,7 @@ static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist)
299 299
300static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) 300static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist)
301{ 301{
302 struct perf_evsel *evsel = perf_evlist__first(evlist); 302 struct evsel *evsel = perf_evlist__first(evlist);
303 303
304 TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); 304 TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
305 TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); 305 TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
@@ -309,7 +309,7 @@ static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist)
309 309
310static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) 310static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
311{ 311{
312 struct perf_evsel *evsel = perf_evlist__first(evlist); 312 struct evsel *evsel = perf_evlist__first(evlist);
313 313
314 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); 314 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
315 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 315 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -321,7 +321,7 @@ static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
321 321
322static int test__checkevent_genhw_modifier(struct perf_evlist *evlist) 322static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
323{ 323{
324 struct perf_evsel *evsel = perf_evlist__first(evlist); 324 struct evsel *evsel = perf_evlist__first(evlist);
325 325
326 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 326 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
327 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 327 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
@@ -333,7 +333,7 @@ static int test__checkevent_genhw_modifier(struct perf_evlist *evlist)
333 333
334static int test__checkevent_exclude_idle_modifier(struct perf_evlist *evlist) 334static int test__checkevent_exclude_idle_modifier(struct perf_evlist *evlist)
335{ 335{
336 struct perf_evsel *evsel = perf_evlist__first(evlist); 336 struct evsel *evsel = perf_evlist__first(evlist);
337 337
338 TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle); 338 TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle);
339 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); 339 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
@@ -348,7 +348,7 @@ static int test__checkevent_exclude_idle_modifier(struct perf_evlist *evlist)
348 348
349static int test__checkevent_exclude_idle_modifier_1(struct perf_evlist *evlist) 349static int test__checkevent_exclude_idle_modifier_1(struct perf_evlist *evlist)
350{ 350{
351 struct perf_evsel *evsel = perf_evlist__first(evlist); 351 struct evsel *evsel = perf_evlist__first(evlist);
352 352
353 TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle); 353 TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle);
354 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); 354 TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
@@ -363,7 +363,7 @@ static int test__checkevent_exclude_idle_modifier_1(struct perf_evlist *evlist)
363 363
364static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist) 364static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist)
365{ 365{
366 struct perf_evsel *evsel = perf_evlist__first(evlist); 366 struct evsel *evsel = perf_evlist__first(evlist);
367 367
368 368
369 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); 369 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
@@ -378,7 +378,7 @@ static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist)
378 378
379static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist) 379static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist)
380{ 380{
381 struct perf_evsel *evsel = perf_evlist__first(evlist); 381 struct evsel *evsel = perf_evlist__first(evlist);
382 382
383 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 383 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
384 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 384 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
@@ -392,7 +392,7 @@ static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist)
392 392
393static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist) 393static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist)
394{ 394{
395 struct perf_evsel *evsel = perf_evlist__first(evlist); 395 struct evsel *evsel = perf_evlist__first(evlist);
396 396
397 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 397 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
398 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 398 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -406,7 +406,7 @@ static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist)
406 406
407static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist) 407static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist)
408{ 408{
409 struct perf_evsel *evsel = perf_evlist__first(evlist); 409 struct evsel *evsel = perf_evlist__first(evlist);
410 410
411 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); 411 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
412 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 412 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -420,7 +420,7 @@ static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist)
420 420
421static int test__checkevent_breakpoint_rw_modifier(struct perf_evlist *evlist) 421static int test__checkevent_breakpoint_rw_modifier(struct perf_evlist *evlist)
422{ 422{
423 struct perf_evsel *evsel = perf_evlist__first(evlist); 423 struct evsel *evsel = perf_evlist__first(evlist);
424 424
425 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 425 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
426 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 426 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
@@ -435,7 +435,7 @@ static int test__checkevent_breakpoint_rw_modifier(struct perf_evlist *evlist)
435static int test__checkevent_pmu(struct perf_evlist *evlist) 435static int test__checkevent_pmu(struct perf_evlist *evlist)
436{ 436{
437 437
438 struct perf_evsel *evsel = perf_evlist__first(evlist); 438 struct evsel *evsel = perf_evlist__first(evlist);
439 439
440 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 440 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
441 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 441 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
@@ -453,7 +453,7 @@ static int test__checkevent_pmu(struct perf_evlist *evlist)
453 453
454static int test__checkevent_list(struct perf_evlist *evlist) 454static int test__checkevent_list(struct perf_evlist *evlist)
455{ 455{
456 struct perf_evsel *evsel = perf_evlist__first(evlist); 456 struct evsel *evsel = perf_evlist__first(evlist);
457 457
458 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); 458 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
459 459
@@ -492,7 +492,7 @@ static int test__checkevent_list(struct perf_evlist *evlist)
492 492
493static int test__checkevent_pmu_name(struct perf_evlist *evlist) 493static int test__checkevent_pmu_name(struct perf_evlist *evlist)
494{ 494{
495 struct perf_evsel *evsel = perf_evlist__first(evlist); 495 struct evsel *evsel = perf_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->nr_entries); 498 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
@@ -513,7 +513,7 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist)
513 513
514static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist *evlist) 514static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist *evlist)
515{ 515{
516 struct perf_evsel *evsel = perf_evlist__first(evlist); 516 struct evsel *evsel = perf_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->nr_entries); 519 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
@@ -546,7 +546,7 @@ static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist *evlis
546 546
547static int test__checkevent_pmu_events(struct perf_evlist *evlist) 547static int test__checkevent_pmu_events(struct perf_evlist *evlist)
548{ 548{
549 struct perf_evsel *evsel = perf_evlist__first(evlist); 549 struct evsel *evsel = perf_evlist__first(evlist);
550 550
551 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 551 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
552 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 552 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
@@ -564,7 +564,7 @@ static int test__checkevent_pmu_events(struct perf_evlist *evlist)
564 564
565static int test__checkevent_pmu_events_mix(struct perf_evlist *evlist) 565static int test__checkevent_pmu_events_mix(struct perf_evlist *evlist)
566{ 566{
567 struct perf_evsel *evsel = perf_evlist__first(evlist); 567 struct evsel *evsel = perf_evlist__first(evlist);
568 568
569 /* pmu-event:u */ 569 /* pmu-event:u */
570 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 570 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
@@ -636,7 +636,7 @@ static int test__checkterms_simple(struct list_head *terms)
636 636
637static int test__group1(struct perf_evlist *evlist) 637static int test__group1(struct perf_evlist *evlist)
638{ 638{
639 struct perf_evsel *evsel, *leader; 639 struct evsel *evsel, *leader;
640 640
641 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 641 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
642 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 642 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -678,7 +678,7 @@ static int test__group1(struct perf_evlist *evlist)
678 678
679static int test__group2(struct perf_evlist *evlist) 679static int test__group2(struct perf_evlist *evlist)
680{ 680{
681 struct perf_evsel *evsel, *leader; 681 struct evsel *evsel, *leader;
682 682
683 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); 683 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
684 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 684 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -733,7 +733,7 @@ static int test__group2(struct perf_evlist *evlist)
733 733
734static int test__group3(struct perf_evlist *evlist __maybe_unused) 734static int test__group3(struct perf_evlist *evlist __maybe_unused)
735{ 735{
736 struct perf_evsel *evsel, *leader; 736 struct evsel *evsel, *leader;
737 737
738 TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); 738 TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries);
739 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); 739 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
@@ -825,7 +825,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused)
825 825
826static int test__group4(struct perf_evlist *evlist __maybe_unused) 826static int test__group4(struct perf_evlist *evlist __maybe_unused)
827{ 827{
828 struct perf_evsel *evsel, *leader; 828 struct evsel *evsel, *leader;
829 829
830 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 830 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
831 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 831 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -869,7 +869,7 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused)
869 869
870static int test__group5(struct perf_evlist *evlist __maybe_unused) 870static int test__group5(struct perf_evlist *evlist __maybe_unused)
871{ 871{
872 struct perf_evsel *evsel, *leader; 872 struct evsel *evsel, *leader;
873 873
874 TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); 874 TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries);
875 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); 875 TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
@@ -955,7 +955,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
955 955
956static int test__group_gh1(struct perf_evlist *evlist) 956static int test__group_gh1(struct perf_evlist *evlist)
957{ 957{
958 struct perf_evsel *evsel, *leader; 958 struct evsel *evsel, *leader;
959 959
960 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 960 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
961 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 961 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -995,7 +995,7 @@ static int test__group_gh1(struct perf_evlist *evlist)
995 995
996static int test__group_gh2(struct perf_evlist *evlist) 996static int test__group_gh2(struct perf_evlist *evlist)
997{ 997{
998 struct perf_evsel *evsel, *leader; 998 struct evsel *evsel, *leader;
999 999
1000 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 1000 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1001 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1001 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -1035,7 +1035,7 @@ static int test__group_gh2(struct perf_evlist *evlist)
1035 1035
1036static int test__group_gh3(struct perf_evlist *evlist) 1036static int test__group_gh3(struct perf_evlist *evlist)
1037{ 1037{
1038 struct perf_evsel *evsel, *leader; 1038 struct evsel *evsel, *leader;
1039 1039
1040 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 1040 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1041 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1041 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -1075,7 +1075,7 @@ static int test__group_gh3(struct perf_evlist *evlist)
1075 1075
1076static int test__group_gh4(struct perf_evlist *evlist) 1076static int test__group_gh4(struct perf_evlist *evlist)
1077{ 1077{
1078 struct perf_evsel *evsel, *leader; 1078 struct evsel *evsel, *leader;
1079 1079
1080 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 1080 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1081 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); 1081 TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
@@ -1115,7 +1115,7 @@ static int test__group_gh4(struct perf_evlist *evlist)
1115 1115
1116static int test__leader_sample1(struct perf_evlist *evlist) 1116static int test__leader_sample1(struct perf_evlist *evlist)
1117{ 1117{
1118 struct perf_evsel *evsel, *leader; 1118 struct evsel *evsel, *leader;
1119 1119
1120 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); 1120 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
1121 1121
@@ -1168,7 +1168,7 @@ static int test__leader_sample1(struct perf_evlist *evlist)
1168 1168
1169static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused) 1169static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused)
1170{ 1170{
1171 struct perf_evsel *evsel, *leader; 1171 struct evsel *evsel, *leader;
1172 1172
1173 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 1173 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1174 1174
@@ -1207,7 +1207,7 @@ static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused)
1207 1207
1208static int test__checkevent_pinned_modifier(struct perf_evlist *evlist) 1208static int test__checkevent_pinned_modifier(struct perf_evlist *evlist)
1209{ 1209{
1210 struct perf_evsel *evsel = perf_evlist__first(evlist); 1210 struct evsel *evsel = perf_evlist__first(evlist);
1211 1211
1212 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); 1212 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1213 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 1213 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -1220,7 +1220,7 @@ static int test__checkevent_pinned_modifier(struct perf_evlist *evlist)
1220 1220
1221static int test__pinned_group(struct perf_evlist *evlist) 1221static int test__pinned_group(struct perf_evlist *evlist)
1222{ 1222{
1223 struct perf_evsel *evsel, *leader; 1223 struct evsel *evsel, *leader;
1224 1224
1225 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); 1225 TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries);
1226 1226
@@ -1251,7 +1251,7 @@ static int test__pinned_group(struct perf_evlist *evlist)
1251 1251
1252static int test__checkevent_breakpoint_len(struct perf_evlist *evlist) 1252static int test__checkevent_breakpoint_len(struct perf_evlist *evlist)
1253{ 1253{
1254 struct perf_evsel *evsel = perf_evlist__first(evlist); 1254 struct evsel *evsel = perf_evlist__first(evlist);
1255 1255
1256 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 1256 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
1257 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); 1257 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
@@ -1266,7 +1266,7 @@ static int test__checkevent_breakpoint_len(struct perf_evlist *evlist)
1266 1266
1267static int test__checkevent_breakpoint_len_w(struct perf_evlist *evlist) 1267static int test__checkevent_breakpoint_len_w(struct perf_evlist *evlist)
1268{ 1268{
1269 struct perf_evsel *evsel = perf_evlist__first(evlist); 1269 struct evsel *evsel = perf_evlist__first(evlist);
1270 1270
1271 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 1271 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
1272 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); 1272 TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type);
@@ -1282,7 +1282,7 @@ static int test__checkevent_breakpoint_len_w(struct perf_evlist *evlist)
1282static int 1282static int
1283test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist) 1283test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
1284{ 1284{
1285 struct perf_evsel *evsel = perf_evlist__first(evlist); 1285 struct evsel *evsel = perf_evlist__first(evlist);
1286 1286
1287 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); 1287 TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
1288 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 1288 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
@@ -1294,7 +1294,7 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
1294 1294
1295static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist) 1295static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
1296{ 1296{
1297 struct perf_evsel *evsel = perf_evlist__first(evlist); 1297 struct evsel *evsel = perf_evlist__first(evlist);
1298 1298
1299 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 1299 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
1300 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type); 1300 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
@@ -1305,7 +1305,7 @@ static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
1305 1305
1306static int test__checkevent_config_symbol(struct perf_evlist *evlist) 1306static int test__checkevent_config_symbol(struct perf_evlist *evlist)
1307{ 1307{
1308 struct perf_evsel *evsel = perf_evlist__first(evlist); 1308 struct evsel *evsel = perf_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 perf_evlist *evlist)
1313 1313
1314static int test__checkevent_config_raw(struct perf_evlist *evlist) 1314static int test__checkevent_config_raw(struct perf_evlist *evlist)
1315{ 1315{
1316 struct perf_evsel *evsel = perf_evlist__first(evlist); 1316 struct evsel *evsel = perf_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 perf_evlist *evlist)
1321 1321
1322static int test__checkevent_config_num(struct perf_evlist *evlist) 1322static int test__checkevent_config_num(struct perf_evlist *evlist)
1323{ 1323{
1324 struct perf_evsel *evsel = perf_evlist__first(evlist); 1324 struct evsel *evsel = perf_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 perf_evlist *evlist)
1329 1329
1330static int test__checkevent_config_cache(struct perf_evlist *evlist) 1330static int test__checkevent_config_cache(struct perf_evlist *evlist)
1331{ 1331{
1332 struct perf_evsel *evsel = perf_evlist__first(evlist); 1332 struct evsel *evsel = perf_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
1343static int test__intel_pt(struct perf_evlist *evlist) 1343static int test__intel_pt(struct perf_evlist *evlist)
1344{ 1344{
1345 struct perf_evsel *evsel = perf_evlist__first(evlist); 1345 struct evsel *evsel = perf_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 perf_evlist *evlist)
1350 1350
1351static int test__checkevent_complex_name(struct perf_evlist *evlist) 1351static int test__checkevent_complex_name(struct perf_evlist *evlist)
1352{ 1352{
1353 struct perf_evsel *evsel = perf_evlist__first(evlist); 1353 struct evsel *evsel = perf_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 perf_evlist *evlist)
1358 1358
1359static int test__sym_event_slash(struct perf_evlist *evlist) 1359static int test__sym_event_slash(struct perf_evlist *evlist)
1360{ 1360{
1361 struct perf_evsel *evsel = perf_evlist__first(evlist); 1361 struct evsel *evsel = perf_evlist__first(evlist);
1362 1362
1363 TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE); 1363 TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE);
1364 TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES); 1364 TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES);
@@ -1368,7 +1368,7 @@ static int test__sym_event_slash(struct perf_evlist *evlist)
1368 1368
1369static int test__sym_event_dc(struct perf_evlist *evlist) 1369static int test__sym_event_dc(struct perf_evlist *evlist)
1370{ 1370{
1371 struct perf_evsel *evsel = perf_evlist__first(evlist); 1371 struct evsel *evsel = perf_evlist__first(evlist);
1372 1372
1373 TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE); 1373 TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE);
1374 TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES); 1374 TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES);
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 07f6bd8ed719..7e576c2db941 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -51,7 +51,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
51 cpu_set_t cpu_mask; 51 cpu_set_t cpu_mask;
52 size_t cpu_mask_size = sizeof(cpu_mask); 52 size_t cpu_mask_size = sizeof(cpu_mask);
53 struct perf_evlist *evlist = perf_evlist__new_dummy(); 53 struct perf_evlist *evlist = perf_evlist__new_dummy();
54 struct perf_evsel *evsel; 54 struct evsel *evsel;
55 struct perf_sample sample; 55 struct perf_sample sample;
56 const char *cmd = "sleep"; 56 const char *cmd = "sleep";
57 const char *argv[] = { cmd, "1", NULL, }; 57 const char *argv[] = { cmd, "1", NULL, };
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 361714e2583c..a8cd3ed3c116 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -153,7 +153,7 @@ static bool samples_same(const struct perf_sample *s1,
153 153
154static int do_test(u64 sample_type, u64 sample_regs, u64 read_format) 154static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
155{ 155{
156 struct perf_evsel evsel = { 156 struct evsel evsel = {
157 .needs_swap = false, 157 .needs_swap = false,
158 .attr = { 158 .attr = {
159 .sample_type = sample_type, 159 .sample_type = sample_type,
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index d57b8d9c1575..620a99aad1e3 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -27,7 +27,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
27 int nr_samples = 0; 27 int nr_samples = 0;
28 char sbuf[STRERR_BUFSIZE]; 28 char sbuf[STRERR_BUFSIZE];
29 union perf_event *event; 29 union perf_event *event;
30 struct perf_evsel *evsel; 30 struct evsel *evsel;
31 struct perf_evlist *evlist; 31 struct perf_evlist *evlist;
32 struct perf_event_attr attr = { 32 struct perf_event_attr attr = {
33 .type = PERF_TYPE_SOFTWARE, 33 .type = PERF_TYPE_SOFTWARE,
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index 3652c548cc22..a946b9fa60dd 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -52,8 +52,8 @@ static int spin_sleep(void)
52} 52}
53 53
54struct switch_tracking { 54struct switch_tracking {
55 struct perf_evsel *switch_evsel; 55 struct evsel *switch_evsel;
56 struct perf_evsel *cycles_evsel; 56 struct evsel *cycles_evsel;
57 pid_t *tids; 57 pid_t *tids;
58 int nr_tids; 58 int nr_tids;
59 int comm_seen[4]; 59 int comm_seen[4];
@@ -118,7 +118,7 @@ static int process_sample_event(struct perf_evlist *evlist,
118 struct switch_tracking *switch_tracking) 118 struct switch_tracking *switch_tracking)
119{ 119{
120 struct perf_sample sample; 120 struct perf_sample sample;
121 struct perf_evsel *evsel; 121 struct evsel *evsel;
122 pid_t next_tid, prev_tid; 122 pid_t next_tid, prev_tid;
123 int cpu, err; 123 int cpu, err;
124 124
@@ -330,8 +330,8 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_
330 struct perf_thread_map *threads = NULL; 330 struct perf_thread_map *threads = NULL;
331 struct perf_cpu_map *cpus = NULL; 331 struct perf_cpu_map *cpus = NULL;
332 struct perf_evlist *evlist = NULL; 332 struct perf_evlist *evlist = NULL;
333 struct perf_evsel *evsel, *cpu_clocks_evsel, *cycles_evsel; 333 struct evsel *evsel, *cpu_clocks_evsel, *cycles_evsel;
334 struct perf_evsel *switch_evsel, *tracking_evsel; 334 struct evsel *switch_evsel, *tracking_evsel;
335 const char *comm; 335 const char *comm;
336 int err = -1; 336 int err = -1;
337 337
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 9602ff91a3c7..e6fb4b8d8bc2 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -37,7 +37,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
37{ 37{
38 int err = -1; 38 int err = -1;
39 union perf_event *event; 39 union perf_event *event;
40 struct perf_evsel *evsel; 40 struct evsel *evsel;
41 struct perf_evlist *evlist; 41 struct perf_evlist *evlist;
42 struct target target = { 42 struct target target = {
43 .uid = UINT_MAX, 43 .uid = UINT_MAX,
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index e67880bf1efe..64cc650c4543 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -299,7 +299,7 @@ static void annotate_browser__set_rb_top(struct annotate_browser *browser,
299} 299}
300 300
301static void annotate_browser__calc_percent(struct annotate_browser *browser, 301static void annotate_browser__calc_percent(struct annotate_browser *browser,
302 struct perf_evsel *evsel) 302 struct evsel *evsel)
303{ 303{
304 struct map_symbol *ms = browser->b.priv; 304 struct map_symbol *ms = browser->b.priv;
305 struct symbol *sym = ms->sym; 305 struct symbol *sym = ms->sym;
@@ -406,7 +406,7 @@ static int sym_title(struct symbol *sym, struct map *map, char *title,
406 * to the calling function. 406 * to the calling function.
407 */ 407 */
408static bool annotate_browser__callq(struct annotate_browser *browser, 408static bool annotate_browser__callq(struct annotate_browser *browser,
409 struct perf_evsel *evsel, 409 struct evsel *evsel,
410 struct hist_browser_timer *hbt) 410 struct hist_browser_timer *hbt)
411{ 411{
412 struct map_symbol *ms = browser->b.priv; 412 struct map_symbol *ms = browser->b.priv;
@@ -455,7 +455,7 @@ struct disasm_line *annotate_browser__find_offset(struct annotate_browser *brows
455} 455}
456 456
457static bool annotate_browser__jump(struct annotate_browser *browser, 457static bool annotate_browser__jump(struct annotate_browser *browser,
458 struct perf_evsel *evsel, 458 struct evsel *evsel,
459 struct hist_browser_timer *hbt) 459 struct hist_browser_timer *hbt)
460{ 460{
461 struct disasm_line *dl = disasm_line(browser->selection); 461 struct disasm_line *dl = disasm_line(browser->selection);
@@ -656,7 +656,7 @@ switch_percent_type(struct annotation_options *opts, bool base)
656} 656}
657 657
658static int annotate_browser__run(struct annotate_browser *browser, 658static int annotate_browser__run(struct annotate_browser *browser,
659 struct perf_evsel *evsel, 659 struct evsel *evsel,
660 struct hist_browser_timer *hbt) 660 struct hist_browser_timer *hbt)
661{ 661{
662 struct rb_node *nd = NULL; 662 struct rb_node *nd = NULL;
@@ -869,14 +869,14 @@ out:
869 return key; 869 return key;
870} 870}
871 871
872int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, 872int map_symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,
873 struct hist_browser_timer *hbt, 873 struct hist_browser_timer *hbt,
874 struct annotation_options *opts) 874 struct annotation_options *opts)
875{ 875{
876 return symbol__tui_annotate(ms->sym, ms->map, evsel, hbt, opts); 876 return symbol__tui_annotate(ms->sym, ms->map, evsel, hbt, opts);
877} 877}
878 878
879int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 879int hist_entry__tui_annotate(struct hist_entry *he, struct evsel *evsel,
880 struct hist_browser_timer *hbt, 880 struct hist_browser_timer *hbt,
881 struct annotation_options *opts) 881 struct annotation_options *opts)
882{ 882{
@@ -888,7 +888,7 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
888} 888}
889 889
890int symbol__tui_annotate(struct symbol *sym, struct map *map, 890int symbol__tui_annotate(struct symbol *sym, struct map *map,
891 struct perf_evsel *evsel, 891 struct evsel *evsel,
892 struct hist_browser_timer *hbt, 892 struct hist_browser_timer *hbt,
893 struct annotation_options *opts) 893 struct annotation_options *opts)
894{ 894{
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a94eb0755e8b..9bc818621eb6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2187,7 +2187,7 @@ struct hist_browser *hist_browser__new(struct hists *hists)
2187} 2187}
2188 2188
2189static struct hist_browser * 2189static struct hist_browser *
2190perf_evsel_browser__new(struct perf_evsel *evsel, 2190perf_evsel_browser__new(struct evsel *evsel,
2191 struct hist_browser_timer *hbt, 2191 struct hist_browser_timer *hbt,
2192 struct perf_env *env, 2192 struct perf_env *env,
2193 struct annotation_options *annotation_opts) 2193 struct annotation_options *annotation_opts)
@@ -2352,7 +2352,7 @@ struct popup_action {
2352 struct thread *thread; 2352 struct thread *thread;
2353 struct map_symbol ms; 2353 struct map_symbol ms;
2354 int socket; 2354 int socket;
2355 struct perf_evsel *evsel; 2355 struct evsel *evsel;
2356 enum rstype rstype; 2356 enum rstype rstype;
2357 2357
2358 int (*fn)(struct hist_browser *browser, struct popup_action *act); 2358 int (*fn)(struct hist_browser *browser, struct popup_action *act);
@@ -2361,7 +2361,7 @@ struct popup_action {
2361static int 2361static int
2362do_annotate(struct hist_browser *browser, struct popup_action *act) 2362do_annotate(struct hist_browser *browser, struct popup_action *act)
2363{ 2363{
2364 struct perf_evsel *evsel; 2364 struct evsel *evsel;
2365 struct annotation *notes; 2365 struct annotation *notes;
2366 struct hist_entry *he; 2366 struct hist_entry *he;
2367 int err; 2367 int err;
@@ -2596,7 +2596,7 @@ static int
2596add_script_opt_2(struct hist_browser *browser __maybe_unused, 2596add_script_opt_2(struct hist_browser *browser __maybe_unused,
2597 struct popup_action *act, char **optstr, 2597 struct popup_action *act, char **optstr,
2598 struct thread *thread, struct symbol *sym, 2598 struct thread *thread, struct symbol *sym,
2599 struct perf_evsel *evsel, const char *tstr) 2599 struct evsel *evsel, const char *tstr)
2600{ 2600{
2601 2601
2602 if (thread) { 2602 if (thread) {
@@ -2623,7 +2623,7 @@ static int
2623add_script_opt(struct hist_browser *browser, 2623add_script_opt(struct hist_browser *browser,
2624 struct popup_action *act, char **optstr, 2624 struct popup_action *act, char **optstr,
2625 struct thread *thread, struct symbol *sym, 2625 struct thread *thread, struct symbol *sym,
2626 struct perf_evsel *evsel) 2626 struct evsel *evsel)
2627{ 2627{
2628 int n, j; 2628 int n, j;
2629 struct hist_entry *he; 2629 struct hist_entry *he;
@@ -2653,7 +2653,7 @@ static int
2653add_res_sample_opt(struct hist_browser *browser __maybe_unused, 2653add_res_sample_opt(struct hist_browser *browser __maybe_unused,
2654 struct popup_action *act, char **optstr, 2654 struct popup_action *act, char **optstr,
2655 struct res_sample *res_sample, 2655 struct res_sample *res_sample,
2656 struct perf_evsel *evsel, 2656 struct evsel *evsel,
2657 enum rstype type) 2657 enum rstype type)
2658{ 2658{
2659 if (!res_sample) 2659 if (!res_sample)
@@ -2814,7 +2814,7 @@ next:
2814 } 2814 }
2815} 2815}
2816 2816
2817static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, 2817static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
2818 const char *helpline, 2818 const char *helpline,
2819 bool left_exits, 2819 bool left_exits,
2820 struct hist_browser_timer *hbt, 2820 struct hist_browser_timer *hbt,
@@ -3198,9 +3198,9 @@ out:
3198 return key; 3198 return key;
3199} 3199}
3200 3200
3201struct perf_evsel_menu { 3201struct evsel_menu {
3202 struct ui_browser b; 3202 struct ui_browser b;
3203 struct perf_evsel *selection; 3203 struct evsel *selection;
3204 struct annotation_options *annotation_opts; 3204 struct annotation_options *annotation_opts;
3205 bool lost_events, lost_events_warned; 3205 bool lost_events, lost_events_warned;
3206 float min_pcnt; 3206 float min_pcnt;
@@ -3210,9 +3210,9 @@ struct perf_evsel_menu {
3210static void perf_evsel_menu__write(struct ui_browser *browser, 3210static void perf_evsel_menu__write(struct ui_browser *browser,
3211 void *entry, int row) 3211 void *entry, int row)
3212{ 3212{
3213 struct perf_evsel_menu *menu = container_of(browser, 3213 struct evsel_menu *menu = container_of(browser,
3214 struct perf_evsel_menu, b); 3214 struct evsel_menu, b);
3215 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); 3215 struct evsel *evsel = list_entry(entry, struct evsel, node);
3216 struct hists *hists = evsel__hists(evsel); 3216 struct hists *hists = evsel__hists(evsel);
3217 bool current_entry = ui_browser__is_current_entry(browser, row); 3217 bool current_entry = ui_browser__is_current_entry(browser, row);
3218 unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 3218 unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE];
@@ -3225,7 +3225,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
3225 HE_COLORSET_NORMAL); 3225 HE_COLORSET_NORMAL);
3226 3226
3227 if (perf_evsel__is_group_event(evsel)) { 3227 if (perf_evsel__is_group_event(evsel)) {
3228 struct perf_evsel *pos; 3228 struct evsel *pos;
3229 3229
3230 ev_name = perf_evsel__group_name(evsel); 3230 ev_name = perf_evsel__group_name(evsel);
3231 3231
@@ -3257,13 +3257,13 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
3257 menu->selection = evsel; 3257 menu->selection = evsel;
3258} 3258}
3259 3259
3260static int perf_evsel_menu__run(struct perf_evsel_menu *menu, 3260static int perf_evsel_menu__run(struct evsel_menu *menu,
3261 int nr_events, const char *help, 3261 int nr_events, const char *help,
3262 struct hist_browser_timer *hbt, 3262 struct hist_browser_timer *hbt,
3263 bool warn_lost_event) 3263 bool warn_lost_event)
3264{ 3264{
3265 struct perf_evlist *evlist = menu->b.priv; 3265 struct perf_evlist *evlist = menu->b.priv;
3266 struct perf_evsel *pos; 3266 struct evsel *pos;
3267 const char *title = "Available samples"; 3267 const char *title = "Available samples";
3268 int delay_secs = hbt ? hbt->refresh : 0; 3268 int delay_secs = hbt ? hbt->refresh : 0;
3269 int key; 3269 int key;
@@ -3351,7 +3351,7 @@ out:
3351static bool filter_group_entries(struct ui_browser *browser __maybe_unused, 3351static bool filter_group_entries(struct ui_browser *browser __maybe_unused,
3352 void *entry) 3352 void *entry)
3353{ 3353{
3354 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); 3354 struct evsel *evsel = list_entry(entry, struct evsel, node);
3355 3355
3356 if (symbol_conf.event_group && !perf_evsel__is_group_leader(evsel)) 3356 if (symbol_conf.event_group && !perf_evsel__is_group_leader(evsel))
3357 return true; 3357 return true;
@@ -3367,8 +3367,8 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
3367 bool warn_lost_event, 3367 bool warn_lost_event,
3368 struct annotation_options *annotation_opts) 3368 struct annotation_options *annotation_opts)
3369{ 3369{
3370 struct perf_evsel *pos; 3370 struct evsel *pos;
3371 struct perf_evsel_menu menu = { 3371 struct evsel_menu menu = {
3372 .b = { 3372 .b = {
3373 .entries = &evlist->entries, 3373 .entries = &evlist->entries,
3374 .refresh = ui_browser__list_head_refresh, 3374 .refresh = ui_browser__list_head_refresh,
@@ -3408,7 +3408,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
3408 3408
3409single_entry: 3409single_entry:
3410 if (nr_entries == 1) { 3410 if (nr_entries == 1) {
3411 struct perf_evsel *first = perf_evlist__first(evlist); 3411 struct evsel *first = perf_evlist__first(evlist);
3412 3412
3413 return perf_evsel__hists_browse(first, nr_entries, help, 3413 return perf_evsel__hists_browse(first, nr_entries, help,
3414 false, hbt, min_pcnt, 3414 false, hbt, min_pcnt,
@@ -3417,7 +3417,7 @@ single_entry:
3417 } 3417 }
3418 3418
3419 if (symbol_conf.event_group) { 3419 if (symbol_conf.event_group) {
3420 struct perf_evsel *pos; 3420 struct evsel *pos;
3421 3421
3422 nr_entries = 0; 3422 nr_entries = 0;
3423 evlist__for_each_entry(evlist, pos) { 3423 evlist__for_each_entry(evlist, pos) {
diff --git a/tools/perf/ui/browsers/res_sample.c b/tools/perf/ui/browsers/res_sample.c
index 8aa3547bb9ff..7f3576deafd7 100644
--- a/tools/perf/ui/browsers/res_sample.c
+++ b/tools/perf/ui/browsers/res_sample.c
@@ -24,7 +24,7 @@ void res_sample_init(void)
24} 24}
25 25
26int res_sample_browse(struct res_sample *res_samples, int num_res, 26int res_sample_browse(struct res_sample *res_samples, int num_res,
27 struct perf_evsel *evsel, enum rstype rstype) 27 struct evsel *evsel, enum rstype rstype)
28{ 28{
29 char **names; 29 char **names;
30 int i, n; 30 int i, n;
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 4d565cc14076..c0462457e9f9 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -78,7 +78,7 @@ static int scripts_config(const char *var, const char *value, void *data)
78 * Return -1 on failure. 78 * Return -1 on failure.
79 */ 79 */
80static int list_scripts(char *script_name, bool *custom, 80static int list_scripts(char *script_name, bool *custom,
81 struct perf_evsel *evsel) 81 struct evsel *evsel)
82{ 82{
83 char *buf, *paths[SCRIPT_MAX_NO], *names[SCRIPT_MAX_NO]; 83 char *buf, *paths[SCRIPT_MAX_NO], *names[SCRIPT_MAX_NO];
84 int i, num, choice; 84 int i, num, choice;
@@ -162,7 +162,7 @@ void run_script(char *cmd)
162 SLsmg_refresh(); 162 SLsmg_refresh();
163} 163}
164 164
165int script_browse(const char *script_opt, struct perf_evsel *evsel) 165int script_browse(const char *script_opt, struct evsel *evsel)
166{ 166{
167 char *cmd, script_name[SCRIPT_FULLPATH_LEN]; 167 char *cmd, script_name[SCRIPT_FULLPATH_LEN];
168 bool custom = false; 168 bool custom = false;
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index 3af87c18a914..40e263a730e4 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -91,7 +91,7 @@ static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl)
91} 91}
92 92
93static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, 93static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
94 struct map *map, struct perf_evsel *evsel, 94 struct map *map, struct evsel *evsel,
95 struct hist_browser_timer *hbt __maybe_unused) 95 struct hist_browser_timer *hbt __maybe_unused)
96{ 96{
97 struct disasm_line *pos, *n; 97 struct disasm_line *pos, *n;
@@ -160,7 +160,7 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
160} 160}
161 161
162static int symbol__gtk_annotate(struct symbol *sym, struct map *map, 162static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
163 struct perf_evsel *evsel, 163 struct evsel *evsel,
164 struct hist_browser_timer *hbt) 164 struct hist_browser_timer *hbt)
165{ 165{
166 GtkWidget *window; 166 GtkWidget *window;
@@ -238,7 +238,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
238} 238}
239 239
240int hist_entry__gtk_annotate(struct hist_entry *he, 240int hist_entry__gtk_annotate(struct hist_entry *he,
241 struct perf_evsel *evsel, 241 struct evsel *evsel,
242 struct hist_browser_timer *hbt) 242 struct hist_browser_timer *hbt)
243{ 243{
244 return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt); 244 return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt);
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index 9846ea5c831b..e2f5fbef3c9a 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -52,7 +52,7 @@ static inline GtkWidget *perf_gtk__setup_info_bar(void)
52} 52}
53#endif 53#endif
54 54
55struct perf_evsel; 55struct evsel;
56struct perf_evlist; 56struct perf_evlist;
57struct hist_entry; 57struct hist_entry;
58struct hist_browser_timer; 58struct hist_browser_timer;
@@ -61,7 +61,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
61 struct hist_browser_timer *hbt, 61 struct hist_browser_timer *hbt,
62 float min_pcnt); 62 float min_pcnt);
63int hist_entry__gtk_annotate(struct hist_entry *he, 63int hist_entry__gtk_annotate(struct hist_entry *he,
64 struct perf_evsel *evsel, 64 struct evsel *evsel,
65 struct hist_browser_timer *hbt); 65 struct hist_browser_timer *hbt);
66void perf_gtk__show_annotations(void); 66void perf_gtk__show_annotations(void);
67 67
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 3955ed1d1bd9..d5c9fe230632 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -595,7 +595,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
595 struct hist_browser_timer *hbt __maybe_unused, 595 struct hist_browser_timer *hbt __maybe_unused,
596 float min_pcnt) 596 float min_pcnt)
597{ 597{
598 struct perf_evsel *pos; 598 struct evsel *pos;
599 GtkWidget *vbox; 599 GtkWidget *vbox;
600 GtkWidget *notebook; 600 GtkWidget *notebook;
601 GtkWidget *info_bar; 601 GtkWidget *info_bar;
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 412d6f1626e3..214af526901b 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -25,7 +25,7 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
25{ 25{
26 int ret; 26 int ret;
27 struct hists *hists = he->hists; 27 struct hists *hists = he->hists;
28 struct perf_evsel *evsel = hists_to_evsel(hists); 28 struct evsel *evsel = hists_to_evsel(hists);
29 char *buf = hpp->buf; 29 char *buf = hpp->buf;
30 size_t size = hpp->size; 30 size_t size = hpp->size;
31 31
@@ -153,7 +153,7 @@ static int __hpp__sort(struct hist_entry *a, struct hist_entry *b,
153{ 153{
154 s64 ret; 154 s64 ret;
155 int i, nr_members; 155 int i, nr_members;
156 struct perf_evsel *evsel; 156 struct evsel *evsel;
157 struct hist_entry *pair; 157 struct hist_entry *pair;
158 u64 *fields_a, *fields_b; 158 u64 *fields_a, *fields_b;
159 159
@@ -223,7 +223,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
223 struct hists *hists) 223 struct hists *hists)
224{ 224{
225 int len = fmt->user_len ?: fmt->len; 225 int len = fmt->user_len ?: fmt->len;
226 struct perf_evsel *evsel = hists_to_evsel(hists); 226 struct evsel *evsel = hists_to_evsel(hists);
227 227
228 if (symbol_conf.event_group) 228 if (symbol_conf.event_group)
229 len = max(len, evsel->nr_members * fmt->len); 229 len = max(len, evsel->nr_members * fmt->len);
@@ -797,7 +797,7 @@ static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt)
797int perf_hpp__setup_hists_formats(struct perf_hpp_list *list, 797int perf_hpp__setup_hists_formats(struct perf_hpp_list *list,
798 struct perf_evlist *evlist) 798 struct perf_evlist *evlist)
799{ 799{
800 struct perf_evsel *evsel; 800 struct evsel *evsel;
801 struct perf_hpp_fmt *fmt; 801 struct perf_hpp_fmt *fmt;
802 struct hists *hists; 802 struct hists *hists;
803 int ret; 803 int ret;
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index ac9ad2330f93..6ea5d678a81c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -929,7 +929,7 @@ alloc_histograms:
929} 929}
930 930
931static int symbol__inc_addr_samples(struct symbol *sym, struct map *map, 931static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
932 struct perf_evsel *evsel, u64 addr, 932 struct evsel *evsel, u64 addr,
933 struct perf_sample *sample) 933 struct perf_sample *sample)
934{ 934{
935 struct annotated_source *src; 935 struct annotated_source *src;
@@ -1080,13 +1080,13 @@ void annotation__compute_ipc(struct annotation *notes, size_t size)
1080} 1080}
1081 1081
1082int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample, 1082int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
1083 struct perf_evsel *evsel) 1083 struct evsel *evsel)
1084{ 1084{
1085 return symbol__inc_addr_samples(ams->sym, ams->map, evsel, ams->al_addr, sample); 1085 return symbol__inc_addr_samples(ams->sym, ams->map, evsel, ams->al_addr, sample);
1086} 1086}
1087 1087
1088int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample, 1088int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
1089 struct perf_evsel *evsel, u64 ip) 1089 struct evsel *evsel, u64 ip)
1090{ 1090{
1091 return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evsel, ip, sample); 1091 return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evsel, ip, sample);
1092} 1092}
@@ -1134,7 +1134,7 @@ struct annotate_args {
1134 size_t privsize; 1134 size_t privsize;
1135 struct arch *arch; 1135 struct arch *arch;
1136 struct map_symbol ms; 1136 struct map_symbol ms;
1137 struct perf_evsel *evsel; 1137 struct evsel *evsel;
1138 struct annotation_options *options; 1138 struct annotation_options *options;
1139 s64 offset; 1139 s64 offset;
1140 char *line; 1140 char *line;
@@ -1165,7 +1165,7 @@ static struct annotation_line *
1165annotation_line__new(struct annotate_args *args, size_t privsize) 1165annotation_line__new(struct annotate_args *args, size_t privsize)
1166{ 1166{
1167 struct annotation_line *al; 1167 struct annotation_line *al;
1168 struct perf_evsel *evsel = args->evsel; 1168 struct evsel *evsel = args->evsel;
1169 size_t size = privsize + sizeof(*al); 1169 size_t size = privsize + sizeof(*al);
1170 int nr = 1; 1170 int nr = 1;
1171 1171
@@ -1359,7 +1359,7 @@ static int disasm_line__print(struct disasm_line *dl, u64 start, int addr_fmt_wi
1359 1359
1360static int 1360static int
1361annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start, 1361annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start,
1362 struct perf_evsel *evsel, u64 len, int min_pcnt, int printed, 1362 struct evsel *evsel, u64 len, int min_pcnt, int printed,
1363 int max_lines, struct annotation_line *queue, int addr_fmt_width, 1363 int max_lines, struct annotation_line *queue, int addr_fmt_width,
1364 int percent_type) 1364 int percent_type)
1365{ 1365{
@@ -2011,10 +2011,10 @@ static void calc_percent(struct sym_hist *sym_hist,
2011} 2011}
2012 2012
2013static void annotation__calc_percent(struct annotation *notes, 2013static void annotation__calc_percent(struct annotation *notes,
2014 struct perf_evsel *leader, s64 len) 2014 struct evsel *leader, s64 len)
2015{ 2015{
2016 struct annotation_line *al, *next; 2016 struct annotation_line *al, *next;
2017 struct perf_evsel *evsel; 2017 struct evsel *evsel;
2018 2018
2019 list_for_each_entry(al, &notes->src->source, node) { 2019 list_for_each_entry(al, &notes->src->source, node) {
2020 s64 end; 2020 s64 end;
@@ -2041,7 +2041,7 @@ static void annotation__calc_percent(struct annotation *notes,
2041 } 2041 }
2042} 2042}
2043 2043
2044void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel) 2044void symbol__calc_percent(struct symbol *sym, struct evsel *evsel)
2045{ 2045{
2046 struct annotation *notes = symbol__annotation(sym); 2046 struct annotation *notes = symbol__annotation(sym);
2047 2047
@@ -2049,7 +2049,7 @@ void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel)
2049} 2049}
2050 2050
2051int symbol__annotate(struct symbol *sym, struct map *map, 2051int symbol__annotate(struct symbol *sym, struct map *map,
2052 struct perf_evsel *evsel, size_t privsize, 2052 struct evsel *evsel, size_t privsize,
2053 struct annotation_options *options, 2053 struct annotation_options *options,
2054 struct arch **parch) 2054 struct arch **parch)
2055{ 2055{
@@ -2214,7 +2214,7 @@ static void print_summary(struct rb_root *root, const char *filename)
2214 } 2214 }
2215} 2215}
2216 2216
2217static void symbol__annotate_hits(struct symbol *sym, struct perf_evsel *evsel) 2217static void symbol__annotate_hits(struct symbol *sym, struct evsel *evsel)
2218{ 2218{
2219 struct annotation *notes = symbol__annotation(sym); 2219 struct annotation *notes = symbol__annotation(sym);
2220 struct sym_hist *h = annotation__histogram(notes, evsel->idx); 2220 struct sym_hist *h = annotation__histogram(notes, evsel->idx);
@@ -2241,7 +2241,7 @@ static int annotated_source__addr_fmt_width(struct list_head *lines, u64 start)
2241} 2241}
2242 2242
2243int symbol__annotate_printf(struct symbol *sym, struct map *map, 2243int symbol__annotate_printf(struct symbol *sym, struct map *map,
2244 struct perf_evsel *evsel, 2244 struct evsel *evsel,
2245 struct annotation_options *opts) 2245 struct annotation_options *opts)
2246{ 2246{
2247 struct dso *dso = map->dso; 2247 struct dso *dso = map->dso;
@@ -2405,7 +2405,7 @@ static int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp,
2405 return 0; 2405 return 0;
2406} 2406}
2407 2407
2408int map_symbol__annotation_dump(struct map_symbol *ms, struct perf_evsel *evsel, 2408int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel,
2409 struct annotation_options *opts) 2409 struct annotation_options *opts)
2410{ 2410{
2411 const char *ev_name = perf_evsel__name(evsel); 2411 const char *ev_name = perf_evsel__name(evsel);
@@ -2657,7 +2657,7 @@ static void symbol__calc_lines(struct symbol *sym, struct map *map,
2657} 2657}
2658 2658
2659int symbol__tty_annotate2(struct symbol *sym, struct map *map, 2659int symbol__tty_annotate2(struct symbol *sym, struct map *map,
2660 struct perf_evsel *evsel, 2660 struct evsel *evsel,
2661 struct annotation_options *opts) 2661 struct annotation_options *opts)
2662{ 2662{
2663 struct dso *dso = map->dso; 2663 struct dso *dso = map->dso;
@@ -2685,7 +2685,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,
2685} 2685}
2686 2686
2687int symbol__tty_annotate(struct symbol *sym, struct map *map, 2687int symbol__tty_annotate(struct symbol *sym, struct map *map,
2688 struct perf_evsel *evsel, 2688 struct evsel *evsel,
2689 struct annotation_options *opts) 2689 struct annotation_options *opts)
2690{ 2690{
2691 struct dso *dso = map->dso; 2691 struct dso *dso = map->dso;
@@ -2956,7 +2956,7 @@ void annotation_line__write(struct annotation_line *al, struct annotation *notes
2956 wops->write_graph); 2956 wops->write_graph);
2957} 2957}
2958 2958
2959int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *evsel, 2959int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel,
2960 struct annotation_options *options, struct arch **parch) 2960 struct annotation_options *options, struct arch **parch)
2961{ 2961{
2962 struct annotation *notes = symbol__annotation(sym); 2962 struct annotation *notes = symbol__annotation(sym);
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 5bc0cf655d37..7c42f320efa2 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -20,7 +20,7 @@ struct map_symbol;
20struct addr_map_symbol; 20struct addr_map_symbol;
21struct option; 21struct option;
22struct perf_sample; 22struct perf_sample;
23struct perf_evsel; 23struct evsel;
24struct symbol; 24struct symbol;
25 25
26struct ins { 26struct ins {
@@ -216,12 +216,12 @@ void annotation_line__write(struct annotation_line *al, struct annotation *notes
216 216
217int __annotation__scnprintf_samples_period(struct annotation *notes, 217int __annotation__scnprintf_samples_period(struct annotation *notes,
218 char *bf, size_t size, 218 char *bf, size_t size,
219 struct perf_evsel *evsel, 219 struct evsel *evsel,
220 bool show_freq); 220 bool show_freq);
221 221
222int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw, int max_ins_name); 222int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw, int max_ins_name);
223size_t disasm__fprintf(struct list_head *head, FILE *fp); 223size_t disasm__fprintf(struct list_head *head, FILE *fp);
224void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel); 224void symbol__calc_percent(struct symbol *sym, struct evsel *evsel);
225 225
226struct sym_hist { 226struct sym_hist {
227 u64 nr_samples; 227 u64 nr_samples;
@@ -335,24 +335,24 @@ static inline struct annotation *symbol__annotation(struct symbol *sym)
335} 335}
336 336
337int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample, 337int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
338 struct perf_evsel *evsel); 338 struct evsel *evsel);
339 339
340int addr_map_symbol__account_cycles(struct addr_map_symbol *ams, 340int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
341 struct addr_map_symbol *start, 341 struct addr_map_symbol *start,
342 unsigned cycles); 342 unsigned cycles);
343 343
344int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample, 344int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
345 struct perf_evsel *evsel, u64 addr); 345 struct evsel *evsel, u64 addr);
346 346
347struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists); 347struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists);
348void symbol__annotate_zero_histograms(struct symbol *sym); 348void symbol__annotate_zero_histograms(struct symbol *sym);
349 349
350int symbol__annotate(struct symbol *sym, struct map *map, 350int symbol__annotate(struct symbol *sym, struct map *map,
351 struct perf_evsel *evsel, size_t privsize, 351 struct evsel *evsel, size_t privsize,
352 struct annotation_options *options, 352 struct annotation_options *options,
353 struct arch **parch); 353 struct arch **parch);
354int symbol__annotate2(struct symbol *sym, struct map *map, 354int symbol__annotate2(struct symbol *sym, struct map *map,
355 struct perf_evsel *evsel, 355 struct evsel *evsel,
356 struct annotation_options *options, 356 struct annotation_options *options,
357 struct arch **parch); 357 struct arch **parch);
358 358
@@ -378,32 +378,32 @@ int symbol__strerror_disassemble(struct symbol *sym, struct map *map,
378 int errnum, char *buf, size_t buflen); 378 int errnum, char *buf, size_t buflen);
379 379
380int symbol__annotate_printf(struct symbol *sym, struct map *map, 380int symbol__annotate_printf(struct symbol *sym, struct map *map,
381 struct perf_evsel *evsel, 381 struct evsel *evsel,
382 struct annotation_options *options); 382 struct annotation_options *options);
383void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); 383void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);
384void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); 384void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);
385void annotated_source__purge(struct annotated_source *as); 385void annotated_source__purge(struct annotated_source *as);
386 386
387int map_symbol__annotation_dump(struct map_symbol *ms, struct perf_evsel *evsel, 387int map_symbol__annotation_dump(struct map_symbol *ms, struct evsel *evsel,
388 struct annotation_options *opts); 388 struct annotation_options *opts);
389 389
390bool ui__has_annotation(void); 390bool ui__has_annotation(void);
391 391
392int symbol__tty_annotate(struct symbol *sym, struct map *map, 392int symbol__tty_annotate(struct symbol *sym, struct map *map,
393 struct perf_evsel *evsel, struct annotation_options *opts); 393 struct evsel *evsel, struct annotation_options *opts);
394 394
395int symbol__tty_annotate2(struct symbol *sym, struct map *map, 395int symbol__tty_annotate2(struct symbol *sym, struct map *map,
396 struct perf_evsel *evsel, struct annotation_options *opts); 396 struct evsel *evsel, struct annotation_options *opts);
397 397
398#ifdef HAVE_SLANG_SUPPORT 398#ifdef HAVE_SLANG_SUPPORT
399int symbol__tui_annotate(struct symbol *sym, struct map *map, 399int symbol__tui_annotate(struct symbol *sym, struct map *map,
400 struct perf_evsel *evsel, 400 struct evsel *evsel,
401 struct hist_browser_timer *hbt, 401 struct hist_browser_timer *hbt,
402 struct annotation_options *opts); 402 struct annotation_options *opts);
403#else 403#else
404static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, 404static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
405 struct map *map __maybe_unused, 405 struct map *map __maybe_unused,
406 struct perf_evsel *evsel __maybe_unused, 406 struct evsel *evsel __maybe_unused,
407 struct hist_browser_timer *hbt __maybe_unused, 407 struct hist_browser_timer *hbt __maybe_unused,
408 struct annotation_options *opts __maybe_unused) 408 struct annotation_options *opts __maybe_unused)
409{ 409{
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index ec0af36697c4..98b151bc9a36 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -2084,7 +2084,7 @@ static char *addr_filter__to_str(struct addr_filter *filt)
2084 return err < 0 ? NULL : filter; 2084 return err < 0 ? NULL : filter;
2085} 2085}
2086 2086
2087static int parse_addr_filter(struct perf_evsel *evsel, const char *filter, 2087static int parse_addr_filter(struct evsel *evsel, const char *filter,
2088 int max_nr) 2088 int max_nr)
2089{ 2089{
2090 struct addr_filters filts; 2090 struct addr_filters filts;
@@ -2135,7 +2135,7 @@ out_exit:
2135 return err; 2135 return err;
2136} 2136}
2137 2137
2138static struct perf_pmu *perf_evsel__find_pmu(struct perf_evsel *evsel) 2138static struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel)
2139{ 2139{
2140 struct perf_pmu *pmu = NULL; 2140 struct perf_pmu *pmu = NULL;
2141 2141
@@ -2147,7 +2147,7 @@ static struct perf_pmu *perf_evsel__find_pmu(struct perf_evsel *evsel)
2147 return pmu; 2147 return pmu;
2148} 2148}
2149 2149
2150static int perf_evsel__nr_addr_filter(struct perf_evsel *evsel) 2150static int perf_evsel__nr_addr_filter(struct evsel *evsel)
2151{ 2151{
2152 struct perf_pmu *pmu = perf_evsel__find_pmu(evsel); 2152 struct perf_pmu *pmu = perf_evsel__find_pmu(evsel);
2153 int nr_addr_filters = 0; 2153 int nr_addr_filters = 0;
@@ -2162,7 +2162,7 @@ static int perf_evsel__nr_addr_filter(struct perf_evsel *evsel)
2162 2162
2163int auxtrace_parse_filters(struct perf_evlist *evlist) 2163int auxtrace_parse_filters(struct perf_evlist *evlist)
2164{ 2164{
2165 struct perf_evsel *evsel; 2165 struct evsel *evsel;
2166 char *filter; 2166 char *filter;
2167 int err, max_nr; 2167 int err, max_nr;
2168 2168
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 6d0dfb777a79..594ea279e25b 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -817,7 +817,7 @@ struct bpf_map_op {
817 } k; 817 } k;
818 union { 818 union {
819 u64 value; 819 u64 value;
820 struct perf_evsel *evsel; 820 struct evsel *evsel;
821 } v; 821 } v;
822}; 822};
823 823
@@ -1063,7 +1063,7 @@ __bpf_map__config_event(struct bpf_map *map,
1063 struct parse_events_term *term, 1063 struct parse_events_term *term,
1064 struct perf_evlist *evlist) 1064 struct perf_evlist *evlist)
1065{ 1065{
1066 struct perf_evsel *evsel; 1066 struct evsel *evsel;
1067 const struct bpf_map_def *def; 1067 const struct bpf_map_def *def;
1068 struct bpf_map_op *op; 1068 struct bpf_map_op *op;
1069 const char *map_name = bpf_map__name(map); 1069 const char *map_name = bpf_map__name(map);
@@ -1401,7 +1401,7 @@ apply_config_value_for_key(int map_fd, void *pkey,
1401 1401
1402static int 1402static int
1403apply_config_evsel_for_key(const char *name, int map_fd, void *pkey, 1403apply_config_evsel_for_key(const char *name, int map_fd, void *pkey,
1404 struct perf_evsel *evsel) 1404 struct evsel *evsel)
1405{ 1405{
1406 struct xyarray *xy = evsel->fd; 1406 struct xyarray *xy = evsel->fd;
1407 struct perf_event_attr *attr; 1407 struct perf_event_attr *attr;
@@ -1523,11 +1523,11 @@ int bpf__apply_obj_config(void)
1523 (strcmp(name, \ 1523 (strcmp(name, \
1524 bpf_map__name(pos)) == 0)) 1524 bpf_map__name(pos)) == 0))
1525 1525
1526struct perf_evsel *bpf__setup_output_event(struct perf_evlist *evlist, const char *name) 1526struct evsel *bpf__setup_output_event(struct perf_evlist *evlist, const char *name)
1527{ 1527{
1528 struct bpf_map_priv *tmpl_priv = NULL; 1528 struct bpf_map_priv *tmpl_priv = NULL;
1529 struct bpf_object *obj, *tmp; 1529 struct bpf_object *obj, *tmp;
1530 struct perf_evsel *evsel = NULL; 1530 struct evsel *evsel = NULL;
1531 struct bpf_map *map; 1531 struct bpf_map *map;
1532 int err; 1532 int err;
1533 bool need_init = false; 1533 bool need_init = false;
@@ -1602,7 +1602,7 @@ struct perf_evsel *bpf__setup_output_event(struct perf_evlist *evlist, const cha
1602 1602
1603int bpf__setup_stdout(struct perf_evlist *evlist) 1603int bpf__setup_stdout(struct perf_evlist *evlist)
1604{ 1604{
1605 struct perf_evsel *evsel = bpf__setup_output_event(evlist, "__bpf_stdout__"); 1605 struct evsel *evsel = bpf__setup_output_event(evlist, "__bpf_stdout__");
1606 return PTR_ERR_OR_ZERO(evsel); 1606 return PTR_ERR_OR_ZERO(evsel);
1607} 1607}
1608 1608
diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h
index 8c3441a4b72c..e2048c978a24 100644
--- a/tools/perf/util/bpf-loader.h
+++ b/tools/perf/util/bpf-loader.h
@@ -39,7 +39,7 @@ enum bpf_loader_errno {
39 __BPF_LOADER_ERRNO__END, 39 __BPF_LOADER_ERRNO__END,
40}; 40};
41 41
42struct perf_evsel; 42struct evsel;
43struct perf_evlist; 43struct perf_evlist;
44struct bpf_object; 44struct bpf_object;
45struct parse_events_term; 45struct parse_events_term;
@@ -80,7 +80,7 @@ int bpf__apply_obj_config(void);
80int bpf__strerror_apply_obj_config(int err, char *buf, size_t size); 80int bpf__strerror_apply_obj_config(int err, char *buf, size_t size);
81 81
82int bpf__setup_stdout(struct perf_evlist *evlist); 82int bpf__setup_stdout(struct perf_evlist *evlist);
83struct perf_evsel *bpf__setup_output_event(struct perf_evlist *evlist, const char *name); 83struct evsel *bpf__setup_output_event(struct perf_evlist *evlist, const char *name);
84int bpf__strerror_setup_output_event(struct perf_evlist *evlist, int err, char *buf, size_t size); 84int bpf__strerror_setup_output_event(struct perf_evlist *evlist, int err, char *buf, size_t size);
85#else 85#else
86#include <errno.h> 86#include <errno.h>
@@ -137,7 +137,7 @@ bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused)
137 return 0; 137 return 0;
138} 138}
139 139
140static inline struct perf_evsel * 140static inline struct evsel *
141bpf__setup_output_event(struct perf_evlist *evlist __maybe_unused, const char *name __maybe_unused) 141bpf__setup_output_event(struct perf_evlist *evlist __maybe_unused, const char *name __maybe_unused)
142{ 142{
143 return NULL; 143 return NULL;
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index f1abfab7aa8c..b98754863de9 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -37,7 +37,7 @@ static bool no_buildid_cache;
37int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, 37int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
38 union perf_event *event, 38 union perf_event *event,
39 struct perf_sample *sample, 39 struct perf_sample *sample,
40 struct perf_evsel *evsel __maybe_unused, 40 struct evsel *evsel __maybe_unused,
41 struct machine *machine) 41 struct machine *machine)
42{ 42{
43 struct addr_location al; 43 struct addr_location al;
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index 93668f38f1ed..aad419bb165c 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -24,7 +24,7 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
24 bool is_debug); 24 bool is_debug);
25 25
26int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, 26int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
27 struct perf_sample *sample, struct perf_evsel *evsel, 27 struct perf_sample *sample, struct evsel *evsel,
28 struct machine *machine); 28 struct machine *machine);
29 29
30int dsos__hit_all(struct perf_session *session); 30int dsos__hit_all(struct perf_session *session);
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 8d7d8f62fcca..d077704f9afa 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -1077,7 +1077,7 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
1077 1077
1078int sample__resolve_callchain(struct perf_sample *sample, 1078int sample__resolve_callchain(struct perf_sample *sample,
1079 struct callchain_cursor *cursor, struct symbol **parent, 1079 struct callchain_cursor *cursor, struct symbol **parent,
1080 struct perf_evsel *evsel, struct addr_location *al, 1080 struct evsel *evsel, struct addr_location *al,
1081 int max_stack) 1081 int max_stack)
1082{ 1082{
1083 if (sample->callchain == NULL && !symbol_conf.show_branchflag_count) 1083 if (sample->callchain == NULL && !symbol_conf.show_branchflag_count)
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 80e056a3d882..45b9ed49e2b1 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -236,7 +236,7 @@ int record_opts__parse_callchain(struct record_opts *record,
236 236
237int sample__resolve_callchain(struct perf_sample *sample, 237int sample__resolve_callchain(struct perf_sample *sample,
238 struct callchain_cursor *cursor, struct symbol **parent, 238 struct callchain_cursor *cursor, struct symbol **parent,
239 struct perf_evsel *evsel, struct addr_location *al, 239 struct evsel *evsel, struct addr_location *al,
240 int max_stack); 240 int max_stack);
241int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample); 241int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample);
242int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node, 242int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node,
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 484c29830a81..4f5c326a9477 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -92,7 +92,7 @@ static int open_cgroup(const char *name)
92 92
93static struct cgroup *evlist__find_cgroup(struct perf_evlist *evlist, const char *str) 93static struct cgroup *evlist__find_cgroup(struct perf_evlist *evlist, const char *str)
94{ 94{
95 struct perf_evsel *counter; 95 struct evsel *counter;
96 /* 96 /*
97 * check if cgrp is already defined, if so we reuse it 97 * check if cgrp is already defined, if so we reuse it
98 */ 98 */
@@ -139,7 +139,7 @@ struct cgroup *evlist__findnew_cgroup(struct perf_evlist *evlist, const char *na
139 139
140static int add_cgroup(struct perf_evlist *evlist, const char *str) 140static int add_cgroup(struct perf_evlist *evlist, const char *str)
141{ 141{
142 struct perf_evsel *counter; 142 struct evsel *counter;
143 struct cgroup *cgrp = evlist__findnew_cgroup(evlist, str); 143 struct cgroup *cgrp = evlist__findnew_cgroup(evlist, str);
144 int n; 144 int n;
145 145
@@ -184,7 +184,7 @@ struct cgroup *cgroup__get(struct cgroup *cgroup)
184 return cgroup; 184 return cgroup;
185} 185}
186 186
187static void evsel__set_default_cgroup(struct perf_evsel *evsel, struct cgroup *cgroup) 187static void evsel__set_default_cgroup(struct evsel *evsel, struct cgroup *cgroup)
188{ 188{
189 if (evsel->cgrp == NULL) 189 if (evsel->cgrp == NULL)
190 evsel->cgrp = cgroup__get(cgroup); 190 evsel->cgrp = cgroup__get(cgroup);
@@ -192,7 +192,7 @@ static void evsel__set_default_cgroup(struct perf_evsel *evsel, struct cgroup *c
192 192
193void evlist__set_default_cgroup(struct perf_evlist *evlist, struct cgroup *cgroup) 193void evlist__set_default_cgroup(struct perf_evlist *evlist, struct cgroup *cgroup)
194{ 194{
195 struct perf_evsel *evsel; 195 struct evsel *evsel;
196 196
197 evlist__for_each_entry(evlist, evsel) 197 evlist__for_each_entry(evlist, evsel)
198 evsel__set_default_cgroup(evsel, cgroup); 198 evsel__set_default_cgroup(evsel, cgroup);
@@ -202,7 +202,7 @@ int parse_cgroups(const struct option *opt, const char *str,
202 int unset __maybe_unused) 202 int unset __maybe_unused)
203{ 203{
204 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; 204 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
205 struct perf_evsel *counter; 205 struct evsel *counter;
206 struct cgroup *cgrp = NULL; 206 struct cgroup *cgrp = NULL;
207 const char *p, *e, *eos = str + strlen(str); 207 const char *p, *e, *eos = str + strlen(str);
208 char *s; 208 char *s;
diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c
index 01ee81df3fe5..f94e1a23dad6 100644
--- a/tools/perf/util/counts.c
+++ b/tools/perf/util/counts.c
@@ -48,18 +48,18 @@ static void perf_counts__reset(struct perf_counts *counts)
48 xyarray__reset(counts->values); 48 xyarray__reset(counts->values);
49} 49}
50 50
51void perf_evsel__reset_counts(struct perf_evsel *evsel) 51void perf_evsel__reset_counts(struct evsel *evsel)
52{ 52{
53 perf_counts__reset(evsel->counts); 53 perf_counts__reset(evsel->counts);
54} 54}
55 55
56int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads) 56int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads)
57{ 57{
58 evsel->counts = perf_counts__new(ncpus, nthreads); 58 evsel->counts = perf_counts__new(ncpus, nthreads);
59 return evsel->counts != NULL ? 0 : -ENOMEM; 59 return evsel->counts != NULL ? 0 : -ENOMEM;
60} 60}
61 61
62void perf_evsel__free_counts(struct perf_evsel *evsel) 62void perf_evsel__free_counts(struct evsel *evsel)
63{ 63{
64 perf_counts__delete(evsel->counts); 64 perf_counts__delete(evsel->counts);
65 evsel->counts = NULL; 65 evsel->counts = NULL;
diff --git a/tools/perf/util/counts.h b/tools/perf/util/counts.h
index 460b56ce3252..0f0cb2d8f70d 100644
--- a/tools/perf/util/counts.h
+++ b/tools/perf/util/counts.h
@@ -44,8 +44,8 @@ perf_counts__set_loaded(struct perf_counts *counts, int cpu, int thread, bool lo
44struct perf_counts *perf_counts__new(int ncpus, int nthreads); 44struct perf_counts *perf_counts__new(int ncpus, int nthreads);
45void perf_counts__delete(struct perf_counts *counts); 45void perf_counts__delete(struct perf_counts *counts);
46 46
47void perf_evsel__reset_counts(struct perf_evsel *evsel); 47void perf_evsel__reset_counts(struct evsel *evsel);
48int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads); 48int perf_evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads);
49void perf_evsel__free_counts(struct perf_evsel *evsel); 49void perf_evsel__free_counts(struct evsel *evsel);
50 50
51#endif /* __PERF_COUNTS_H */ 51#endif /* __PERF_COUNTS_H */
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 3d1c34fc4d68..5a9fcb60ec88 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1223,7 +1223,7 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
1223 struct perf_session *session) 1223 struct perf_session *session)
1224{ 1224{
1225 struct perf_evlist *evlist = session->evlist; 1225 struct perf_evlist *evlist = session->evlist;
1226 struct perf_evsel *evsel; 1226 struct evsel *evsel;
1227 struct perf_event_attr attr; 1227 struct perf_event_attr attr;
1228 bool found = false; 1228 bool found = false;
1229 u64 id; 1229 u64 id;
@@ -2294,7 +2294,7 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session,
2294 2294
2295static bool cs_etm__is_timeless_decoding(struct cs_etm_auxtrace *etm) 2295static bool cs_etm__is_timeless_decoding(struct cs_etm_auxtrace *etm)
2296{ 2296{
2297 struct perf_evsel *evsel; 2297 struct evsel *evsel;
2298 struct perf_evlist *evlist = etm->session->evlist; 2298 struct perf_evlist *evlist = etm->session->evlist;
2299 bool timeless_decoding = true; 2299 bool timeless_decoding = true;
2300 2300
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index ddbcd59f2d9b..042ee5b6f9f1 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -413,7 +413,7 @@ static int add_tracepoint_fields_values(struct ctf_writer *cw,
413static int add_tracepoint_values(struct ctf_writer *cw, 413static int add_tracepoint_values(struct ctf_writer *cw,
414 struct bt_ctf_event_class *event_class, 414 struct bt_ctf_event_class *event_class,
415 struct bt_ctf_event *event, 415 struct bt_ctf_event *event,
416 struct perf_evsel *evsel, 416 struct evsel *evsel,
417 struct perf_sample *sample) 417 struct perf_sample *sample)
418{ 418{
419 struct tep_format_field *common_fields = evsel->tp_format->format.common_fields; 419 struct tep_format_field *common_fields = evsel->tp_format->format.common_fields;
@@ -584,7 +584,7 @@ put_len_type:
584 584
585static int add_generic_values(struct ctf_writer *cw, 585static int add_generic_values(struct ctf_writer *cw,
586 struct bt_ctf_event *event, 586 struct bt_ctf_event *event,
587 struct perf_evsel *evsel, 587 struct evsel *evsel,
588 struct perf_sample *sample) 588 struct perf_sample *sample)
589{ 589{
590 u64 type = evsel->attr.sample_type; 590 u64 type = evsel->attr.sample_type;
@@ -753,7 +753,7 @@ static struct ctf_stream *ctf_stream(struct ctf_writer *cw, int cpu)
753} 753}
754 754
755static int get_sample_cpu(struct ctf_writer *cw, struct perf_sample *sample, 755static int get_sample_cpu(struct ctf_writer *cw, struct perf_sample *sample,
756 struct perf_evsel *evsel) 756 struct evsel *evsel)
757{ 757{
758 int cpu = 0; 758 int cpu = 0;
759 759
@@ -785,7 +785,7 @@ static bool is_flush_needed(struct ctf_stream *cs)
785static int process_sample_event(struct perf_tool *tool, 785static int process_sample_event(struct perf_tool *tool,
786 union perf_event *_event, 786 union perf_event *_event,
787 struct perf_sample *sample, 787 struct perf_sample *sample,
788 struct perf_evsel *evsel, 788 struct evsel *evsel,
789 struct machine *machine __maybe_unused) 789 struct machine *machine __maybe_unused)
790{ 790{
791 struct convert *c = container_of(tool, struct convert, tool); 791 struct convert *c = container_of(tool, struct convert, tool);
@@ -1051,7 +1051,7 @@ static int add_tracepoint_fields_types(struct ctf_writer *cw,
1051} 1051}
1052 1052
1053static int add_tracepoint_types(struct ctf_writer *cw, 1053static int add_tracepoint_types(struct ctf_writer *cw,
1054 struct perf_evsel *evsel, 1054 struct evsel *evsel,
1055 struct bt_ctf_event_class *class) 1055 struct bt_ctf_event_class *class)
1056{ 1056{
1057 struct tep_format_field *common_fields = evsel->tp_format->format.common_fields; 1057 struct tep_format_field *common_fields = evsel->tp_format->format.common_fields;
@@ -1084,7 +1084,7 @@ static int add_bpf_output_types(struct ctf_writer *cw,
1084 return bt_ctf_event_class_add_field(class, seq_type, "raw_data"); 1084 return bt_ctf_event_class_add_field(class, seq_type, "raw_data");
1085} 1085}
1086 1086
1087static int add_generic_types(struct ctf_writer *cw, struct perf_evsel *evsel, 1087static int add_generic_types(struct ctf_writer *cw, struct evsel *evsel,
1088 struct bt_ctf_event_class *event_class) 1088 struct bt_ctf_event_class *event_class)
1089{ 1089{
1090 u64 type = evsel->attr.sample_type; 1090 u64 type = evsel->attr.sample_type;
@@ -1150,7 +1150,7 @@ static int add_generic_types(struct ctf_writer *cw, struct perf_evsel *evsel,
1150 return 0; 1150 return 0;
1151} 1151}
1152 1152
1153static int add_event(struct ctf_writer *cw, struct perf_evsel *evsel) 1153static int add_event(struct ctf_writer *cw, struct evsel *evsel)
1154{ 1154{
1155 struct bt_ctf_event_class *event_class; 1155 struct bt_ctf_event_class *event_class;
1156 struct evsel_priv *priv; 1156 struct evsel_priv *priv;
@@ -1202,7 +1202,7 @@ err:
1202static int setup_events(struct ctf_writer *cw, struct perf_session *session) 1202static int setup_events(struct ctf_writer *cw, struct perf_session *session)
1203{ 1203{
1204 struct perf_evlist *evlist = session->evlist; 1204 struct perf_evlist *evlist = session->evlist;
1205 struct perf_evsel *evsel; 1205 struct evsel *evsel;
1206 int ret; 1206 int ret;
1207 1207
1208 evlist__for_each_entry(evlist, evsel) { 1208 evlist__for_each_entry(evlist, evsel) {
@@ -1309,7 +1309,7 @@ static int setup_non_sample_events(struct ctf_writer *cw,
1309static void cleanup_events(struct perf_session *session) 1309static void cleanup_events(struct perf_session *session)
1310{ 1310{
1311 struct perf_evlist *evlist = session->evlist; 1311 struct perf_evlist *evlist = session->evlist;
1312 struct perf_evsel *evsel; 1312 struct evsel *evsel;
1313 1313
1314 evlist__for_each_entry(evlist, evsel) { 1314 evlist__for_each_entry(evlist, evsel) {
1315 struct evsel_priv *priv; 1315 struct evsel_priv *priv;
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index ffbb3e7d3288..dc2d4de772e3 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -32,7 +32,7 @@ void db_export__exit(struct db_export *dbe)
32 dbe->crp = NULL; 32 dbe->crp = NULL;
33} 33}
34 34
35int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel) 35int db_export__evsel(struct db_export *dbe, struct evsel *evsel)
36{ 36{
37 if (evsel->db_id) 37 if (evsel->db_id)
38 return 0; 38 return 0;
@@ -209,7 +209,7 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
209 struct machine *machine, 209 struct machine *machine,
210 struct thread *thread, 210 struct thread *thread,
211 struct perf_sample *sample, 211 struct perf_sample *sample,
212 struct perf_evsel *evsel) 212 struct evsel *evsel)
213{ 213{
214 u64 kernel_start = machine__kernel_start(machine); 214 u64 kernel_start = machine__kernel_start(machine);
215 struct call_path *current = &dbe->cpr->call_path; 215 struct call_path *current = &dbe->cpr->call_path;
@@ -341,7 +341,7 @@ static int db_export__threads(struct db_export *dbe, struct thread *thread,
341} 341}
342 342
343int db_export__sample(struct db_export *dbe, union perf_event *event, 343int db_export__sample(struct db_export *dbe, union perf_event *event,
344 struct perf_sample *sample, struct perf_evsel *evsel, 344 struct perf_sample *sample, struct evsel *evsel,
345 struct addr_location *al) 345 struct addr_location *al)
346{ 346{
347 struct thread *thread = al->thread; 347 struct thread *thread = al->thread;
diff --git a/tools/perf/util/db-export.h b/tools/perf/util/db-export.h
index ba1f62a5fe10..9c3d38f5a40d 100644
--- a/tools/perf/util/db-export.h
+++ b/tools/perf/util/db-export.h
@@ -10,7 +10,7 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/list.h> 11#include <linux/list.h>
12 12
13struct perf_evsel; 13struct evsel;
14struct machine; 14struct machine;
15struct thread; 15struct thread;
16struct comm; 16struct comm;
@@ -25,7 +25,7 @@ struct call_return;
25struct export_sample { 25struct export_sample {
26 union perf_event *event; 26 union perf_event *event;
27 struct perf_sample *sample; 27 struct perf_sample *sample;
28 struct perf_evsel *evsel; 28 struct evsel *evsel;
29 struct addr_location *al; 29 struct addr_location *al;
30 u64 db_id; 30 u64 db_id;
31 u64 comm_db_id; 31 u64 comm_db_id;
@@ -39,7 +39,7 @@ struct export_sample {
39}; 39};
40 40
41struct db_export { 41struct db_export {
42 int (*export_evsel)(struct db_export *dbe, struct perf_evsel *evsel); 42 int (*export_evsel)(struct db_export *dbe, struct evsel *evsel);
43 int (*export_machine)(struct db_export *dbe, struct machine *machine); 43 int (*export_machine)(struct db_export *dbe, struct machine *machine);
44 int (*export_thread)(struct db_export *dbe, struct thread *thread, 44 int (*export_thread)(struct db_export *dbe, struct thread *thread,
45 u64 main_thread_db_id, struct machine *machine); 45 u64 main_thread_db_id, struct machine *machine);
@@ -79,7 +79,7 @@ struct db_export {
79 79
80int db_export__init(struct db_export *dbe); 80int db_export__init(struct db_export *dbe);
81void db_export__exit(struct db_export *dbe); 81void db_export__exit(struct db_export *dbe);
82int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel); 82int db_export__evsel(struct db_export *dbe, struct evsel *evsel);
83int db_export__machine(struct db_export *dbe, struct machine *machine); 83int db_export__machine(struct db_export *dbe, struct machine *machine);
84int db_export__thread(struct db_export *dbe, struct thread *thread, 84int db_export__thread(struct db_export *dbe, struct thread *thread,
85 struct machine *machine, struct thread *main_thread); 85 struct machine *machine, struct thread *main_thread);
@@ -96,7 +96,7 @@ int db_export__symbol(struct db_export *dbe, struct symbol *sym,
96int db_export__branch_type(struct db_export *dbe, u32 branch_type, 96int db_export__branch_type(struct db_export *dbe, u32 branch_type,
97 const char *name); 97 const char *name);
98int db_export__sample(struct db_export *dbe, union perf_event *event, 98int db_export__sample(struct db_export *dbe, union perf_event *event,
99 struct perf_sample *sample, struct perf_evsel *evsel, 99 struct perf_sample *sample, struct evsel *evsel,
100 struct addr_location *al); 100 struct addr_location *al);
101 101
102int db_export__branch_types(struct db_export *dbe); 102int db_export__branch_types(struct db_export *dbe);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a95d0461f718..7e6066cb525b 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -98,7 +98,7 @@ struct perf_evlist *perf_evlist__new_dummy(void)
98 */ 98 */
99void perf_evlist__set_id_pos(struct perf_evlist *evlist) 99void perf_evlist__set_id_pos(struct perf_evlist *evlist)
100{ 100{
101 struct perf_evsel *first = perf_evlist__first(evlist); 101 struct evsel *first = perf_evlist__first(evlist);
102 102
103 evlist->id_pos = first->id_pos; 103 evlist->id_pos = first->id_pos;
104 evlist->is_pos = first->is_pos; 104 evlist->is_pos = first->is_pos;
@@ -106,7 +106,7 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist)
106 106
107static void perf_evlist__update_id_pos(struct perf_evlist *evlist) 107static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
108{ 108{
109 struct perf_evsel *evsel; 109 struct evsel *evsel;
110 110
111 evlist__for_each_entry(evlist, evsel) 111 evlist__for_each_entry(evlist, evsel)
112 perf_evsel__calc_id_pos(evsel); 112 perf_evsel__calc_id_pos(evsel);
@@ -116,7 +116,7 @@ static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
116 116
117static void perf_evlist__purge(struct perf_evlist *evlist) 117static void perf_evlist__purge(struct perf_evlist *evlist)
118{ 118{
119 struct perf_evsel *pos, *n; 119 struct evsel *pos, *n;
120 120
121 evlist__for_each_entry_safe(evlist, n, pos) { 121 evlist__for_each_entry_safe(evlist, n, pos) {
122 list_del_init(&pos->node); 122 list_del_init(&pos->node);
@@ -151,7 +151,7 @@ void perf_evlist__delete(struct perf_evlist *evlist)
151} 151}
152 152
153static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, 153static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
154 struct perf_evsel *evsel) 154 struct evsel *evsel)
155{ 155{
156 /* 156 /*
157 * We already have cpus for evsel (via PMU sysfs) so 157 * We already have cpus for evsel (via PMU sysfs) so
@@ -171,13 +171,13 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
171 171
172static void perf_evlist__propagate_maps(struct perf_evlist *evlist) 172static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
173{ 173{
174 struct perf_evsel *evsel; 174 struct evsel *evsel;
175 175
176 evlist__for_each_entry(evlist, evsel) 176 evlist__for_each_entry(evlist, evsel)
177 __perf_evlist__propagate_maps(evlist, evsel); 177 __perf_evlist__propagate_maps(evlist, evsel);
178} 178}
179 179
180void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) 180void perf_evlist__add(struct perf_evlist *evlist, struct evsel *entry)
181{ 181{
182 entry->evlist = evlist; 182 entry->evlist = evlist;
183 list_add_tail(&entry->node, &evlist->entries); 183 list_add_tail(&entry->node, &evlist->entries);
@@ -190,7 +190,7 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry)
190 __perf_evlist__propagate_maps(evlist, entry); 190 __perf_evlist__propagate_maps(evlist, entry);
191} 191}
192 192
193void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel) 193void perf_evlist__remove(struct perf_evlist *evlist, struct evsel *evsel)
194{ 194{
195 evsel->evlist = NULL; 195 evsel->evlist = NULL;
196 list_del_init(&evsel->node); 196 list_del_init(&evsel->node);
@@ -200,7 +200,7 @@ void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel)
200void perf_evlist__splice_list_tail(struct perf_evlist *evlist, 200void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
201 struct list_head *list) 201 struct list_head *list)
202{ 202{
203 struct perf_evsel *evsel, *temp; 203 struct evsel *evsel, *temp;
204 204
205 __evlist__for_each_entry_safe(list, temp, evsel) { 205 __evlist__for_each_entry_safe(list, temp, evsel) {
206 list_del_init(&evsel->node); 206 list_del_init(&evsel->node);
@@ -210,10 +210,10 @@ void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
210 210
211void __perf_evlist__set_leader(struct list_head *list) 211void __perf_evlist__set_leader(struct list_head *list)
212{ 212{
213 struct perf_evsel *evsel, *leader; 213 struct evsel *evsel, *leader;
214 214
215 leader = list_entry(list->next, struct perf_evsel, node); 215 leader = list_entry(list->next, struct evsel, node);
216 evsel = list_entry(list->prev, struct perf_evsel, node); 216 evsel = list_entry(list->prev, struct evsel, node);
217 217
218 leader->nr_members = evsel->idx - leader->idx + 1; 218 leader->nr_members = evsel->idx - leader->idx + 1;
219 219
@@ -232,7 +232,7 @@ void perf_evlist__set_leader(struct perf_evlist *evlist)
232 232
233int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise) 233int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise)
234{ 234{
235 struct perf_evsel *evsel = perf_evsel__new_cycles(precise); 235 struct evsel *evsel = perf_evsel__new_cycles(precise);
236 236
237 if (evsel == NULL) 237 if (evsel == NULL)
238 return -ENOMEM; 238 return -ENOMEM;
@@ -248,7 +248,7 @@ int perf_evlist__add_dummy(struct perf_evlist *evlist)
248 .config = PERF_COUNT_SW_DUMMY, 248 .config = PERF_COUNT_SW_DUMMY,
249 .size = sizeof(attr), /* to capture ABI version */ 249 .size = sizeof(attr), /* to capture ABI version */
250 }; 250 };
251 struct perf_evsel *evsel = perf_evsel__new_idx(&attr, evlist->nr_entries); 251 struct evsel *evsel = perf_evsel__new_idx(&attr, evlist->nr_entries);
252 252
253 if (evsel == NULL) 253 if (evsel == NULL)
254 return -ENOMEM; 254 return -ENOMEM;
@@ -260,7 +260,7 @@ int perf_evlist__add_dummy(struct perf_evlist *evlist)
260static int perf_evlist__add_attrs(struct perf_evlist *evlist, 260static int perf_evlist__add_attrs(struct perf_evlist *evlist,
261 struct perf_event_attr *attrs, size_t nr_attrs) 261 struct perf_event_attr *attrs, size_t nr_attrs)
262{ 262{
263 struct perf_evsel *evsel, *n; 263 struct evsel *evsel, *n;
264 LIST_HEAD(head); 264 LIST_HEAD(head);
265 size_t i; 265 size_t i;
266 266
@@ -292,10 +292,10 @@ int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
292 return perf_evlist__add_attrs(evlist, attrs, nr_attrs); 292 return perf_evlist__add_attrs(evlist, attrs, nr_attrs);
293} 293}
294 294
295struct perf_evsel * 295struct evsel *
296perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) 296perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id)
297{ 297{
298 struct perf_evsel *evsel; 298 struct evsel *evsel;
299 299
300 evlist__for_each_entry(evlist, evsel) { 300 evlist__for_each_entry(evlist, evsel) {
301 if (evsel->attr.type == PERF_TYPE_TRACEPOINT && 301 if (evsel->attr.type == PERF_TYPE_TRACEPOINT &&
@@ -306,11 +306,11 @@ perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id)
306 return NULL; 306 return NULL;
307} 307}
308 308
309struct perf_evsel * 309struct evsel *
310perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, 310perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist,
311 const char *name) 311 const char *name)
312{ 312{
313 struct perf_evsel *evsel; 313 struct evsel *evsel;
314 314
315 evlist__for_each_entry(evlist, evsel) { 315 evlist__for_each_entry(evlist, evsel) {
316 if ((evsel->attr.type == PERF_TYPE_TRACEPOINT) && 316 if ((evsel->attr.type == PERF_TYPE_TRACEPOINT) &&
@@ -324,7 +324,7 @@ perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist,
324int perf_evlist__add_newtp(struct perf_evlist *evlist, 324int perf_evlist__add_newtp(struct perf_evlist *evlist,
325 const char *sys, const char *name, void *handler) 325 const char *sys, const char *name, void *handler)
326{ 326{
327 struct perf_evsel *evsel = perf_evsel__newtp(sys, name); 327 struct evsel *evsel = perf_evsel__newtp(sys, name);
328 328
329 if (IS_ERR(evsel)) 329 if (IS_ERR(evsel))
330 return -1; 330 return -1;
@@ -335,7 +335,7 @@ int perf_evlist__add_newtp(struct perf_evlist *evlist,
335} 335}
336 336
337static int perf_evlist__nr_threads(struct perf_evlist *evlist, 337static int perf_evlist__nr_threads(struct perf_evlist *evlist,
338 struct perf_evsel *evsel) 338 struct evsel *evsel)
339{ 339{
340 if (evsel->system_wide) 340 if (evsel->system_wide)
341 return 1; 341 return 1;
@@ -345,7 +345,7 @@ static int perf_evlist__nr_threads(struct perf_evlist *evlist,
345 345
346void perf_evlist__disable(struct perf_evlist *evlist) 346void perf_evlist__disable(struct perf_evlist *evlist)
347{ 347{
348 struct perf_evsel *pos; 348 struct evsel *pos;
349 349
350 evlist__for_each_entry(evlist, pos) { 350 evlist__for_each_entry(evlist, pos) {
351 if (pos->disabled || !perf_evsel__is_group_leader(pos) || !pos->fd) 351 if (pos->disabled || !perf_evsel__is_group_leader(pos) || !pos->fd)
@@ -358,7 +358,7 @@ void perf_evlist__disable(struct perf_evlist *evlist)
358 358
359void perf_evlist__enable(struct perf_evlist *evlist) 359void perf_evlist__enable(struct perf_evlist *evlist)
360{ 360{
361 struct perf_evsel *pos; 361 struct evsel *pos;
362 362
363 evlist__for_each_entry(evlist, pos) { 363 evlist__for_each_entry(evlist, pos) {
364 if (!perf_evsel__is_group_leader(pos) || !pos->fd) 364 if (!perf_evsel__is_group_leader(pos) || !pos->fd)
@@ -375,7 +375,7 @@ void perf_evlist__toggle_enable(struct perf_evlist *evlist)
375} 375}
376 376
377static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist, 377static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist,
378 struct perf_evsel *evsel, int cpu) 378 struct evsel *evsel, int cpu)
379{ 379{
380 int thread; 380 int thread;
381 int nr_threads = perf_evlist__nr_threads(evlist, evsel); 381 int nr_threads = perf_evlist__nr_threads(evlist, evsel);
@@ -392,7 +392,7 @@ static int perf_evlist__enable_event_cpu(struct perf_evlist *evlist,
392} 392}
393 393
394static int perf_evlist__enable_event_thread(struct perf_evlist *evlist, 394static int perf_evlist__enable_event_thread(struct perf_evlist *evlist,
395 struct perf_evsel *evsel, 395 struct evsel *evsel,
396 int thread) 396 int thread)
397{ 397{
398 int cpu; 398 int cpu;
@@ -410,7 +410,7 @@ static int perf_evlist__enable_event_thread(struct perf_evlist *evlist,
410} 410}
411 411
412int perf_evlist__enable_event_idx(struct perf_evlist *evlist, 412int perf_evlist__enable_event_idx(struct perf_evlist *evlist,
413 struct perf_evsel *evsel, int idx) 413 struct evsel *evsel, int idx)
414{ 414{
415 bool per_cpu_mmaps = !cpu_map__empty(evlist->cpus); 415 bool per_cpu_mmaps = !cpu_map__empty(evlist->cpus);
416 416
@@ -425,7 +425,7 @@ int perf_evlist__alloc_pollfd(struct perf_evlist *evlist)
425 int nr_cpus = cpu_map__nr(evlist->cpus); 425 int nr_cpus = cpu_map__nr(evlist->cpus);
426 int nr_threads = thread_map__nr(evlist->threads); 426 int nr_threads = thread_map__nr(evlist->threads);
427 int nfds = 0; 427 int nfds = 0;
428 struct perf_evsel *evsel; 428 struct evsel *evsel;
429 429
430 evlist__for_each_entry(evlist, evsel) { 430 evlist__for_each_entry(evlist, evsel) {
431 if (evsel->system_wide) 431 if (evsel->system_wide)
@@ -484,7 +484,7 @@ int perf_evlist__poll(struct perf_evlist *evlist, int timeout)
484} 484}
485 485
486static void perf_evlist__id_hash(struct perf_evlist *evlist, 486static void perf_evlist__id_hash(struct perf_evlist *evlist,
487 struct perf_evsel *evsel, 487 struct evsel *evsel,
488 int cpu, int thread, u64 id) 488 int cpu, int thread, u64 id)
489{ 489{
490 int hash; 490 int hash;
@@ -496,7 +496,7 @@ static void perf_evlist__id_hash(struct perf_evlist *evlist,
496 hlist_add_head(&sid->node, &evlist->heads[hash]); 496 hlist_add_head(&sid->node, &evlist->heads[hash]);
497} 497}
498 498
499void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, 499void perf_evlist__id_add(struct perf_evlist *evlist, struct evsel *evsel,
500 int cpu, int thread, u64 id) 500 int cpu, int thread, u64 id)
501{ 501{
502 perf_evlist__id_hash(evlist, evsel, cpu, thread, id); 502 perf_evlist__id_hash(evlist, evsel, cpu, thread, id);
@@ -504,7 +504,7 @@ void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
504} 504}
505 505
506int perf_evlist__id_add_fd(struct perf_evlist *evlist, 506int perf_evlist__id_add_fd(struct perf_evlist *evlist,
507 struct perf_evsel *evsel, 507 struct evsel *evsel,
508 int cpu, int thread, int fd) 508 int cpu, int thread, int fd)
509{ 509{
510 u64 read_data[4] = { 0, }; 510 u64 read_data[4] = { 0, };
@@ -545,7 +545,7 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist,
545} 545}
546 546
547static void perf_evlist__set_sid_idx(struct perf_evlist *evlist, 547static void perf_evlist__set_sid_idx(struct perf_evlist *evlist,
548 struct perf_evsel *evsel, int idx, int cpu, 548 struct evsel *evsel, int idx, int cpu,
549 int thread) 549 int thread)
550{ 550{
551 struct perf_sample_id *sid = SID(evsel, cpu, thread); 551 struct perf_sample_id *sid = SID(evsel, cpu, thread);
@@ -576,7 +576,7 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id)
576 return NULL; 576 return NULL;
577} 577}
578 578
579struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id) 579struct evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
580{ 580{
581 struct perf_sample_id *sid; 581 struct perf_sample_id *sid;
582 582
@@ -593,7 +593,7 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
593 return NULL; 593 return NULL;
594} 594}
595 595
596struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist, 596struct evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
597 u64 id) 597 u64 id)
598{ 598{
599 struct perf_sample_id *sid; 599 struct perf_sample_id *sid;
@@ -629,10 +629,10 @@ static int perf_evlist__event2id(struct perf_evlist *evlist,
629 return 0; 629 return 0;
630} 630}
631 631
632struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist, 632struct evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
633 union perf_event *event) 633 union perf_event *event)
634{ 634{
635 struct perf_evsel *first = perf_evlist__first(evlist); 635 struct evsel *first = perf_evlist__first(evlist);
636 struct hlist_head *head; 636 struct hlist_head *head;
637 struct perf_sample_id *sid; 637 struct perf_sample_id *sid;
638 int hash; 638 int hash;
@@ -744,7 +744,7 @@ static struct perf_mmap *perf_evlist__alloc_mmap(struct perf_evlist *evlist,
744 744
745static bool 745static bool
746perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused, 746perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused,
747 struct perf_evsel *evsel) 747 struct evsel *evsel)
748{ 748{
749 if (evsel->attr.write_backward) 749 if (evsel->attr.write_backward)
750 return false; 750 return false;
@@ -755,7 +755,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
755 struct mmap_params *mp, int cpu_idx, 755 struct mmap_params *mp, int cpu_idx,
756 int thread, int *_output, int *_output_overwrite) 756 int thread, int *_output, int *_output_overwrite)
757{ 757{
758 struct perf_evsel *evsel; 758 struct evsel *evsel;
759 int revent; 759 int revent;
760 int evlist_cpu = cpu_map__cpu(evlist->cpus, cpu_idx); 760 int evlist_cpu = cpu_map__cpu(evlist->cpus, cpu_idx);
761 761
@@ -1011,7 +1011,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
1011 bool auxtrace_overwrite, int nr_cblocks, int affinity, int flush, 1011 bool auxtrace_overwrite, int nr_cblocks, int affinity, int flush,
1012 int comp_level) 1012 int comp_level)
1013{ 1013{
1014 struct perf_evsel *evsel; 1014 struct evsel *evsel;
1015 const struct perf_cpu_map *cpus = evlist->cpus; 1015 const struct perf_cpu_map *cpus = evlist->cpus;
1016 const struct perf_thread_map *threads = evlist->threads; 1016 const struct perf_thread_map *threads = evlist->threads;
1017 /* 1017 /*
@@ -1130,7 +1130,7 @@ void perf_evlist__set_maps(struct perf_evlist *evlist, struct perf_cpu_map *cpus
1130void __perf_evlist__set_sample_bit(struct perf_evlist *evlist, 1130void __perf_evlist__set_sample_bit(struct perf_evlist *evlist,
1131 enum perf_event_sample_format bit) 1131 enum perf_event_sample_format bit)
1132{ 1132{
1133 struct perf_evsel *evsel; 1133 struct evsel *evsel;
1134 1134
1135 evlist__for_each_entry(evlist, evsel) 1135 evlist__for_each_entry(evlist, evsel)
1136 __perf_evsel__set_sample_bit(evsel, bit); 1136 __perf_evsel__set_sample_bit(evsel, bit);
@@ -1139,15 +1139,15 @@ void __perf_evlist__set_sample_bit(struct perf_evlist *evlist,
1139void __perf_evlist__reset_sample_bit(struct perf_evlist *evlist, 1139void __perf_evlist__reset_sample_bit(struct perf_evlist *evlist,
1140 enum perf_event_sample_format bit) 1140 enum perf_event_sample_format bit)
1141{ 1141{
1142 struct perf_evsel *evsel; 1142 struct evsel *evsel;
1143 1143
1144 evlist__for_each_entry(evlist, evsel) 1144 evlist__for_each_entry(evlist, evsel)
1145 __perf_evsel__reset_sample_bit(evsel, bit); 1145 __perf_evsel__reset_sample_bit(evsel, bit);
1146} 1146}
1147 1147
1148int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel) 1148int perf_evlist__apply_filters(struct perf_evlist *evlist, struct evsel **err_evsel)
1149{ 1149{
1150 struct perf_evsel *evsel; 1150 struct evsel *evsel;
1151 int err = 0; 1151 int err = 0;
1152 1152
1153 evlist__for_each_entry(evlist, evsel) { 1153 evlist__for_each_entry(evlist, evsel) {
@@ -1170,7 +1170,7 @@ int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **e
1170 1170
1171int perf_evlist__set_tp_filter(struct perf_evlist *evlist, const char *filter) 1171int perf_evlist__set_tp_filter(struct perf_evlist *evlist, const char *filter)
1172{ 1172{
1173 struct perf_evsel *evsel; 1173 struct evsel *evsel;
1174 int err = 0; 1174 int err = 0;
1175 1175
1176 evlist__for_each_entry(evlist, evsel) { 1176 evlist__for_each_entry(evlist, evsel) {
@@ -1219,7 +1219,7 @@ int perf_evlist__set_tp_filter_pid(struct perf_evlist *evlist, pid_t pid)
1219 1219
1220bool perf_evlist__valid_sample_type(struct perf_evlist *evlist) 1220bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
1221{ 1221{
1222 struct perf_evsel *pos; 1222 struct evsel *pos;
1223 1223
1224 if (evlist->nr_entries == 1) 1224 if (evlist->nr_entries == 1)
1225 return true; 1225 return true;
@@ -1238,7 +1238,7 @@ bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
1238 1238
1239u64 __perf_evlist__combined_sample_type(struct perf_evlist *evlist) 1239u64 __perf_evlist__combined_sample_type(struct perf_evlist *evlist)
1240{ 1240{
1241 struct perf_evsel *evsel; 1241 struct evsel *evsel;
1242 1242
1243 if (evlist->combined_sample_type) 1243 if (evlist->combined_sample_type)
1244 return evlist->combined_sample_type; 1244 return evlist->combined_sample_type;
@@ -1257,7 +1257,7 @@ u64 perf_evlist__combined_sample_type(struct perf_evlist *evlist)
1257 1257
1258u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist) 1258u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist)
1259{ 1259{
1260 struct perf_evsel *evsel; 1260 struct evsel *evsel;
1261 u64 branch_type = 0; 1261 u64 branch_type = 0;
1262 1262
1263 evlist__for_each_entry(evlist, evsel) 1263 evlist__for_each_entry(evlist, evsel)
@@ -1267,7 +1267,7 @@ u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist)
1267 1267
1268bool perf_evlist__valid_read_format(struct perf_evlist *evlist) 1268bool perf_evlist__valid_read_format(struct perf_evlist *evlist)
1269{ 1269{
1270 struct perf_evsel *first = perf_evlist__first(evlist), *pos = first; 1270 struct evsel *first = perf_evlist__first(evlist), *pos = first;
1271 u64 read_format = first->attr.read_format; 1271 u64 read_format = first->attr.read_format;
1272 u64 sample_type = first->attr.sample_type; 1272 u64 sample_type = first->attr.sample_type;
1273 1273
@@ -1287,13 +1287,13 @@ bool perf_evlist__valid_read_format(struct perf_evlist *evlist)
1287 1287
1288u64 perf_evlist__read_format(struct perf_evlist *evlist) 1288u64 perf_evlist__read_format(struct perf_evlist *evlist)
1289{ 1289{
1290 struct perf_evsel *first = perf_evlist__first(evlist); 1290 struct evsel *first = perf_evlist__first(evlist);
1291 return first->attr.read_format; 1291 return first->attr.read_format;
1292} 1292}
1293 1293
1294u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist) 1294u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist)
1295{ 1295{
1296 struct perf_evsel *first = perf_evlist__first(evlist); 1296 struct evsel *first = perf_evlist__first(evlist);
1297 struct perf_sample *data; 1297 struct perf_sample *data;
1298 u64 sample_type; 1298 u64 sample_type;
1299 u16 size = 0; 1299 u16 size = 0;
@@ -1326,7 +1326,7 @@ out:
1326 1326
1327bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist) 1327bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist)
1328{ 1328{
1329 struct perf_evsel *first = perf_evlist__first(evlist), *pos = first; 1329 struct evsel *first = perf_evlist__first(evlist), *pos = first;
1330 1330
1331 evlist__for_each_entry_continue(evlist, pos) { 1331 evlist__for_each_entry_continue(evlist, pos) {
1332 if (first->attr.sample_id_all != pos->attr.sample_id_all) 1332 if (first->attr.sample_id_all != pos->attr.sample_id_all)
@@ -1338,19 +1338,19 @@ bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist)
1338 1338
1339bool perf_evlist__sample_id_all(struct perf_evlist *evlist) 1339bool perf_evlist__sample_id_all(struct perf_evlist *evlist)
1340{ 1340{
1341 struct perf_evsel *first = perf_evlist__first(evlist); 1341 struct evsel *first = perf_evlist__first(evlist);
1342 return first->attr.sample_id_all; 1342 return first->attr.sample_id_all;
1343} 1343}
1344 1344
1345void perf_evlist__set_selected(struct perf_evlist *evlist, 1345void perf_evlist__set_selected(struct perf_evlist *evlist,
1346 struct perf_evsel *evsel) 1346 struct evsel *evsel)
1347{ 1347{
1348 evlist->selected = evsel; 1348 evlist->selected = evsel;
1349} 1349}
1350 1350
1351void perf_evlist__close(struct perf_evlist *evlist) 1351void perf_evlist__close(struct perf_evlist *evlist)
1352{ 1352{
1353 struct perf_evsel *evsel; 1353 struct evsel *evsel;
1354 1354
1355 evlist__for_each_entry_reverse(evlist, evsel) 1355 evlist__for_each_entry_reverse(evlist, evsel)
1356 perf_evsel__close(evsel); 1356 perf_evsel__close(evsel);
@@ -1389,7 +1389,7 @@ out_put:
1389 1389
1390int perf_evlist__open(struct perf_evlist *evlist) 1390int perf_evlist__open(struct perf_evlist *evlist)
1391{ 1391{
1392 struct perf_evsel *evsel; 1392 struct evsel *evsel;
1393 int err; 1393 int err;
1394 1394
1395 /* 1395 /*
@@ -1553,7 +1553,7 @@ int perf_evlist__start_workload(struct perf_evlist *evlist)
1553int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event, 1553int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event,
1554 struct perf_sample *sample) 1554 struct perf_sample *sample)
1555{ 1555{
1556 struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event); 1556 struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
1557 1557
1558 if (!evsel) 1558 if (!evsel)
1559 return -EFAULT; 1559 return -EFAULT;
@@ -1564,7 +1564,7 @@ int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
1564 union perf_event *event, 1564 union perf_event *event,
1565 u64 *timestamp) 1565 u64 *timestamp)
1566{ 1566{
1567 struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event); 1567 struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
1568 1568
1569 if (!evsel) 1569 if (!evsel)
1570 return -EFAULT; 1570 return -EFAULT;
@@ -1573,7 +1573,7 @@ int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
1573 1573
1574size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp) 1574size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp)
1575{ 1575{
1576 struct perf_evsel *evsel; 1576 struct evsel *evsel;
1577 size_t printed = 0; 1577 size_t printed = 0;
1578 1578
1579 evlist__for_each_entry(evlist, evsel) { 1579 evlist__for_each_entry(evlist, evsel) {
@@ -1613,7 +1613,7 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist,
1613 "Hint:\tThe current value is %d.", value); 1613 "Hint:\tThe current value is %d.", value);
1614 break; 1614 break;
1615 case EINVAL: { 1615 case EINVAL: {
1616 struct perf_evsel *first = perf_evlist__first(evlist); 1616 struct evsel *first = perf_evlist__first(evlist);
1617 int max_freq; 1617 int max_freq;
1618 1618
1619 if (sysctl__read_int("kernel/perf_event_max_sample_rate", &max_freq) < 0) 1619 if (sysctl__read_int("kernel/perf_event_max_sample_rate", &max_freq) < 0)
@@ -1670,9 +1670,9 @@ int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, s
1670} 1670}
1671 1671
1672void perf_evlist__to_front(struct perf_evlist *evlist, 1672void perf_evlist__to_front(struct perf_evlist *evlist,
1673 struct perf_evsel *move_evsel) 1673 struct evsel *move_evsel)
1674{ 1674{
1675 struct perf_evsel *evsel, *n; 1675 struct evsel *evsel, *n;
1676 LIST_HEAD(move); 1676 LIST_HEAD(move);
1677 1677
1678 if (move_evsel == perf_evlist__first(evlist)) 1678 if (move_evsel == perf_evlist__first(evlist))
@@ -1687,9 +1687,9 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
1687} 1687}
1688 1688
1689void perf_evlist__set_tracking_event(struct perf_evlist *evlist, 1689void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
1690 struct perf_evsel *tracking_evsel) 1690 struct evsel *tracking_evsel)
1691{ 1691{
1692 struct perf_evsel *evsel; 1692 struct evsel *evsel;
1693 1693
1694 if (tracking_evsel->tracking) 1694 if (tracking_evsel->tracking)
1695 return; 1695 return;
@@ -1702,11 +1702,11 @@ void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
1702 tracking_evsel->tracking = true; 1702 tracking_evsel->tracking = true;
1703} 1703}
1704 1704
1705struct perf_evsel * 1705struct evsel *
1706perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, 1706perf_evlist__find_evsel_by_str(struct perf_evlist *evlist,
1707 const char *str) 1707 const char *str)
1708{ 1708{
1709 struct perf_evsel *evsel; 1709 struct evsel *evsel;
1710 1710
1711 evlist__for_each_entry(evlist, evsel) { 1711 evlist__for_each_entry(evlist, evsel) {
1712 if (!evsel->name) 1712 if (!evsel->name)
@@ -1778,7 +1778,7 @@ state_err:
1778 1778
1779bool perf_evlist__exclude_kernel(struct perf_evlist *evlist) 1779bool perf_evlist__exclude_kernel(struct perf_evlist *evlist)
1780{ 1780{
1781 struct perf_evsel *evsel; 1781 struct evsel *evsel;
1782 1782
1783 evlist__for_each_entry(evlist, evsel) { 1783 evlist__for_each_entry(evlist, evsel) {
1784 if (!evsel->attr.exclude_kernel) 1784 if (!evsel->attr.exclude_kernel)
@@ -1796,17 +1796,17 @@ bool perf_evlist__exclude_kernel(struct perf_evlist *evlist)
1796void perf_evlist__force_leader(struct perf_evlist *evlist) 1796void perf_evlist__force_leader(struct perf_evlist *evlist)
1797{ 1797{
1798 if (!evlist->nr_groups) { 1798 if (!evlist->nr_groups) {
1799 struct perf_evsel *leader = perf_evlist__first(evlist); 1799 struct evsel *leader = perf_evlist__first(evlist);
1800 1800
1801 perf_evlist__set_leader(evlist); 1801 perf_evlist__set_leader(evlist);
1802 leader->forced_leader = true; 1802 leader->forced_leader = true;
1803 } 1803 }
1804} 1804}
1805 1805
1806struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evsel_list, 1806struct evsel *perf_evlist__reset_weak_group(struct perf_evlist *evsel_list,
1807 struct perf_evsel *evsel) 1807 struct evsel *evsel)
1808{ 1808{
1809 struct perf_evsel *c2, *leader; 1809 struct evsel *c2, *leader;
1810 bool is_open = true; 1810 bool is_open = true;
1811 1811
1812 leader = evsel->leader; 1812 leader = evsel->leader;
@@ -1835,7 +1835,7 @@ int perf_evlist__add_sb_event(struct perf_evlist **evlist,
1835 perf_evsel__sb_cb_t cb, 1835 perf_evsel__sb_cb_t cb,
1836 void *data) 1836 void *data)
1837{ 1837{
1838 struct perf_evsel *evsel; 1838 struct evsel *evsel;
1839 bool new_evlist = (*evlist) == NULL; 1839 bool new_evlist = (*evlist) == NULL;
1840 1840
1841 if (*evlist == NULL) 1841 if (*evlist == NULL)
@@ -1887,7 +1887,7 @@ static void *perf_evlist__poll_thread(void *arg)
1887 if (perf_mmap__read_init(map)) 1887 if (perf_mmap__read_init(map))
1888 continue; 1888 continue;
1889 while ((event = perf_mmap__read_event(map)) != NULL) { 1889 while ((event = perf_mmap__read_event(map)) != NULL) {
1890 struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event); 1890 struct evsel *evsel = perf_evlist__event2evsel(evlist, event);
1891 1891
1892 if (evsel && evsel->side_band.cb) 1892 if (evsel && evsel->side_band.cb)
1893 evsel->side_band.cb(event, evsel->side_band.data); 1893 evsel->side_band.cb(event, evsel->side_band.data);
@@ -1909,7 +1909,7 @@ static void *perf_evlist__poll_thread(void *arg)
1909int perf_evlist__start_sb_thread(struct perf_evlist *evlist, 1909int perf_evlist__start_sb_thread(struct perf_evlist *evlist,
1910 struct target *target) 1910 struct target *target)
1911{ 1911{
1912 struct perf_evsel *counter; 1912 struct evsel *counter;
1913 1913
1914 if (!evlist) 1914 if (!evlist)
1915 return 0; 1915 return 0;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index ab2f0b6c7640..576d59a0d8cf 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -46,7 +46,7 @@ struct perf_evlist {
46 struct perf_mmap *overwrite_mmap; 46 struct perf_mmap *overwrite_mmap;
47 struct perf_thread_map *threads; 47 struct perf_thread_map *threads;
48 struct perf_cpu_map *cpus; 48 struct perf_cpu_map *cpus;
49 struct perf_evsel *selected; 49 struct evsel *selected;
50 struct events_stats stats; 50 struct events_stats stats;
51 struct perf_env *env; 51 struct perf_env *env;
52 void (*trace_event_sample_raw)(struct perf_evlist *evlist, 52 void (*trace_event_sample_raw)(struct perf_evlist *evlist,
@@ -60,7 +60,7 @@ struct perf_evlist {
60 } thread; 60 } thread;
61}; 61};
62 62
63struct perf_evsel_str_handler { 63struct evsel_str_handler {
64 const char *name; 64 const char *name;
65 void *handler; 65 void *handler;
66}; 66};
@@ -73,8 +73,8 @@ void perf_evlist__init(struct perf_evlist *evlist, struct perf_cpu_map *cpus,
73void perf_evlist__exit(struct perf_evlist *evlist); 73void perf_evlist__exit(struct perf_evlist *evlist);
74void perf_evlist__delete(struct perf_evlist *evlist); 74void perf_evlist__delete(struct perf_evlist *evlist);
75 75
76void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); 76void perf_evlist__add(struct perf_evlist *evlist, struct evsel *entry);
77void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel); 77void perf_evlist__remove(struct perf_evlist *evlist, struct evsel *evsel);
78 78
79int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise); 79int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise);
80 80
@@ -117,17 +117,17 @@ int perf_evlist__set_tp_filter(struct perf_evlist *evlist, const char *filter);
117int perf_evlist__set_tp_filter_pid(struct perf_evlist *evlist, pid_t pid); 117int perf_evlist__set_tp_filter_pid(struct perf_evlist *evlist, pid_t pid);
118int perf_evlist__set_tp_filter_pids(struct perf_evlist *evlist, size_t npids, pid_t *pids); 118int perf_evlist__set_tp_filter_pids(struct perf_evlist *evlist, size_t npids, pid_t *pids);
119 119
120struct perf_evsel * 120struct evsel *
121perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id); 121perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id);
122 122
123struct perf_evsel * 123struct evsel *
124perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, 124perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist,
125 const char *name); 125 const char *name);
126 126
127void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, 127void perf_evlist__id_add(struct perf_evlist *evlist, struct evsel *evsel,
128 int cpu, int thread, u64 id); 128 int cpu, int thread, u64 id);
129int perf_evlist__id_add_fd(struct perf_evlist *evlist, 129int perf_evlist__id_add_fd(struct perf_evlist *evlist,
130 struct perf_evsel *evsel, 130 struct evsel *evsel,
131 int cpu, int thread, int fd); 131 int cpu, int thread, int fd);
132 132
133int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd); 133int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
@@ -136,8 +136,8 @@ int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mas
136 136
137int perf_evlist__poll(struct perf_evlist *evlist, int timeout); 137int perf_evlist__poll(struct perf_evlist *evlist, int timeout);
138 138
139struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); 139struct evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
140struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist, 140struct evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
141 u64 id); 141 u64 id);
142 142
143struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); 143struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
@@ -189,15 +189,15 @@ void perf_evlist__enable(struct perf_evlist *evlist);
189void perf_evlist__toggle_enable(struct perf_evlist *evlist); 189void perf_evlist__toggle_enable(struct perf_evlist *evlist);
190 190
191int perf_evlist__enable_event_idx(struct perf_evlist *evlist, 191int perf_evlist__enable_event_idx(struct perf_evlist *evlist,
192 struct perf_evsel *evsel, int idx); 192 struct evsel *evsel, int idx);
193 193
194void perf_evlist__set_selected(struct perf_evlist *evlist, 194void perf_evlist__set_selected(struct perf_evlist *evlist,
195 struct perf_evsel *evsel); 195 struct evsel *evsel);
196 196
197void perf_evlist__set_maps(struct perf_evlist *evlist, struct perf_cpu_map *cpus, 197void perf_evlist__set_maps(struct perf_evlist *evlist, struct perf_cpu_map *cpus,
198 struct perf_thread_map *threads); 198 struct perf_thread_map *threads);
199int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); 199int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target);
200int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); 200int perf_evlist__apply_filters(struct perf_evlist *evlist, struct evsel **err_evsel);
201 201
202void __perf_evlist__set_leader(struct list_head *list); 202void __perf_evlist__set_leader(struct list_head *list);
203void perf_evlist__set_leader(struct perf_evlist *evlist); 203void perf_evlist__set_leader(struct perf_evlist *evlist);
@@ -228,14 +228,14 @@ static inline bool perf_evlist__empty(struct perf_evlist *evlist)
228 return list_empty(&evlist->entries); 228 return list_empty(&evlist->entries);
229} 229}
230 230
231static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) 231static inline struct evsel *perf_evlist__first(struct perf_evlist *evlist)
232{ 232{
233 return list_entry(evlist->entries.next, struct perf_evsel, node); 233 return list_entry(evlist->entries.next, struct evsel, node);
234} 234}
235 235
236static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) 236static inline struct evsel *perf_evlist__last(struct perf_evlist *evlist)
237{ 237{
238 return list_entry(evlist->entries.prev, struct perf_evsel, node); 238 return list_entry(evlist->entries.prev, struct evsel, node);
239} 239}
240 240
241size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp); 241size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp);
@@ -245,7 +245,7 @@ int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, s
245 245
246bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str); 246bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str);
247void perf_evlist__to_front(struct perf_evlist *evlist, 247void perf_evlist__to_front(struct perf_evlist *evlist,
248 struct perf_evsel *move_evsel); 248 struct evsel *move_evsel);
249 249
250/** 250/**
251 * __evlist__for_each_entry - iterate thru all the evsels 251 * __evlist__for_each_entry - iterate thru all the evsels
@@ -314,18 +314,18 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
314 __evlist__for_each_entry_safe(&(evlist)->entries, tmp, evsel) 314 __evlist__for_each_entry_safe(&(evlist)->entries, tmp, evsel)
315 315
316void perf_evlist__set_tracking_event(struct perf_evlist *evlist, 316void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
317 struct perf_evsel *tracking_evsel); 317 struct evsel *tracking_evsel);
318 318
319struct perf_evsel * 319struct evsel *
320perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, const char *str); 320perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, const char *str);
321 321
322struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist, 322struct evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
323 union perf_event *event); 323 union perf_event *event);
324 324
325bool perf_evlist__exclude_kernel(struct perf_evlist *evlist); 325bool perf_evlist__exclude_kernel(struct perf_evlist *evlist);
326 326
327void perf_evlist__force_leader(struct perf_evlist *evlist); 327void perf_evlist__force_leader(struct perf_evlist *evlist);
328 328
329struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evlist, 329struct evsel *perf_evlist__reset_weak_group(struct perf_evlist *evlist,
330 struct perf_evsel *evsel); 330 struct evsel *evsel);
331#endif /* __PERF_EVLIST_H */ 331#endif /* __PERF_EVLIST_H */
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ab66d65b7968..44421bbebd64 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -45,30 +45,30 @@ struct perf_missing_features perf_missing_features;
45 45
46static clockid_t clockid; 46static clockid_t clockid;
47 47
48static int perf_evsel__no_extra_init(struct perf_evsel *evsel __maybe_unused) 48static int perf_evsel__no_extra_init(struct evsel *evsel __maybe_unused)
49{ 49{
50 return 0; 50 return 0;
51} 51}
52 52
53void __weak test_attr__ready(void) { } 53void __weak test_attr__ready(void) { }
54 54
55static void perf_evsel__no_extra_fini(struct perf_evsel *evsel __maybe_unused) 55static void perf_evsel__no_extra_fini(struct evsel *evsel __maybe_unused)
56{ 56{
57} 57}
58 58
59static struct { 59static struct {
60 size_t size; 60 size_t size;
61 int (*init)(struct perf_evsel *evsel); 61 int (*init)(struct evsel *evsel);
62 void (*fini)(struct perf_evsel *evsel); 62 void (*fini)(struct evsel *evsel);
63} perf_evsel__object = { 63} perf_evsel__object = {
64 .size = sizeof(struct perf_evsel), 64 .size = sizeof(struct evsel),
65 .init = perf_evsel__no_extra_init, 65 .init = perf_evsel__no_extra_init,
66 .fini = perf_evsel__no_extra_fini, 66 .fini = perf_evsel__no_extra_fini,
67}; 67};
68 68
69int perf_evsel__object_config(size_t object_size, 69int perf_evsel__object_config(size_t object_size,
70 int (*init)(struct perf_evsel *evsel), 70 int (*init)(struct evsel *evsel),
71 void (*fini)(struct perf_evsel *evsel)) 71 void (*fini)(struct evsel *evsel))
72{ 72{
73 73
74 if (object_size == 0) 74 if (object_size == 0)
@@ -167,13 +167,13 @@ static int __perf_evsel__calc_is_pos(u64 sample_type)
167 return idx; 167 return idx;
168} 168}
169 169
170void perf_evsel__calc_id_pos(struct perf_evsel *evsel) 170void perf_evsel__calc_id_pos(struct evsel *evsel)
171{ 171{
172 evsel->id_pos = __perf_evsel__calc_id_pos(evsel->attr.sample_type); 172 evsel->id_pos = __perf_evsel__calc_id_pos(evsel->attr.sample_type);
173 evsel->is_pos = __perf_evsel__calc_is_pos(evsel->attr.sample_type); 173 evsel->is_pos = __perf_evsel__calc_is_pos(evsel->attr.sample_type);
174} 174}
175 175
176void __perf_evsel__set_sample_bit(struct perf_evsel *evsel, 176void __perf_evsel__set_sample_bit(struct evsel *evsel,
177 enum perf_event_sample_format bit) 177 enum perf_event_sample_format bit)
178{ 178{
179 if (!(evsel->attr.sample_type & bit)) { 179 if (!(evsel->attr.sample_type & bit)) {
@@ -183,7 +183,7 @@ void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
183 } 183 }
184} 184}
185 185
186void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel, 186void __perf_evsel__reset_sample_bit(struct evsel *evsel,
187 enum perf_event_sample_format bit) 187 enum perf_event_sample_format bit)
188{ 188{
189 if (evsel->attr.sample_type & bit) { 189 if (evsel->attr.sample_type & bit) {
@@ -193,7 +193,7 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
193 } 193 }
194} 194}
195 195
196void perf_evsel__set_sample_id(struct perf_evsel *evsel, 196void perf_evsel__set_sample_id(struct evsel *evsel,
197 bool can_sample_identifier) 197 bool can_sample_identifier)
198{ 198{
199 if (can_sample_identifier) { 199 if (can_sample_identifier) {
@@ -213,7 +213,7 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel,
213 * 213 *
214 * Return %true if event is function trace event 214 * Return %true if event is function trace event
215 */ 215 */
216bool perf_evsel__is_function_event(struct perf_evsel *evsel) 216bool perf_evsel__is_function_event(struct evsel *evsel)
217{ 217{
218#define FUNCTION_EVENT "ftrace:function" 218#define FUNCTION_EVENT "ftrace:function"
219 219
@@ -223,7 +223,7 @@ bool perf_evsel__is_function_event(struct perf_evsel *evsel)
223#undef FUNCTION_EVENT 223#undef FUNCTION_EVENT
224} 224}
225 225
226void perf_evsel__init(struct perf_evsel *evsel, 226void perf_evsel__init(struct evsel *evsel,
227 struct perf_event_attr *attr, int idx) 227 struct perf_event_attr *attr, int idx)
228{ 228{
229 evsel->idx = idx; 229 evsel->idx = idx;
@@ -249,9 +249,9 @@ void perf_evsel__init(struct perf_evsel *evsel,
249 evsel->pmu_name = NULL; 249 evsel->pmu_name = NULL;
250} 250}
251 251
252struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) 252struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
253{ 253{
254 struct perf_evsel *evsel = zalloc(perf_evsel__object.size); 254 struct evsel *evsel = zalloc(perf_evsel__object.size);
255 255
256 if (!evsel) 256 if (!evsel)
257 return NULL; 257 return NULL;
@@ -282,14 +282,14 @@ static bool perf_event_can_profile_kernel(void)
282 return geteuid() == 0 || perf_event_paranoid() == -1; 282 return geteuid() == 0 || perf_event_paranoid() == -1;
283} 283}
284 284
285struct perf_evsel *perf_evsel__new_cycles(bool precise) 285struct evsel *perf_evsel__new_cycles(bool precise)
286{ 286{
287 struct perf_event_attr attr = { 287 struct perf_event_attr attr = {
288 .type = PERF_TYPE_HARDWARE, 288 .type = PERF_TYPE_HARDWARE,
289 .config = PERF_COUNT_HW_CPU_CYCLES, 289 .config = PERF_COUNT_HW_CPU_CYCLES,
290 .exclude_kernel = !perf_event_can_profile_kernel(), 290 .exclude_kernel = !perf_event_can_profile_kernel(),
291 }; 291 };
292 struct perf_evsel *evsel; 292 struct evsel *evsel;
293 293
294 event_attr_init(&attr); 294 event_attr_init(&attr);
295 295
@@ -324,9 +324,9 @@ error_free:
324/* 324/*
325 * Returns pointer with encoded error via <linux/err.h> interface. 325 * Returns pointer with encoded error via <linux/err.h> interface.
326 */ 326 */
327struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx) 327struct evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx)
328{ 328{
329 struct perf_evsel *evsel = zalloc(perf_evsel__object.size); 329 struct evsel *evsel = zalloc(perf_evsel__object.size);
330 int err = -ENOMEM; 330 int err = -ENOMEM;
331 331
332 if (evsel == NULL) { 332 if (evsel == NULL) {
@@ -383,7 +383,7 @@ static const char *__perf_evsel__hw_name(u64 config)
383 return "unknown-hardware"; 383 return "unknown-hardware";
384} 384}
385 385
386static int perf_evsel__add_modifiers(struct perf_evsel *evsel, char *bf, size_t size) 386static int perf_evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size)
387{ 387{
388 int colon = 0, r = 0; 388 int colon = 0, r = 0;
389 struct perf_event_attr *attr = &evsel->attr; 389 struct perf_event_attr *attr = &evsel->attr;
@@ -419,7 +419,7 @@ static int perf_evsel__add_modifiers(struct perf_evsel *evsel, char *bf, size_t
419 return r; 419 return r;
420} 420}
421 421
422static int perf_evsel__hw_name(struct perf_evsel *evsel, char *bf, size_t size) 422static int perf_evsel__hw_name(struct evsel *evsel, char *bf, size_t size)
423{ 423{
424 int r = scnprintf(bf, size, "%s", __perf_evsel__hw_name(evsel->attr.config)); 424 int r = scnprintf(bf, size, "%s", __perf_evsel__hw_name(evsel->attr.config));
425 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); 425 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
@@ -445,7 +445,7 @@ static const char *__perf_evsel__sw_name(u64 config)
445 return "unknown-software"; 445 return "unknown-software";
446} 446}
447 447
448static int perf_evsel__sw_name(struct perf_evsel *evsel, char *bf, size_t size) 448static int perf_evsel__sw_name(struct evsel *evsel, char *bf, size_t size)
449{ 449{
450 int r = scnprintf(bf, size, "%s", __perf_evsel__sw_name(evsel->attr.config)); 450 int r = scnprintf(bf, size, "%s", __perf_evsel__sw_name(evsel->attr.config));
451 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r); 451 return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
@@ -469,7 +469,7 @@ static int __perf_evsel__bp_name(char *bf, size_t size, u64 addr, u64 type)
469 return r; 469 return r;
470} 470}
471 471
472static int perf_evsel__bp_name(struct perf_evsel *evsel, char *bf, size_t size) 472static int perf_evsel__bp_name(struct evsel *evsel, char *bf, size_t size)
473{ 473{
474 struct perf_event_attr *attr = &evsel->attr; 474 struct perf_event_attr *attr = &evsel->attr;
475 int r = __perf_evsel__bp_name(bf, size, attr->bp_addr, attr->bp_type); 475 int r = __perf_evsel__bp_name(bf, size, attr->bp_addr, attr->bp_type);
@@ -569,13 +569,13 @@ out_err:
569 return scnprintf(bf, size, "%s", err); 569 return scnprintf(bf, size, "%s", err);
570} 570}
571 571
572static int perf_evsel__hw_cache_name(struct perf_evsel *evsel, char *bf, size_t size) 572static int perf_evsel__hw_cache_name(struct evsel *evsel, char *bf, size_t size)
573{ 573{
574 int ret = __perf_evsel__hw_cache_name(evsel->attr.config, bf, size); 574 int ret = __perf_evsel__hw_cache_name(evsel->attr.config, bf, size);
575 return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); 575 return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret);
576} 576}
577 577
578static int perf_evsel__raw_name(struct perf_evsel *evsel, char *bf, size_t size) 578static int perf_evsel__raw_name(struct evsel *evsel, char *bf, size_t size)
579{ 579{
580 int ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->attr.config); 580 int ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->attr.config);
581 return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); 581 return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret);
@@ -587,7 +587,7 @@ static int perf_evsel__tool_name(char *bf, size_t size)
587 return ret; 587 return ret;
588} 588}
589 589
590const char *perf_evsel__name(struct perf_evsel *evsel) 590const char *perf_evsel__name(struct evsel *evsel)
591{ 591{
592 char bf[128]; 592 char bf[128];
593 593
@@ -639,7 +639,7 @@ out_unknown:
639 return "unknown"; 639 return "unknown";
640} 640}
641 641
642const char *perf_evsel__group_name(struct perf_evsel *evsel) 642const char *perf_evsel__group_name(struct evsel *evsel)
643{ 643{
644 return evsel->group_name ?: "anon group"; 644 return evsel->group_name ?: "anon group";
645} 645}
@@ -654,10 +654,10 @@ const char *perf_evsel__group_name(struct perf_evsel *evsel)
654 * For record -e 'cycles,instructions' and report --group 654 * For record -e 'cycles,instructions' and report --group
655 * 'cycles:u, instructions:u' 655 * 'cycles:u, instructions:u'
656 */ 656 */
657int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size) 657int perf_evsel__group_desc(struct evsel *evsel, char *buf, size_t size)
658{ 658{
659 int ret = 0; 659 int ret = 0;
660 struct perf_evsel *pos; 660 struct evsel *pos;
661 const char *group_name = perf_evsel__group_name(evsel); 661 const char *group_name = perf_evsel__group_name(evsel);
662 662
663 if (!evsel->forced_leader) 663 if (!evsel->forced_leader)
@@ -676,7 +676,7 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size)
676 return ret; 676 return ret;
677} 677}
678 678
679static void __perf_evsel__config_callchain(struct perf_evsel *evsel, 679static void __perf_evsel__config_callchain(struct evsel *evsel,
680 struct record_opts *opts, 680 struct record_opts *opts,
681 struct callchain_param *param) 681 struct callchain_param *param)
682{ 682{
@@ -735,7 +735,7 @@ static void __perf_evsel__config_callchain(struct perf_evsel *evsel,
735 } 735 }
736} 736}
737 737
738void perf_evsel__config_callchain(struct perf_evsel *evsel, 738void perf_evsel__config_callchain(struct evsel *evsel,
739 struct record_opts *opts, 739 struct record_opts *opts,
740 struct callchain_param *param) 740 struct callchain_param *param)
741{ 741{
@@ -744,7 +744,7 @@ void perf_evsel__config_callchain(struct perf_evsel *evsel,
744} 744}
745 745
746static void 746static void
747perf_evsel__reset_callgraph(struct perf_evsel *evsel, 747perf_evsel__reset_callgraph(struct evsel *evsel,
748 struct callchain_param *param) 748 struct callchain_param *param)
749{ 749{
750 struct perf_event_attr *attr = &evsel->attr; 750 struct perf_event_attr *attr = &evsel->attr;
@@ -761,7 +761,7 @@ perf_evsel__reset_callgraph(struct perf_evsel *evsel,
761 } 761 }
762} 762}
763 763
764static void apply_config_terms(struct perf_evsel *evsel, 764static void apply_config_terms(struct evsel *evsel,
765 struct record_opts *opts, bool track) 765 struct record_opts *opts, bool track)
766{ 766{
767 struct perf_evsel_config_term *term; 767 struct perf_evsel_config_term *term;
@@ -886,7 +886,7 @@ static void apply_config_terms(struct perf_evsel *evsel,
886 } 886 }
887} 887}
888 888
889static bool is_dummy_event(struct perf_evsel *evsel) 889static bool is_dummy_event(struct evsel *evsel)
890{ 890{
891 return (evsel->attr.type == PERF_TYPE_SOFTWARE) && 891 return (evsel->attr.type == PERF_TYPE_SOFTWARE) &&
892 (evsel->attr.config == PERF_COUNT_SW_DUMMY); 892 (evsel->attr.config == PERF_COUNT_SW_DUMMY);
@@ -920,10 +920,10 @@ static bool is_dummy_event(struct perf_evsel *evsel)
920 * enable/disable events specifically, as there's no 920 * enable/disable events specifically, as there's no
921 * initial traced exec call. 921 * initial traced exec call.
922 */ 922 */
923void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, 923void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
924 struct callchain_param *callchain) 924 struct callchain_param *callchain)
925{ 925{
926 struct perf_evsel *leader = evsel->leader; 926 struct evsel *leader = evsel->leader;
927 struct perf_event_attr *attr = &evsel->attr; 927 struct perf_event_attr *attr = &evsel->attr;
928 int track = evsel->tracking; 928 int track = evsel->tracking;
929 bool per_cpu = opts->target.default_per_cpu && !opts->target.per_thread; 929 bool per_cpu = opts->target.default_per_cpu && !opts->target.per_thread;
@@ -1153,7 +1153,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
1153 perf_evsel__reset_sample_bit(evsel, BRANCH_STACK); 1153 perf_evsel__reset_sample_bit(evsel, BRANCH_STACK);
1154} 1154}
1155 1155
1156static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) 1156static int perf_evsel__alloc_fd(struct evsel *evsel, int ncpus, int nthreads)
1157{ 1157{
1158 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int)); 1158 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int));
1159 1159
@@ -1169,7 +1169,7 @@ static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthread
1169 return evsel->fd != NULL ? 0 : -ENOMEM; 1169 return evsel->fd != NULL ? 0 : -ENOMEM;
1170} 1170}
1171 1171
1172static int perf_evsel__run_ioctl(struct perf_evsel *evsel, 1172static int perf_evsel__run_ioctl(struct evsel *evsel,
1173 int ioc, void *arg) 1173 int ioc, void *arg)
1174{ 1174{
1175 int cpu, thread; 1175 int cpu, thread;
@@ -1187,14 +1187,14 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel,
1187 return 0; 1187 return 0;
1188} 1188}
1189 1189
1190int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter) 1190int perf_evsel__apply_filter(struct evsel *evsel, const char *filter)
1191{ 1191{
1192 return perf_evsel__run_ioctl(evsel, 1192 return perf_evsel__run_ioctl(evsel,
1193 PERF_EVENT_IOC_SET_FILTER, 1193 PERF_EVENT_IOC_SET_FILTER,
1194 (void *)filter); 1194 (void *)filter);
1195} 1195}
1196 1196
1197int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter) 1197int perf_evsel__set_filter(struct evsel *evsel, const char *filter)
1198{ 1198{
1199 char *new_filter = strdup(filter); 1199 char *new_filter = strdup(filter);
1200 1200
@@ -1207,7 +1207,7 @@ int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter)
1207 return -1; 1207 return -1;
1208} 1208}
1209 1209
1210static int perf_evsel__append_filter(struct perf_evsel *evsel, 1210static int perf_evsel__append_filter(struct evsel *evsel,
1211 const char *fmt, const char *filter) 1211 const char *fmt, const char *filter)
1212{ 1212{
1213 char *new_filter; 1213 char *new_filter;
@@ -1224,17 +1224,17 @@ static int perf_evsel__append_filter(struct perf_evsel *evsel,
1224 return -1; 1224 return -1;
1225} 1225}
1226 1226
1227int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter) 1227int perf_evsel__append_tp_filter(struct evsel *evsel, const char *filter)
1228{ 1228{
1229 return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter); 1229 return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter);
1230} 1230}
1231 1231
1232int perf_evsel__append_addr_filter(struct perf_evsel *evsel, const char *filter) 1232int perf_evsel__append_addr_filter(struct evsel *evsel, const char *filter)
1233{ 1233{
1234 return perf_evsel__append_filter(evsel, "%s,%s", filter); 1234 return perf_evsel__append_filter(evsel, "%s,%s", filter);
1235} 1235}
1236 1236
1237int perf_evsel__enable(struct perf_evsel *evsel) 1237int perf_evsel__enable(struct evsel *evsel)
1238{ 1238{
1239 int err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0); 1239 int err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0);
1240 1240
@@ -1244,7 +1244,7 @@ int perf_evsel__enable(struct perf_evsel *evsel)
1244 return err; 1244 return err;
1245} 1245}
1246 1246
1247int perf_evsel__disable(struct perf_evsel *evsel) 1247int perf_evsel__disable(struct evsel *evsel)
1248{ 1248{
1249 int err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0); 1249 int err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0);
1250 /* 1250 /*
@@ -1259,7 +1259,7 @@ int perf_evsel__disable(struct perf_evsel *evsel)
1259 return err; 1259 return err;
1260} 1260}
1261 1261
1262int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) 1262int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads)
1263{ 1263{
1264 if (ncpus == 0 || nthreads == 0) 1264 if (ncpus == 0 || nthreads == 0)
1265 return 0; 1265 return 0;
@@ -1281,13 +1281,13 @@ int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads)
1281 return 0; 1281 return 0;
1282} 1282}
1283 1283
1284static void perf_evsel__free_fd(struct perf_evsel *evsel) 1284static void perf_evsel__free_fd(struct evsel *evsel)
1285{ 1285{
1286 xyarray__delete(evsel->fd); 1286 xyarray__delete(evsel->fd);
1287 evsel->fd = NULL; 1287 evsel->fd = NULL;
1288} 1288}
1289 1289
1290static void perf_evsel__free_id(struct perf_evsel *evsel) 1290static void perf_evsel__free_id(struct evsel *evsel)
1291{ 1291{
1292 xyarray__delete(evsel->sample_id); 1292 xyarray__delete(evsel->sample_id);
1293 evsel->sample_id = NULL; 1293 evsel->sample_id = NULL;
@@ -1295,7 +1295,7 @@ static void perf_evsel__free_id(struct perf_evsel *evsel)
1295 evsel->ids = 0; 1295 evsel->ids = 0;
1296} 1296}
1297 1297
1298static void perf_evsel__free_config_terms(struct perf_evsel *evsel) 1298static void perf_evsel__free_config_terms(struct evsel *evsel)
1299{ 1299{
1300 struct perf_evsel_config_term *term, *h; 1300 struct perf_evsel_config_term *term, *h;
1301 1301
@@ -1305,7 +1305,7 @@ static void perf_evsel__free_config_terms(struct perf_evsel *evsel)
1305 } 1305 }
1306} 1306}
1307 1307
1308void perf_evsel__close_fd(struct perf_evsel *evsel) 1308void perf_evsel__close_fd(struct evsel *evsel)
1309{ 1309{
1310 int cpu, thread; 1310 int cpu, thread;
1311 1311
@@ -1316,7 +1316,7 @@ void perf_evsel__close_fd(struct perf_evsel *evsel)
1316 } 1316 }
1317} 1317}
1318 1318
1319void perf_evsel__exit(struct perf_evsel *evsel) 1319void perf_evsel__exit(struct evsel *evsel)
1320{ 1320{
1321 assert(list_empty(&evsel->node)); 1321 assert(list_empty(&evsel->node));
1322 assert(evsel->evlist == NULL); 1322 assert(evsel->evlist == NULL);
@@ -1333,13 +1333,13 @@ void perf_evsel__exit(struct perf_evsel *evsel)
1333 perf_evsel__object.fini(evsel); 1333 perf_evsel__object.fini(evsel);
1334} 1334}
1335 1335
1336void perf_evsel__delete(struct perf_evsel *evsel) 1336void perf_evsel__delete(struct evsel *evsel)
1337{ 1337{
1338 perf_evsel__exit(evsel); 1338 perf_evsel__exit(evsel);
1339 free(evsel); 1339 free(evsel);
1340} 1340}
1341 1341
1342void perf_evsel__compute_deltas(struct perf_evsel *evsel, int cpu, int thread, 1342void perf_evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
1343 struct perf_counts_values *count) 1343 struct perf_counts_values *count)
1344{ 1344{
1345 struct perf_counts_values tmp; 1345 struct perf_counts_values tmp;
@@ -1379,7 +1379,7 @@ void perf_counts_values__scale(struct perf_counts_values *count,
1379 *pscaled = scaled; 1379 *pscaled = scaled;
1380} 1380}
1381 1381
1382static int perf_evsel__read_size(struct perf_evsel *evsel) 1382static int perf_evsel__read_size(struct evsel *evsel)
1383{ 1383{
1384 u64 read_format = evsel->attr.read_format; 1384 u64 read_format = evsel->attr.read_format;
1385 int entry = sizeof(u64); /* value */ 1385 int entry = sizeof(u64); /* value */
@@ -1404,7 +1404,7 @@ static int perf_evsel__read_size(struct perf_evsel *evsel)
1404 return size; 1404 return size;
1405} 1405}
1406 1406
1407int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, 1407int perf_evsel__read(struct evsel *evsel, int cpu, int thread,
1408 struct perf_counts_values *count) 1408 struct perf_counts_values *count)
1409{ 1409{
1410 size_t size = perf_evsel__read_size(evsel); 1410 size_t size = perf_evsel__read_size(evsel);
@@ -1421,7 +1421,7 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
1421} 1421}
1422 1422
1423static int 1423static int
1424perf_evsel__read_one(struct perf_evsel *evsel, int cpu, int thread) 1424perf_evsel__read_one(struct evsel *evsel, int cpu, int thread)
1425{ 1425{
1426 struct perf_counts_values *count = perf_counts(evsel->counts, cpu, thread); 1426 struct perf_counts_values *count = perf_counts(evsel->counts, cpu, thread);
1427 1427
@@ -1429,7 +1429,7 @@ perf_evsel__read_one(struct perf_evsel *evsel, int cpu, int thread)
1429} 1429}
1430 1430
1431static void 1431static void
1432perf_evsel__set_count(struct perf_evsel *counter, int cpu, int thread, 1432perf_evsel__set_count(struct evsel *counter, int cpu, int thread,
1433 u64 val, u64 ena, u64 run) 1433 u64 val, u64 ena, u64 run)
1434{ 1434{
1435 struct perf_counts_values *count; 1435 struct perf_counts_values *count;
@@ -1444,7 +1444,7 @@ perf_evsel__set_count(struct perf_evsel *counter, int cpu, int thread,
1444} 1444}
1445 1445
1446static int 1446static int
1447perf_evsel__process_group_data(struct perf_evsel *leader, 1447perf_evsel__process_group_data(struct evsel *leader,
1448 int cpu, int thread, u64 *data) 1448 int cpu, int thread, u64 *data)
1449{ 1449{
1450 u64 read_format = leader->attr.read_format; 1450 u64 read_format = leader->attr.read_format;
@@ -1468,7 +1468,7 @@ perf_evsel__process_group_data(struct perf_evsel *leader,
1468 v[0].value, ena, run); 1468 v[0].value, ena, run);
1469 1469
1470 for (i = 1; i < nr; i++) { 1470 for (i = 1; i < nr; i++) {
1471 struct perf_evsel *counter; 1471 struct evsel *counter;
1472 1472
1473 counter = perf_evlist__id2evsel(leader->evlist, v[i].id); 1473 counter = perf_evlist__id2evsel(leader->evlist, v[i].id);
1474 if (!counter) 1474 if (!counter)
@@ -1482,7 +1482,7 @@ perf_evsel__process_group_data(struct perf_evsel *leader,
1482} 1482}
1483 1483
1484static int 1484static int
1485perf_evsel__read_group(struct perf_evsel *leader, int cpu, int thread) 1485perf_evsel__read_group(struct evsel *leader, int cpu, int thread)
1486{ 1486{
1487 struct perf_stat_evsel *ps = leader->stats; 1487 struct perf_stat_evsel *ps = leader->stats;
1488 u64 read_format = leader->attr.read_format; 1488 u64 read_format = leader->attr.read_format;
@@ -1512,7 +1512,7 @@ perf_evsel__read_group(struct perf_evsel *leader, int cpu, int thread)
1512 return perf_evsel__process_group_data(leader, cpu, thread, data); 1512 return perf_evsel__process_group_data(leader, cpu, thread, data);
1513} 1513}
1514 1514
1515int perf_evsel__read_counter(struct perf_evsel *evsel, int cpu, int thread) 1515int perf_evsel__read_counter(struct evsel *evsel, int cpu, int thread)
1516{ 1516{
1517 u64 read_format = evsel->attr.read_format; 1517 u64 read_format = evsel->attr.read_format;
1518 1518
@@ -1522,7 +1522,7 @@ int perf_evsel__read_counter(struct perf_evsel *evsel, int cpu, int thread)
1522 return perf_evsel__read_one(evsel, cpu, thread); 1522 return perf_evsel__read_one(evsel, cpu, thread);
1523} 1523}
1524 1524
1525int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, 1525int __perf_evsel__read_on_cpu(struct evsel *evsel,
1526 int cpu, int thread, bool scale) 1526 int cpu, int thread, bool scale)
1527{ 1527{
1528 struct perf_counts_values count; 1528 struct perf_counts_values count;
@@ -1543,9 +1543,9 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
1543 return 0; 1543 return 0;
1544} 1544}
1545 1545
1546static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread) 1546static int get_group_fd(struct evsel *evsel, int cpu, int thread)
1547{ 1547{
1548 struct perf_evsel *leader = evsel->leader; 1548 struct evsel *leader = evsel->leader;
1549 int fd; 1549 int fd;
1550 1550
1551 if (perf_evsel__is_group_leader(evsel)) 1551 if (perf_evsel__is_group_leader(evsel))
@@ -1708,7 +1708,7 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
1708 return fprintf(fp, " %-32s %s\n", name, val); 1708 return fprintf(fp, " %-32s %s\n", name, val);
1709} 1709}
1710 1710
1711static void perf_evsel__remove_fd(struct perf_evsel *pos, 1711static void perf_evsel__remove_fd(struct evsel *pos,
1712 int nr_cpus, int nr_threads, 1712 int nr_cpus, int nr_threads,
1713 int thread_idx) 1713 int thread_idx)
1714{ 1714{
@@ -1717,11 +1717,11 @@ static void perf_evsel__remove_fd(struct perf_evsel *pos,
1717 FD(pos, cpu, thread) = FD(pos, cpu, thread + 1); 1717 FD(pos, cpu, thread) = FD(pos, cpu, thread + 1);
1718} 1718}
1719 1719
1720static int update_fds(struct perf_evsel *evsel, 1720static int update_fds(struct evsel *evsel,
1721 int nr_cpus, int cpu_idx, 1721 int nr_cpus, int cpu_idx,
1722 int nr_threads, int thread_idx) 1722 int nr_threads, int thread_idx)
1723{ 1723{
1724 struct perf_evsel *pos; 1724 struct evsel *pos;
1725 1725
1726 if (cpu_idx >= nr_cpus || thread_idx >= nr_threads) 1726 if (cpu_idx >= nr_cpus || thread_idx >= nr_threads)
1727 return -EINVAL; 1727 return -EINVAL;
@@ -1741,7 +1741,7 @@ static int update_fds(struct perf_evsel *evsel,
1741 return 0; 1741 return 0;
1742} 1742}
1743 1743
1744static bool ignore_missing_thread(struct perf_evsel *evsel, 1744static bool ignore_missing_thread(struct evsel *evsel,
1745 int nr_cpus, int cpu, 1745 int nr_cpus, int cpu,
1746 struct perf_thread_map *threads, 1746 struct perf_thread_map *threads,
1747 int thread, int err) 1747 int thread, int err)
@@ -1788,7 +1788,7 @@ static void display_attr(struct perf_event_attr *attr)
1788 } 1788 }
1789} 1789}
1790 1790
1791static int perf_event_open(struct perf_evsel *evsel, 1791static int perf_event_open(struct evsel *evsel,
1792 pid_t pid, int cpu, int group_fd, 1792 pid_t pid, int cpu, int group_fd,
1793 unsigned long flags) 1793 unsigned long flags)
1794{ 1794{
@@ -1825,7 +1825,7 @@ static int perf_event_open(struct perf_evsel *evsel,
1825 return fd; 1825 return fd;
1826} 1826}
1827 1827
1828int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, 1828int perf_evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
1829 struct perf_thread_map *threads) 1829 struct perf_thread_map *threads)
1830{ 1830{
1831 int cpu, thread, nthreads; 1831 int cpu, thread, nthreads;
@@ -2073,7 +2073,7 @@ out_close:
2073 return err; 2073 return err;
2074} 2074}
2075 2075
2076void perf_evsel__close(struct perf_evsel *evsel) 2076void perf_evsel__close(struct evsel *evsel)
2077{ 2077{
2078 if (evsel->fd == NULL) 2078 if (evsel->fd == NULL)
2079 return; 2079 return;
@@ -2083,19 +2083,19 @@ void perf_evsel__close(struct perf_evsel *evsel)
2083 perf_evsel__free_id(evsel); 2083 perf_evsel__free_id(evsel);
2084} 2084}
2085 2085
2086int perf_evsel__open_per_cpu(struct perf_evsel *evsel, 2086int perf_evsel__open_per_cpu(struct evsel *evsel,
2087 struct perf_cpu_map *cpus) 2087 struct perf_cpu_map *cpus)
2088{ 2088{
2089 return perf_evsel__open(evsel, cpus, NULL); 2089 return perf_evsel__open(evsel, cpus, NULL);
2090} 2090}
2091 2091
2092int perf_evsel__open_per_thread(struct perf_evsel *evsel, 2092int perf_evsel__open_per_thread(struct evsel *evsel,
2093 struct perf_thread_map *threads) 2093 struct perf_thread_map *threads)
2094{ 2094{
2095 return perf_evsel__open(evsel, NULL, threads); 2095 return perf_evsel__open(evsel, NULL, threads);
2096} 2096}
2097 2097
2098static int perf_evsel__parse_id_sample(const struct perf_evsel *evsel, 2098static int perf_evsel__parse_id_sample(const struct evsel *evsel,
2099 const union perf_event *event, 2099 const union perf_event *event,
2100 struct perf_sample *sample) 2100 struct perf_sample *sample)
2101{ 2101{
@@ -2185,7 +2185,7 @@ perf_event__check_size(union perf_event *event, unsigned int sample_size)
2185 return 0; 2185 return 0;
2186} 2186}
2187 2187
2188int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, 2188int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
2189 struct perf_sample *data) 2189 struct perf_sample *data)
2190{ 2190{
2191 u64 type = evsel->attr.sample_type; 2191 u64 type = evsel->attr.sample_type;
@@ -2464,7 +2464,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
2464 return 0; 2464 return 0;
2465} 2465}
2466 2466
2467int perf_evsel__parse_sample_timestamp(struct perf_evsel *evsel, 2467int perf_evsel__parse_sample_timestamp(struct evsel *evsel,
2468 union perf_event *event, 2468 union perf_event *event,
2469 u64 *timestamp) 2469 u64 *timestamp)
2470{ 2470{
@@ -2785,12 +2785,12 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
2785 return 0; 2785 return 0;
2786} 2786}
2787 2787
2788struct tep_format_field *perf_evsel__field(struct perf_evsel *evsel, const char *name) 2788struct tep_format_field *perf_evsel__field(struct evsel *evsel, const char *name)
2789{ 2789{
2790 return tep_find_field(evsel->tp_format, name); 2790 return tep_find_field(evsel->tp_format, name);
2791} 2791}
2792 2792
2793void *perf_evsel__rawptr(struct perf_evsel *evsel, struct perf_sample *sample, 2793void *perf_evsel__rawptr(struct evsel *evsel, struct perf_sample *sample,
2794 const char *name) 2794 const char *name)
2795{ 2795{
2796 struct tep_format_field *field = perf_evsel__field(evsel, name); 2796 struct tep_format_field *field = perf_evsel__field(evsel, name);
@@ -2848,7 +2848,7 @@ u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sam
2848 return 0; 2848 return 0;
2849} 2849}
2850 2850
2851u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample, 2851u64 perf_evsel__intval(struct evsel *evsel, struct perf_sample *sample,
2852 const char *name) 2852 const char *name)
2853{ 2853{
2854 struct tep_format_field *field = perf_evsel__field(evsel, name); 2854 struct tep_format_field *field = perf_evsel__field(evsel, name);
@@ -2859,7 +2859,7 @@ u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample,
2859 return field ? format_field__intval(field, sample, evsel->needs_swap) : 0; 2859 return field ? format_field__intval(field, sample, evsel->needs_swap) : 0;
2860} 2860}
2861 2861
2862bool perf_evsel__fallback(struct perf_evsel *evsel, int err, 2862bool perf_evsel__fallback(struct evsel *evsel, int err,
2863 char *msg, size_t msgsize) 2863 char *msg, size_t msgsize)
2864{ 2864{
2865 int paranoid; 2865 int paranoid;
@@ -2946,7 +2946,7 @@ static bool find_process(const char *name)
2946 return ret ? false : true; 2946 return ret ? false : true;
2947} 2947}
2948 2948
2949int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, 2949int perf_evsel__open_strerror(struct evsel *evsel, struct target *target,
2950 int err, char *msg, size_t size) 2950 int err, char *msg, size_t size)
2951{ 2951{
2952 char sbuf[STRERR_BUFSIZE]; 2952 char sbuf[STRERR_BUFSIZE];
@@ -3037,14 +3037,14 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
3037 perf_evsel__name(evsel)); 3037 perf_evsel__name(evsel));
3038} 3038}
3039 3039
3040struct perf_env *perf_evsel__env(struct perf_evsel *evsel) 3040struct perf_env *perf_evsel__env(struct evsel *evsel)
3041{ 3041{
3042 if (evsel && evsel->evlist) 3042 if (evsel && evsel->evlist)
3043 return evsel->evlist->env; 3043 return evsel->evlist->env;
3044 return NULL; 3044 return NULL;
3045} 3045}
3046 3046
3047static int store_evsel_ids(struct perf_evsel *evsel, struct perf_evlist *evlist) 3047static int store_evsel_ids(struct evsel *evsel, struct perf_evlist *evlist)
3048{ 3048{
3049 int cpu, thread; 3049 int cpu, thread;
3050 3050
@@ -3062,7 +3062,7 @@ static int store_evsel_ids(struct perf_evsel *evsel, struct perf_evlist *evlist)
3062 return 0; 3062 return 0;
3063} 3063}
3064 3064
3065int perf_evsel__store_ids(struct perf_evsel *evsel, struct perf_evlist *evlist) 3065int perf_evsel__store_ids(struct evsel *evsel, struct perf_evlist *evlist)
3066{ 3066{
3067 struct perf_cpu_map *cpus = evsel->cpus; 3067 struct perf_cpu_map *cpus = evsel->cpus;
3068 struct perf_thread_map *threads = evsel->threads; 3068 struct perf_thread_map *threads = evsel->threads;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index ba2385f22e28..2c31c5e99524 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -12,7 +12,7 @@
12#include "cpumap.h" 12#include "cpumap.h"
13#include "counts.h" 13#include "counts.h"
14 14
15struct perf_evsel; 15struct evsel;
16 16
17/* 17/*
18 * Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are 18 * Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are
@@ -21,7 +21,7 @@ struct perf_evsel;
21struct perf_sample_id { 21struct perf_sample_id {
22 struct hlist_node node; 22 struct hlist_node node;
23 u64 id; 23 u64 id;
24 struct perf_evsel *evsel; 24 struct evsel *evsel;
25 int idx; 25 int idx;
26 int cpu; 26 int cpu;
27 pid_t tid; 27 pid_t tid;
@@ -84,7 +84,7 @@ enum perf_tool_event {
84 84
85struct bpf_object; 85struct bpf_object;
86 86
87/** struct perf_evsel - event selector 87/** struct evsel - event selector
88 * 88 *
89 * @evlist - evlist this evsel is in, if it is in one. 89 * @evlist - evlist this evsel is in, if it is in one.
90 * @node - To insert it into evlist->entries or in other list_heads, say in 90 * @node - To insert it into evlist->entries or in other list_heads, say in
@@ -100,7 +100,7 @@ struct bpf_object;
100 * is used there is an id sample appended to non-sample events 100 * is used there is an id sample appended to non-sample events
101 * @priv: And what is in its containing unnamed union are tool specific 101 * @priv: And what is in its containing unnamed union are tool specific
102 */ 102 */
103struct perf_evsel { 103struct evsel {
104 struct list_head node; 104 struct list_head node;
105 struct perf_evlist *evlist; 105 struct perf_evlist *evlist;
106 struct perf_event_attr attr; 106 struct perf_event_attr attr;
@@ -150,7 +150,7 @@ struct perf_evsel {
150 int nr_members; 150 int nr_members;
151 int sample_read; 151 int sample_read;
152 unsigned long *per_pkg_mask; 152 unsigned long *per_pkg_mask;
153 struct perf_evsel *leader; 153 struct evsel *leader;
154 char *group_name; 154 char *group_name;
155 bool cmdline_group_boundary; 155 bool cmdline_group_boundary;
156 struct list_head config_terms; 156 struct list_head config_terms;
@@ -160,7 +160,7 @@ struct perf_evsel {
160 bool merged_stat; 160 bool merged_stat;
161 const char * metric_expr; 161 const char * metric_expr;
162 const char * metric_name; 162 const char * metric_name;
163 struct perf_evsel **metric_events; 163 struct evsel **metric_events;
164 bool collect_stat; 164 bool collect_stat;
165 bool weak_group; 165 bool weak_group;
166 bool percore; 166 bool percore;
@@ -197,12 +197,12 @@ struct target;
197struct thread_map; 197struct thread_map;
198struct record_opts; 198struct record_opts;
199 199
200static inline struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel) 200static inline struct perf_cpu_map *perf_evsel__cpus(struct evsel *evsel)
201{ 201{
202 return evsel->cpus; 202 return evsel->cpus;
203} 203}
204 204
205static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel) 205static inline int perf_evsel__nr_cpus(struct evsel *evsel)
206{ 206{
207 return perf_evsel__cpus(evsel)->nr; 207 return perf_evsel__cpus(evsel)->nr;
208} 208}
@@ -210,50 +210,50 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
210void perf_counts_values__scale(struct perf_counts_values *count, 210void perf_counts_values__scale(struct perf_counts_values *count,
211 bool scale, s8 *pscaled); 211 bool scale, s8 *pscaled);
212 212
213void perf_evsel__compute_deltas(struct perf_evsel *evsel, int cpu, int thread, 213void perf_evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
214 struct perf_counts_values *count); 214 struct perf_counts_values *count);
215 215
216int perf_evsel__object_config(size_t object_size, 216int perf_evsel__object_config(size_t object_size,
217 int (*init)(struct perf_evsel *evsel), 217 int (*init)(struct evsel *evsel),
218 void (*fini)(struct perf_evsel *evsel)); 218 void (*fini)(struct evsel *evsel));
219 219
220struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); 220struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx);
221 221
222static inline struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr) 222static inline struct evsel *perf_evsel__new(struct perf_event_attr *attr)
223{ 223{
224 return perf_evsel__new_idx(attr, 0); 224 return perf_evsel__new_idx(attr, 0);
225} 225}
226 226
227struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx); 227struct evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx);
228 228
229/* 229/*
230 * Returns pointer with encoded error via <linux/err.h> interface. 230 * Returns pointer with encoded error via <linux/err.h> interface.
231 */ 231 */
232static inline struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name) 232static inline struct evsel *perf_evsel__newtp(const char *sys, const char *name)
233{ 233{
234 return perf_evsel__newtp_idx(sys, name, 0); 234 return perf_evsel__newtp_idx(sys, name, 0);
235} 235}
236 236
237struct perf_evsel *perf_evsel__new_cycles(bool precise); 237struct evsel *perf_evsel__new_cycles(bool precise);
238 238
239struct tep_event *event_format__new(const char *sys, const char *name); 239struct tep_event *event_format__new(const char *sys, const char *name);
240 240
241void perf_evsel__init(struct perf_evsel *evsel, 241void perf_evsel__init(struct evsel *evsel,
242 struct perf_event_attr *attr, int idx); 242 struct perf_event_attr *attr, int idx);
243void perf_evsel__exit(struct perf_evsel *evsel); 243void perf_evsel__exit(struct evsel *evsel);
244void perf_evsel__delete(struct perf_evsel *evsel); 244void perf_evsel__delete(struct evsel *evsel);
245 245
246struct callchain_param; 246struct callchain_param;
247 247
248void perf_evsel__config(struct perf_evsel *evsel, 248void perf_evsel__config(struct evsel *evsel,
249 struct record_opts *opts, 249 struct record_opts *opts,
250 struct callchain_param *callchain); 250 struct callchain_param *callchain);
251void perf_evsel__config_callchain(struct perf_evsel *evsel, 251void perf_evsel__config_callchain(struct evsel *evsel,
252 struct record_opts *opts, 252 struct record_opts *opts,
253 struct callchain_param *callchain); 253 struct callchain_param *callchain);
254 254
255int __perf_evsel__sample_size(u64 sample_type); 255int __perf_evsel__sample_size(u64 sample_type);
256void perf_evsel__calc_id_pos(struct perf_evsel *evsel); 256void perf_evsel__calc_id_pos(struct evsel *evsel);
257 257
258bool perf_evsel__is_cache_op_valid(u8 type, u8 op); 258bool perf_evsel__is_cache_op_valid(u8 type, u8 op);
259 259
@@ -269,17 +269,17 @@ extern const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX];
269extern const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX]; 269extern const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX];
270int __perf_evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, 270int __perf_evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result,
271 char *bf, size_t size); 271 char *bf, size_t size);
272const char *perf_evsel__name(struct perf_evsel *evsel); 272const char *perf_evsel__name(struct evsel *evsel);
273 273
274const char *perf_evsel__group_name(struct perf_evsel *evsel); 274const char *perf_evsel__group_name(struct evsel *evsel);
275int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size); 275int perf_evsel__group_desc(struct evsel *evsel, char *buf, size_t size);
276 276
277int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); 277int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads);
278void perf_evsel__close_fd(struct perf_evsel *evsel); 278void perf_evsel__close_fd(struct evsel *evsel);
279 279
280void __perf_evsel__set_sample_bit(struct perf_evsel *evsel, 280void __perf_evsel__set_sample_bit(struct evsel *evsel,
281 enum perf_event_sample_format bit); 281 enum perf_event_sample_format bit);
282void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel, 282void __perf_evsel__reset_sample_bit(struct evsel *evsel,
283 enum perf_event_sample_format bit); 283 enum perf_event_sample_format bit);
284 284
285#define perf_evsel__set_sample_bit(evsel, bit) \ 285#define perf_evsel__set_sample_bit(evsel, bit) \
@@ -288,33 +288,33 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
288#define perf_evsel__reset_sample_bit(evsel, bit) \ 288#define perf_evsel__reset_sample_bit(evsel, bit) \
289 __perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit) 289 __perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit)
290 290
291void perf_evsel__set_sample_id(struct perf_evsel *evsel, 291void perf_evsel__set_sample_id(struct evsel *evsel,
292 bool use_sample_identifier); 292 bool use_sample_identifier);
293 293
294int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter); 294int perf_evsel__set_filter(struct evsel *evsel, const char *filter);
295int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter); 295int perf_evsel__append_tp_filter(struct evsel *evsel, const char *filter);
296int perf_evsel__append_addr_filter(struct perf_evsel *evsel, 296int perf_evsel__append_addr_filter(struct evsel *evsel,
297 const char *filter); 297 const char *filter);
298int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter); 298int perf_evsel__apply_filter(struct evsel *evsel, const char *filter);
299int perf_evsel__enable(struct perf_evsel *evsel); 299int perf_evsel__enable(struct evsel *evsel);
300int perf_evsel__disable(struct perf_evsel *evsel); 300int perf_evsel__disable(struct evsel *evsel);
301 301
302int perf_evsel__open_per_cpu(struct perf_evsel *evsel, 302int perf_evsel__open_per_cpu(struct evsel *evsel,
303 struct perf_cpu_map *cpus); 303 struct perf_cpu_map *cpus);
304int perf_evsel__open_per_thread(struct perf_evsel *evsel, 304int perf_evsel__open_per_thread(struct evsel *evsel,
305 struct perf_thread_map *threads); 305 struct perf_thread_map *threads);
306int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, 306int perf_evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
307 struct perf_thread_map *threads); 307 struct perf_thread_map *threads);
308void perf_evsel__close(struct perf_evsel *evsel); 308void perf_evsel__close(struct evsel *evsel);
309 309
310struct perf_sample; 310struct perf_sample;
311 311
312void *perf_evsel__rawptr(struct perf_evsel *evsel, struct perf_sample *sample, 312void *perf_evsel__rawptr(struct evsel *evsel, struct perf_sample *sample,
313 const char *name); 313 const char *name);
314u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample, 314u64 perf_evsel__intval(struct evsel *evsel, struct perf_sample *sample,
315 const char *name); 315 const char *name);
316 316
317static inline char *perf_evsel__strval(struct perf_evsel *evsel, 317static inline char *perf_evsel__strval(struct evsel *evsel,
318 struct perf_sample *sample, 318 struct perf_sample *sample,
319 const char *name) 319 const char *name)
320{ 320{
@@ -325,14 +325,14 @@ struct tep_format_field;
325 325
326u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sample, bool needs_swap); 326u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sample, bool needs_swap);
327 327
328struct tep_format_field *perf_evsel__field(struct perf_evsel *evsel, const char *name); 328struct tep_format_field *perf_evsel__field(struct evsel *evsel, const char *name);
329 329
330#define perf_evsel__match(evsel, t, c) \ 330#define perf_evsel__match(evsel, t, c) \
331 (evsel->attr.type == PERF_TYPE_##t && \ 331 (evsel->attr.type == PERF_TYPE_##t && \
332 evsel->attr.config == PERF_COUNT_##c) 332 evsel->attr.config == PERF_COUNT_##c)
333 333
334static inline bool perf_evsel__match2(struct perf_evsel *e1, 334static inline bool perf_evsel__match2(struct evsel *e1,
335 struct perf_evsel *e2) 335 struct evsel *e2)
336{ 336{
337 return (e1->attr.type == e2->attr.type) && 337 return (e1->attr.type == e2->attr.type) &&
338 (e1->attr.config == e2->attr.config); 338 (e1->attr.config == e2->attr.config);
@@ -344,12 +344,12 @@ static inline bool perf_evsel__match2(struct perf_evsel *e1,
344 (a)->attr.type == (b)->attr.type && \ 344 (a)->attr.type == (b)->attr.type && \
345 (a)->attr.config == (b)->attr.config) 345 (a)->attr.config == (b)->attr.config)
346 346
347int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, 347int perf_evsel__read(struct evsel *evsel, int cpu, int thread,
348 struct perf_counts_values *count); 348 struct perf_counts_values *count);
349 349
350int perf_evsel__read_counter(struct perf_evsel *evsel, int cpu, int thread); 350int perf_evsel__read_counter(struct evsel *evsel, int cpu, int thread);
351 351
352int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, 352int __perf_evsel__read_on_cpu(struct evsel *evsel,
353 int cpu, int thread, bool scale); 353 int cpu, int thread, bool scale);
354 354
355/** 355/**
@@ -359,7 +359,7 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
359 * @cpu - CPU of interest 359 * @cpu - CPU of interest
360 * @thread - thread of interest 360 * @thread - thread of interest
361 */ 361 */
362static inline int perf_evsel__read_on_cpu(struct perf_evsel *evsel, 362static inline int perf_evsel__read_on_cpu(struct evsel *evsel,
363 int cpu, int thread) 363 int cpu, int thread)
364{ 364{
365 return __perf_evsel__read_on_cpu(evsel, cpu, thread, false); 365 return __perf_evsel__read_on_cpu(evsel, cpu, thread, false);
@@ -372,27 +372,27 @@ static inline int perf_evsel__read_on_cpu(struct perf_evsel *evsel,
372 * @cpu - CPU of interest 372 * @cpu - CPU of interest
373 * @thread - thread of interest 373 * @thread - thread of interest
374 */ 374 */
375static inline int perf_evsel__read_on_cpu_scaled(struct perf_evsel *evsel, 375static inline int perf_evsel__read_on_cpu_scaled(struct evsel *evsel,
376 int cpu, int thread) 376 int cpu, int thread)
377{ 377{
378 return __perf_evsel__read_on_cpu(evsel, cpu, thread, true); 378 return __perf_evsel__read_on_cpu(evsel, cpu, thread, true);
379} 379}
380 380
381int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, 381int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
382 struct perf_sample *sample); 382 struct perf_sample *sample);
383 383
384int perf_evsel__parse_sample_timestamp(struct perf_evsel *evsel, 384int perf_evsel__parse_sample_timestamp(struct evsel *evsel,
385 union perf_event *event, 385 union perf_event *event,
386 u64 *timestamp); 386 u64 *timestamp);
387 387
388static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) 388static inline struct evsel *perf_evsel__next(struct evsel *evsel)
389{ 389{
390 return list_entry(evsel->node.next, struct perf_evsel, node); 390 return list_entry(evsel->node.next, struct evsel, node);
391} 391}
392 392
393static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel) 393static inline struct evsel *perf_evsel__prev(struct evsel *evsel)
394{ 394{
395 return list_entry(evsel->node.prev, struct perf_evsel, node); 395 return list_entry(evsel->node.prev, struct evsel, node);
396} 396}
397 397
398/** 398/**
@@ -402,7 +402,7 @@ static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel)
402 * 402 *
403 * Return %true if @evsel is a group leader or a stand-alone event 403 * Return %true if @evsel is a group leader or a stand-alone event
404 */ 404 */
405static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel) 405static inline bool perf_evsel__is_group_leader(const struct evsel *evsel)
406{ 406{
407 return evsel->leader == evsel; 407 return evsel->leader == evsel;
408} 408}
@@ -415,7 +415,7 @@ static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel)
415 * Return %true iff event group view is enabled and @evsel is a actual group 415 * Return %true iff event group view is enabled and @evsel is a actual group
416 * leader which has other members in the group 416 * leader which has other members in the group
417 */ 417 */
418static inline bool perf_evsel__is_group_event(struct perf_evsel *evsel) 418static inline bool perf_evsel__is_group_event(struct evsel *evsel)
419{ 419{
420 if (!symbol_conf.event_group) 420 if (!symbol_conf.event_group)
421 return false; 421 return false;
@@ -423,14 +423,14 @@ static inline bool perf_evsel__is_group_event(struct perf_evsel *evsel)
423 return perf_evsel__is_group_leader(evsel) && evsel->nr_members > 1; 423 return perf_evsel__is_group_leader(evsel) && evsel->nr_members > 1;
424} 424}
425 425
426bool perf_evsel__is_function_event(struct perf_evsel *evsel); 426bool perf_evsel__is_function_event(struct evsel *evsel);
427 427
428static inline bool perf_evsel__is_bpf_output(struct perf_evsel *evsel) 428static inline bool perf_evsel__is_bpf_output(struct evsel *evsel)
429{ 429{
430 return perf_evsel__match(evsel, SOFTWARE, SW_BPF_OUTPUT); 430 return perf_evsel__match(evsel, SOFTWARE, SW_BPF_OUTPUT);
431} 431}
432 432
433static inline bool perf_evsel__is_clock(struct perf_evsel *evsel) 433static inline bool perf_evsel__is_clock(struct evsel *evsel)
434{ 434{
435 return perf_evsel__match(evsel, SOFTWARE, SW_CPU_CLOCK) || 435 return perf_evsel__match(evsel, SOFTWARE, SW_CPU_CLOCK) ||
436 perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK); 436 perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK);
@@ -444,7 +444,7 @@ struct perf_attr_details {
444 bool trace_fields; 444 bool trace_fields;
445}; 445};
446 446
447int perf_evsel__fprintf(struct perf_evsel *evsel, 447int perf_evsel__fprintf(struct evsel *evsel,
448 struct perf_attr_details *details, FILE *fp); 448 struct perf_attr_details *details, FILE *fp);
449 449
450#define EVSEL__PRINT_IP (1<<0) 450#define EVSEL__PRINT_IP (1<<0)
@@ -467,34 +467,34 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,
467 int left_alignment, unsigned int print_opts, 467 int left_alignment, unsigned int print_opts,
468 struct callchain_cursor *cursor, FILE *fp); 468 struct callchain_cursor *cursor, FILE *fp);
469 469
470bool perf_evsel__fallback(struct perf_evsel *evsel, int err, 470bool perf_evsel__fallback(struct evsel *evsel, int err,
471 char *msg, size_t msgsize); 471 char *msg, size_t msgsize);
472int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, 472int perf_evsel__open_strerror(struct evsel *evsel, struct target *target,
473 int err, char *msg, size_t size); 473 int err, char *msg, size_t size);
474 474
475static inline int perf_evsel__group_idx(struct perf_evsel *evsel) 475static inline int perf_evsel__group_idx(struct evsel *evsel)
476{ 476{
477 return evsel->idx - evsel->leader->idx; 477 return evsel->idx - evsel->leader->idx;
478} 478}
479 479
480/* Iterates group WITHOUT the leader. */ 480/* Iterates group WITHOUT the leader. */
481#define for_each_group_member(_evsel, _leader) \ 481#define for_each_group_member(_evsel, _leader) \
482for ((_evsel) = list_entry((_leader)->node.next, struct perf_evsel, node); \ 482for ((_evsel) = list_entry((_leader)->node.next, struct evsel, node); \
483 (_evsel) && (_evsel)->leader == (_leader); \ 483 (_evsel) && (_evsel)->leader == (_leader); \
484 (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) 484 (_evsel) = list_entry((_evsel)->node.next, struct evsel, node))
485 485
486/* Iterates group WITH the leader. */ 486/* Iterates group WITH the leader. */
487#define for_each_group_evsel(_evsel, _leader) \ 487#define for_each_group_evsel(_evsel, _leader) \
488for ((_evsel) = _leader; \ 488for ((_evsel) = _leader; \
489 (_evsel) && (_evsel)->leader == (_leader); \ 489 (_evsel) && (_evsel)->leader == (_leader); \
490 (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) 490 (_evsel) = list_entry((_evsel)->node.next, struct evsel, node))
491 491
492static inline bool perf_evsel__has_branch_callstack(const struct perf_evsel *evsel) 492static inline bool perf_evsel__has_branch_callstack(const struct evsel *evsel)
493{ 493{
494 return evsel->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK; 494 return evsel->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK;
495} 495}
496 496
497static inline bool evsel__has_callchain(const struct perf_evsel *evsel) 497static inline bool evsel__has_callchain(const struct evsel *evsel)
498{ 498{
499 return (evsel->attr.sample_type & PERF_SAMPLE_CALLCHAIN) != 0; 499 return (evsel->attr.sample_type & PERF_SAMPLE_CALLCHAIN) != 0;
500} 500}
@@ -504,7 +504,7 @@ typedef int (*attr__fprintf_f)(FILE *, const char *, const char *, void *);
504int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, 504int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
505 attr__fprintf_f attr__fprintf, void *priv); 505 attr__fprintf_f attr__fprintf, void *priv);
506 506
507struct perf_env *perf_evsel__env(struct perf_evsel *evsel); 507struct perf_env *perf_evsel__env(struct evsel *evsel);
508 508
509int perf_evsel__store_ids(struct perf_evsel *evsel, struct perf_evlist *evlist); 509int perf_evsel__store_ids(struct evsel *evsel, struct perf_evlist *evlist);
510#endif /* __PERF_EVSEL_H */ 510#endif /* __PERF_EVSEL_H */
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 95ea147f9e18..1fddb7da4b51 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -33,14 +33,14 @@ static int __print_attr__fprintf(FILE *fp, const char *name, const char *val, vo
33 return comma_fprintf(fp, (bool *)priv, " %s: %s", name, val); 33 return comma_fprintf(fp, (bool *)priv, " %s: %s", name, val);
34} 34}
35 35
36int perf_evsel__fprintf(struct perf_evsel *evsel, 36int perf_evsel__fprintf(struct evsel *evsel,
37 struct perf_attr_details *details, FILE *fp) 37 struct perf_attr_details *details, FILE *fp)
38{ 38{
39 bool first = true; 39 bool first = true;
40 int printed = 0; 40 int printed = 0;
41 41
42 if (details->event_group) { 42 if (details->event_group) {
43 struct perf_evsel *pos; 43 struct evsel *pos;
44 44
45 if (!perf_evsel__is_group_leader(evsel)) 45 if (!perf_evsel__is_group_leader(evsel))
46 return 0; 46 return 0;
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 4be216f3598b..132bbc29f977 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -74,7 +74,7 @@ struct feat_fd {
74 void *buf; /* Either buf != NULL or fd >= 0 */ 74 void *buf; /* Either buf != NULL or fd >= 0 */
75 ssize_t offset; 75 ssize_t offset;
76 size_t size; 76 size_t size;
77 struct perf_evsel *events; 77 struct evsel *events;
78}; 78};
79 79
80void perf_header__set_feat(struct perf_header *header, int feat) 80void perf_header__set_feat(struct perf_header *header, int feat)
@@ -472,7 +472,7 @@ static int write_nrcpus(struct feat_fd *ff,
472static int write_event_desc(struct feat_fd *ff, 472static int write_event_desc(struct feat_fd *ff,
473 struct perf_evlist *evlist) 473 struct perf_evlist *evlist)
474{ 474{
475 struct perf_evsel *evsel; 475 struct evsel *evsel;
476 u32 nre, nri, sz; 476 u32 nre, nri, sz;
477 int ret; 477 int ret;
478 478
@@ -762,7 +762,7 @@ static int write_group_desc(struct feat_fd *ff,
762 struct perf_evlist *evlist) 762 struct perf_evlist *evlist)
763{ 763{
764 u32 nr_groups = evlist->nr_groups; 764 u32 nr_groups = evlist->nr_groups;
765 struct perf_evsel *evsel; 765 struct evsel *evsel;
766 int ret; 766 int ret;
767 767
768 ret = do_write(ff, &nr_groups, sizeof(nr_groups)); 768 ret = do_write(ff, &nr_groups, sizeof(nr_groups));
@@ -1568,9 +1568,9 @@ static void print_bpf_btf(struct feat_fd *ff, FILE *fp)
1568 up_read(&env->bpf_progs.lock); 1568 up_read(&env->bpf_progs.lock);
1569} 1569}
1570 1570
1571static void free_event_desc(struct perf_evsel *events) 1571static void free_event_desc(struct evsel *events)
1572{ 1572{
1573 struct perf_evsel *evsel; 1573 struct evsel *evsel;
1574 1574
1575 if (!events) 1575 if (!events)
1576 return; 1576 return;
@@ -1583,9 +1583,9 @@ static void free_event_desc(struct perf_evsel *events)
1583 free(events); 1583 free(events);
1584} 1584}
1585 1585
1586static struct perf_evsel *read_event_desc(struct feat_fd *ff) 1586static struct evsel *read_event_desc(struct feat_fd *ff)
1587{ 1587{
1588 struct perf_evsel *evsel, *events = NULL; 1588 struct evsel *evsel, *events = NULL;
1589 u64 *id; 1589 u64 *id;
1590 void *buf = NULL; 1590 void *buf = NULL;
1591 u32 nre, sz, nr, i, j; 1591 u32 nre, sz, nr, i, j;
@@ -1669,7 +1669,7 @@ static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val,
1669 1669
1670static void print_event_desc(struct feat_fd *ff, FILE *fp) 1670static void print_event_desc(struct feat_fd *ff, FILE *fp)
1671{ 1671{
1672 struct perf_evsel *evsel, *events; 1672 struct evsel *evsel, *events;
1673 u32 j; 1673 u32 j;
1674 u64 *id; 1674 u64 *id;
1675 1675
@@ -1804,7 +1804,7 @@ error:
1804static void print_group_desc(struct feat_fd *ff, FILE *fp) 1804static void print_group_desc(struct feat_fd *ff, FILE *fp)
1805{ 1805{
1806 struct perf_session *session; 1806 struct perf_session *session;
1807 struct perf_evsel *evsel; 1807 struct evsel *evsel;
1808 u32 nr = 0; 1808 u32 nr = 0;
1809 1809
1810 session = container_of(ff->ph, struct perf_session, header); 1810 session = container_of(ff->ph, struct perf_session, header);
@@ -2089,10 +2089,10 @@ static int process_total_mem(struct feat_fd *ff, void *data __maybe_unused)
2089 return 0; 2089 return 0;
2090} 2090}
2091 2091
2092static struct perf_evsel * 2092static struct evsel *
2093perf_evlist__find_by_index(struct perf_evlist *evlist, int idx) 2093perf_evlist__find_by_index(struct perf_evlist *evlist, int idx)
2094{ 2094{
2095 struct perf_evsel *evsel; 2095 struct evsel *evsel;
2096 2096
2097 evlist__for_each_entry(evlist, evsel) { 2097 evlist__for_each_entry(evlist, evsel) {
2098 if (evsel->idx == idx) 2098 if (evsel->idx == idx)
@@ -2104,9 +2104,9 @@ perf_evlist__find_by_index(struct perf_evlist *evlist, int idx)
2104 2104
2105static void 2105static void
2106perf_evlist__set_event_name(struct perf_evlist *evlist, 2106perf_evlist__set_event_name(struct perf_evlist *evlist,
2107 struct perf_evsel *event) 2107 struct evsel *event)
2108{ 2108{
2109 struct perf_evsel *evsel; 2109 struct evsel *evsel;
2110 2110
2111 if (!event->name) 2111 if (!event->name)
2112 return; 2112 return;
@@ -2125,7 +2125,7 @@ static int
2125process_event_desc(struct feat_fd *ff, void *data __maybe_unused) 2125process_event_desc(struct feat_fd *ff, void *data __maybe_unused)
2126{ 2126{
2127 struct perf_session *session; 2127 struct perf_session *session;
2128 struct perf_evsel *evsel, *events = read_event_desc(ff); 2128 struct evsel *evsel, *events = read_event_desc(ff);
2129 2129
2130 if (!events) 2130 if (!events)
2131 return 0; 2131 return 0;
@@ -2415,7 +2415,7 @@ static int process_group_desc(struct feat_fd *ff, void *data __maybe_unused)
2415 size_t ret = -1; 2415 size_t ret = -1;
2416 u32 i, nr, nr_groups; 2416 u32 i, nr, nr_groups;
2417 struct perf_session *session; 2417 struct perf_session *session;
2418 struct perf_evsel *evsel, *leader = NULL; 2418 struct evsel *evsel, *leader = NULL;
2419 struct group_desc { 2419 struct group_desc {
2420 char *name; 2420 char *name;
2421 u32 leader_idx; 2421 u32 leader_idx;
@@ -3050,7 +3050,7 @@ int perf_session__write_header(struct perf_session *session,
3050 struct perf_file_header f_header; 3050 struct perf_file_header f_header;
3051 struct perf_file_attr f_attr; 3051 struct perf_file_attr f_attr;
3052 struct perf_header *header = &session->header; 3052 struct perf_header *header = &session->header;
3053 struct perf_evsel *evsel; 3053 struct evsel *evsel;
3054 struct feat_fd ff; 3054 struct feat_fd ff;
3055 u64 attr_offset; 3055 u64 attr_offset;
3056 int err; 3056 int err;
@@ -3479,7 +3479,7 @@ static int read_attr(int fd, struct perf_header *ph,
3479 return ret <= 0 ? -1 : 0; 3479 return ret <= 0 ? -1 : 0;
3480} 3480}
3481 3481
3482static int perf_evsel__prepare_tracepoint_event(struct perf_evsel *evsel, 3482static int perf_evsel__prepare_tracepoint_event(struct evsel *evsel,
3483 struct tep_handle *pevent) 3483 struct tep_handle *pevent)
3484{ 3484{
3485 struct tep_event *event; 3485 struct tep_event *event;
@@ -3514,7 +3514,7 @@ static int perf_evsel__prepare_tracepoint_event(struct perf_evsel *evsel,
3514static int perf_evlist__prepare_tracepoint_events(struct perf_evlist *evlist, 3514static int perf_evlist__prepare_tracepoint_events(struct perf_evlist *evlist,
3515 struct tep_handle *pevent) 3515 struct tep_handle *pevent)
3516{ 3516{
3517 struct perf_evsel *pos; 3517 struct evsel *pos;
3518 3518
3519 evlist__for_each_entry(evlist, pos) { 3519 evlist__for_each_entry(evlist, pos) {
3520 if (pos->attr.type == PERF_TYPE_TRACEPOINT && 3520 if (pos->attr.type == PERF_TYPE_TRACEPOINT &&
@@ -3570,7 +3570,7 @@ int perf_session__read_header(struct perf_session *session)
3570 lseek(fd, f_header.attrs.offset, SEEK_SET); 3570 lseek(fd, f_header.attrs.offset, SEEK_SET);
3571 3571
3572 for (i = 0; i < nr_attrs; i++) { 3572 for (i = 0; i < nr_attrs; i++) {
3573 struct perf_evsel *evsel; 3573 struct evsel *evsel;
3574 off_t tmp; 3574 off_t tmp;
3575 3575
3576 if (read_attr(fd, header, &f_attr) < 0) 3576 if (read_attr(fd, header, &f_attr) < 0)
@@ -3794,7 +3794,7 @@ event_update_event__new(size_t size, u64 type, u64 id)
3794 3794
3795int 3795int
3796perf_event__synthesize_event_update_unit(struct perf_tool *tool, 3796perf_event__synthesize_event_update_unit(struct perf_tool *tool,
3797 struct perf_evsel *evsel, 3797 struct evsel *evsel,
3798 perf_event__handler_t process) 3798 perf_event__handler_t process)
3799{ 3799{
3800 struct event_update_event *ev; 3800 struct event_update_event *ev;
@@ -3813,7 +3813,7 @@ perf_event__synthesize_event_update_unit(struct perf_tool *tool,
3813 3813
3814int 3814int
3815perf_event__synthesize_event_update_scale(struct perf_tool *tool, 3815perf_event__synthesize_event_update_scale(struct perf_tool *tool,
3816 struct perf_evsel *evsel, 3816 struct evsel *evsel,
3817 perf_event__handler_t process) 3817 perf_event__handler_t process)
3818{ 3818{
3819 struct event_update_event *ev; 3819 struct event_update_event *ev;
@@ -3833,7 +3833,7 @@ perf_event__synthesize_event_update_scale(struct perf_tool *tool,
3833 3833
3834int 3834int
3835perf_event__synthesize_event_update_name(struct perf_tool *tool, 3835perf_event__synthesize_event_update_name(struct perf_tool *tool,
3836 struct perf_evsel *evsel, 3836 struct evsel *evsel,
3837 perf_event__handler_t process) 3837 perf_event__handler_t process)
3838{ 3838{
3839 struct event_update_event *ev; 3839 struct event_update_event *ev;
@@ -3852,7 +3852,7 @@ perf_event__synthesize_event_update_name(struct perf_tool *tool,
3852 3852
3853int 3853int
3854perf_event__synthesize_event_update_cpus(struct perf_tool *tool, 3854perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
3855 struct perf_evsel *evsel, 3855 struct evsel *evsel,
3856 perf_event__handler_t process) 3856 perf_event__handler_t process)
3857{ 3857{
3858 size_t size = sizeof(struct event_update_event); 3858 size_t size = sizeof(struct event_update_event);
@@ -3924,7 +3924,7 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,
3924 struct perf_evlist *evlist, 3924 struct perf_evlist *evlist,
3925 perf_event__handler_t process) 3925 perf_event__handler_t process)
3926{ 3926{
3927 struct perf_evsel *evsel; 3927 struct evsel *evsel;
3928 int err = 0; 3928 int err = 0;
3929 3929
3930 evlist__for_each_entry(evlist, evsel) { 3930 evlist__for_each_entry(evlist, evsel) {
@@ -3939,12 +3939,12 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,
3939 return err; 3939 return err;
3940} 3940}
3941 3941
3942static bool has_unit(struct perf_evsel *counter) 3942static bool has_unit(struct evsel *counter)
3943{ 3943{
3944 return counter->unit && *counter->unit; 3944 return counter->unit && *counter->unit;
3945} 3945}
3946 3946
3947static bool has_scale(struct perf_evsel *counter) 3947static bool has_scale(struct evsel *counter)
3948{ 3948{
3949 return counter->scale != 1; 3949 return counter->scale != 1;
3950} 3950}
@@ -3954,7 +3954,7 @@ int perf_event__synthesize_extra_attr(struct perf_tool *tool,
3954 perf_event__handler_t process, 3954 perf_event__handler_t process,
3955 bool is_pipe) 3955 bool is_pipe)
3956{ 3956{
3957 struct perf_evsel *counter; 3957 struct evsel *counter;
3958 int err; 3958 int err;
3959 3959
3960 /* 3960 /*
@@ -4012,7 +4012,7 @@ int perf_event__process_attr(struct perf_tool *tool __maybe_unused,
4012 struct perf_evlist **pevlist) 4012 struct perf_evlist **pevlist)
4013{ 4013{
4014 u32 i, ids, n_ids; 4014 u32 i, ids, n_ids;
4015 struct perf_evsel *evsel; 4015 struct evsel *evsel;
4016 struct perf_evlist *evlist = *pevlist; 4016 struct perf_evlist *evlist = *pevlist;
4017 4017
4018 if (evlist == NULL) { 4018 if (evlist == NULL) {
@@ -4053,7 +4053,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,
4053 struct event_update_event_scale *ev_scale; 4053 struct event_update_event_scale *ev_scale;
4054 struct event_update_event_cpus *ev_cpus; 4054 struct event_update_event_cpus *ev_cpus;
4055 struct perf_evlist *evlist; 4055 struct perf_evlist *evlist;
4056 struct perf_evsel *evsel; 4056 struct evsel *evsel;
4057 struct perf_cpu_map *map; 4057 struct perf_cpu_map *map;
4058 4058
4059 if (!pevlist || *pevlist == NULL) 4059 if (!pevlist || *pevlist == NULL)
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 5b3abe4172e2..437d8617de27 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -135,16 +135,16 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,
135 struct perf_evlist *evlist, 135 struct perf_evlist *evlist,
136 perf_event__handler_t process); 136 perf_event__handler_t process);
137int perf_event__synthesize_event_update_unit(struct perf_tool *tool, 137int perf_event__synthesize_event_update_unit(struct perf_tool *tool,
138 struct perf_evsel *evsel, 138 struct evsel *evsel,
139 perf_event__handler_t process); 139 perf_event__handler_t process);
140int perf_event__synthesize_event_update_scale(struct perf_tool *tool, 140int perf_event__synthesize_event_update_scale(struct perf_tool *tool,
141 struct perf_evsel *evsel, 141 struct evsel *evsel,
142 perf_event__handler_t process); 142 perf_event__handler_t process);
143int perf_event__synthesize_event_update_name(struct perf_tool *tool, 143int perf_event__synthesize_event_update_name(struct perf_tool *tool,
144 struct perf_evsel *evsel, 144 struct evsel *evsel,
145 perf_event__handler_t process); 145 perf_event__handler_t process);
146int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, 146int perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
147 struct perf_evsel *evsel, 147 struct evsel *evsel,
148 perf_event__handler_t process); 148 perf_event__handler_t process);
149int perf_event__process_attr(struct perf_tool *tool, union perf_event *event, 149int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
150 struct perf_evlist **pevlist); 150 struct perf_evlist **pevlist);
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index f24fd1954f6c..3da49c479880 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -816,7 +816,7 @@ static int
816iter_finish_mem_entry(struct hist_entry_iter *iter, 816iter_finish_mem_entry(struct hist_entry_iter *iter,
817 struct addr_location *al __maybe_unused) 817 struct addr_location *al __maybe_unused)
818{ 818{
819 struct perf_evsel *evsel = iter->evsel; 819 struct evsel *evsel = iter->evsel;
820 struct hists *hists = evsel__hists(evsel); 820 struct hists *hists = evsel__hists(evsel);
821 struct hist_entry *he = iter->he; 821 struct hist_entry *he = iter->he;
822 int err = -EINVAL; 822 int err = -EINVAL;
@@ -886,7 +886,7 @@ static int
886iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *al) 886iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *al)
887{ 887{
888 struct branch_info *bi; 888 struct branch_info *bi;
889 struct perf_evsel *evsel = iter->evsel; 889 struct evsel *evsel = iter->evsel;
890 struct hists *hists = evsel__hists(evsel); 890 struct hists *hists = evsel__hists(evsel);
891 struct perf_sample *sample = iter->sample; 891 struct perf_sample *sample = iter->sample;
892 struct hist_entry *he = NULL; 892 struct hist_entry *he = NULL;
@@ -938,7 +938,7 @@ iter_prepare_normal_entry(struct hist_entry_iter *iter __maybe_unused,
938static int 938static int
939iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location *al) 939iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location *al)
940{ 940{
941 struct perf_evsel *evsel = iter->evsel; 941 struct evsel *evsel = iter->evsel;
942 struct perf_sample *sample = iter->sample; 942 struct perf_sample *sample = iter->sample;
943 struct hist_entry *he; 943 struct hist_entry *he;
944 944
@@ -956,7 +956,7 @@ iter_finish_normal_entry(struct hist_entry_iter *iter,
956 struct addr_location *al __maybe_unused) 956 struct addr_location *al __maybe_unused)
957{ 957{
958 struct hist_entry *he = iter->he; 958 struct hist_entry *he = iter->he;
959 struct perf_evsel *evsel = iter->evsel; 959 struct evsel *evsel = iter->evsel;
960 struct perf_sample *sample = iter->sample; 960 struct perf_sample *sample = iter->sample;
961 961
962 if (he == NULL) 962 if (he == NULL)
@@ -996,7 +996,7 @@ static int
996iter_add_single_cumulative_entry(struct hist_entry_iter *iter, 996iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
997 struct addr_location *al) 997 struct addr_location *al)
998{ 998{
999 struct perf_evsel *evsel = iter->evsel; 999 struct evsel *evsel = iter->evsel;
1000 struct hists *hists = evsel__hists(evsel); 1000 struct hists *hists = evsel__hists(evsel);
1001 struct perf_sample *sample = iter->sample; 1001 struct perf_sample *sample = iter->sample;
1002 struct hist_entry **he_cache = iter->priv; 1002 struct hist_entry **he_cache = iter->priv;
@@ -1041,7 +1041,7 @@ static int
1041iter_add_next_cumulative_entry(struct hist_entry_iter *iter, 1041iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
1042 struct addr_location *al) 1042 struct addr_location *al)
1043{ 1043{
1044 struct perf_evsel *evsel = iter->evsel; 1044 struct evsel *evsel = iter->evsel;
1045 struct perf_sample *sample = iter->sample; 1045 struct perf_sample *sample = iter->sample;
1046 struct hist_entry **he_cache = iter->priv; 1046 struct hist_entry **he_cache = iter->priv;
1047 struct hist_entry *he; 1047 struct hist_entry *he;
@@ -1873,7 +1873,7 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
1873 } 1873 }
1874} 1874}
1875 1875
1876void perf_evsel__output_resort_cb(struct perf_evsel *evsel, struct ui_progress *prog, 1876void perf_evsel__output_resort_cb(struct evsel *evsel, struct ui_progress *prog,
1877 hists__resort_cb_t cb, void *cb_arg) 1877 hists__resort_cb_t cb, void *cb_arg)
1878{ 1878{
1879 bool use_callchain; 1879 bool use_callchain;
@@ -1888,7 +1888,7 @@ void perf_evsel__output_resort_cb(struct perf_evsel *evsel, struct ui_progress *
1888 output_resort(evsel__hists(evsel), prog, use_callchain, cb, cb_arg); 1888 output_resort(evsel__hists(evsel), prog, use_callchain, cb, cb_arg);
1889} 1889}
1890 1890
1891void perf_evsel__output_resort(struct perf_evsel *evsel, struct ui_progress *prog) 1891void perf_evsel__output_resort(struct evsel *evsel, struct ui_progress *prog)
1892{ 1892{
1893 return perf_evsel__output_resort_cb(evsel, prog, NULL, NULL); 1893 return perf_evsel__output_resort_cb(evsel, prog, NULL, NULL);
1894} 1894}
@@ -2575,7 +2575,7 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
2575 2575
2576size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp) 2576size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp)
2577{ 2577{
2578 struct perf_evsel *pos; 2578 struct evsel *pos;
2579 size_t ret = 0; 2579 size_t ret = 0;
2580 2580
2581 evlist__for_each_entry(evlist, pos) { 2581 evlist__for_each_entry(evlist, pos) {
@@ -2602,7 +2602,7 @@ int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool sh
2602 int socket_id = hists->socket_filter; 2602 int socket_id = hists->socket_filter;
2603 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 2603 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
2604 u64 nr_events = hists->stats.total_period; 2604 u64 nr_events = hists->stats.total_period;
2605 struct perf_evsel *evsel = hists_to_evsel(hists); 2605 struct evsel *evsel = hists_to_evsel(hists);
2606 const char *ev_name = perf_evsel__name(evsel); 2606 const char *ev_name = perf_evsel__name(evsel);
2607 char buf[512], sample_freq_str[64] = ""; 2607 char buf[512], sample_freq_str[64] = "";
2608 size_t buflen = sizeof(buf); 2608 size_t buflen = sizeof(buf);
@@ -2615,7 +2615,7 @@ int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool sh
2615 } 2615 }
2616 2616
2617 if (perf_evsel__is_group_event(evsel)) { 2617 if (perf_evsel__is_group_event(evsel)) {
2618 struct perf_evsel *pos; 2618 struct evsel *pos;
2619 2619
2620 perf_evsel__group_desc(evsel, buf, buflen); 2620 perf_evsel__group_desc(evsel, buf, buflen);
2621 ev_name = buf; 2621 ev_name = buf;
@@ -2731,7 +2731,7 @@ static void hists__delete_all_entries(struct hists *hists)
2731 hists__delete_remaining_entries(&hists->entries_collapsed); 2731 hists__delete_remaining_entries(&hists->entries_collapsed);
2732} 2732}
2733 2733
2734static void hists_evsel__exit(struct perf_evsel *evsel) 2734static void hists_evsel__exit(struct evsel *evsel)
2735{ 2735{
2736 struct hists *hists = evsel__hists(evsel); 2736 struct hists *hists = evsel__hists(evsel);
2737 struct perf_hpp_fmt *fmt, *pos; 2737 struct perf_hpp_fmt *fmt, *pos;
@@ -2749,7 +2749,7 @@ static void hists_evsel__exit(struct perf_evsel *evsel)
2749 } 2749 }
2750} 2750}
2751 2751
2752static int hists_evsel__init(struct perf_evsel *evsel) 2752static int hists_evsel__init(struct evsel *evsel)
2753{ 2753{
2754 struct hists *hists = evsel__hists(evsel); 2754 struct hists *hists = evsel__hists(evsel);
2755 2755
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 24635f36148d..9bf247c638b8 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -116,7 +116,7 @@ struct hist_entry_iter {
116 116
117 bool hide_unresolved; 117 bool hide_unresolved;
118 118
119 struct perf_evsel *evsel; 119 struct evsel *evsel;
120 struct perf_sample *sample; 120 struct perf_sample *sample;
121 struct hist_entry *he; 121 struct hist_entry *he;
122 struct symbol *parent; 122 struct symbol *parent;
@@ -171,9 +171,9 @@ void hist_entry__delete(struct hist_entry *he);
171 171
172typedef int (*hists__resort_cb_t)(struct hist_entry *he, void *arg); 172typedef int (*hists__resort_cb_t)(struct hist_entry *he, void *arg);
173 173
174void perf_evsel__output_resort_cb(struct perf_evsel *evsel, struct ui_progress *prog, 174void perf_evsel__output_resort_cb(struct evsel *evsel, struct ui_progress *prog,
175 hists__resort_cb_t cb, void *cb_arg); 175 hists__resort_cb_t cb, void *cb_arg);
176void perf_evsel__output_resort(struct perf_evsel *evsel, struct ui_progress *prog); 176void perf_evsel__output_resort(struct evsel *evsel, struct ui_progress *prog);
177void hists__output_resort(struct hists *hists, struct ui_progress *prog); 177void hists__output_resort(struct hists *hists, struct ui_progress *prog);
178void hists__output_resort_cb(struct hists *hists, struct ui_progress *prog, 178void hists__output_resort_cb(struct hists *hists, struct ui_progress *prog,
179 hists__resort_cb_t cb); 179 hists__resort_cb_t cb);
@@ -219,17 +219,17 @@ void hists__match(struct hists *leader, struct hists *other);
219int hists__link(struct hists *leader, struct hists *other); 219int hists__link(struct hists *leader, struct hists *other);
220 220
221struct hists_evsel { 221struct hists_evsel {
222 struct perf_evsel evsel; 222 struct evsel evsel;
223 struct hists hists; 223 struct hists hists;
224}; 224};
225 225
226static inline struct perf_evsel *hists_to_evsel(struct hists *hists) 226static inline struct evsel *hists_to_evsel(struct hists *hists)
227{ 227{
228 struct hists_evsel *hevsel = container_of(hists, struct hists_evsel, hists); 228 struct hists_evsel *hevsel = container_of(hists, struct hists_evsel, hists);
229 return &hevsel->evsel; 229 return &hevsel->evsel;
230} 230}
231 231
232static inline struct hists *evsel__hists(struct perf_evsel *evsel) 232static inline struct hists *evsel__hists(struct evsel *evsel)
233{ 233{
234 struct hists_evsel *hevsel = (struct hists_evsel *)evsel; 234 struct hists_evsel *hevsel = (struct hists_evsel *)evsel;
235 return &hevsel->hists; 235 return &hevsel->hists;
@@ -453,11 +453,11 @@ enum rstype {
453#include "../ui/keysyms.h" 453#include "../ui/keysyms.h"
454void attr_to_script(char *buf, struct perf_event_attr *attr); 454void attr_to_script(char *buf, struct perf_event_attr *attr);
455 455
456int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, 456int map_symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,
457 struct hist_browser_timer *hbt, 457 struct hist_browser_timer *hbt,
458 struct annotation_options *annotation_opts); 458 struct annotation_options *annotation_opts);
459 459
460int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, 460int hist_entry__tui_annotate(struct hist_entry *he, struct evsel *evsel,
461 struct hist_browser_timer *hbt, 461 struct hist_browser_timer *hbt,
462 struct annotation_options *annotation_opts); 462 struct annotation_options *annotation_opts);
463 463
@@ -468,11 +468,11 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
468 bool warn_lost_event, 468 bool warn_lost_event,
469 struct annotation_options *annotation_options); 469 struct annotation_options *annotation_options);
470 470
471int script_browse(const char *script_opt, struct perf_evsel *evsel); 471int script_browse(const char *script_opt, struct evsel *evsel);
472 472
473void run_script(char *cmd); 473void run_script(char *cmd);
474int res_sample_browse(struct res_sample *res_samples, int num_res, 474int res_sample_browse(struct res_sample *res_samples, int num_res,
475 struct perf_evsel *evsel, enum rstype rstype); 475 struct evsel *evsel, enum rstype rstype);
476void res_sample_init(void); 476void res_sample_init(void);
477#else 477#else
478static inline 478static inline
@@ -487,7 +487,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
487 return 0; 487 return 0;
488} 488}
489static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused, 489static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused,
490 struct perf_evsel *evsel __maybe_unused, 490 struct evsel *evsel __maybe_unused,
491 struct hist_browser_timer *hbt __maybe_unused, 491 struct hist_browser_timer *hbt __maybe_unused,
492 struct annotation_options *annotation_options __maybe_unused) 492 struct annotation_options *annotation_options __maybe_unused)
493{ 493{
@@ -495,7 +495,7 @@ static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused,
495} 495}
496 496
497static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused, 497static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
498 struct perf_evsel *evsel __maybe_unused, 498 struct evsel *evsel __maybe_unused,
499 struct hist_browser_timer *hbt __maybe_unused, 499 struct hist_browser_timer *hbt __maybe_unused,
500 struct annotation_options *annotation_opts __maybe_unused) 500 struct annotation_options *annotation_opts __maybe_unused)
501{ 501{
@@ -503,14 +503,14 @@ static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
503} 503}
504 504
505static inline int script_browse(const char *script_opt __maybe_unused, 505static inline int script_browse(const char *script_opt __maybe_unused,
506 struct perf_evsel *evsel __maybe_unused) 506 struct evsel *evsel __maybe_unused)
507{ 507{
508 return 0; 508 return 0;
509} 509}
510 510
511static inline int res_sample_browse(struct res_sample *res_samples __maybe_unused, 511static inline int res_sample_browse(struct res_sample *res_samples __maybe_unused,
512 int num_res __maybe_unused, 512 int num_res __maybe_unused,
513 struct perf_evsel *evsel __maybe_unused, 513 struct evsel *evsel __maybe_unused,
514 enum rstype rstype __maybe_unused) 514 enum rstype rstype __maybe_unused)
515{ 515{
516 return 0; 516 return 0;
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5560e95afdda..8fd46d5f4b39 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -761,7 +761,7 @@ static int intel_bts_synth_events(struct intel_bts *bts,
761 struct perf_session *session) 761 struct perf_session *session)
762{ 762{
763 struct perf_evlist *evlist = session->evlist; 763 struct perf_evlist *evlist = session->evlist;
764 struct perf_evsel *evsel; 764 struct evsel *evsel;
765 struct perf_event_attr attr; 765 struct perf_event_attr attr;
766 bool found = false; 766 bool found = false;
767 u64 id; 767 u64 id;
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index df061599fef4..f1595b86d7c7 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -56,7 +56,7 @@ struct intel_pt {
56 u32 auxtrace_type; 56 u32 auxtrace_type;
57 struct perf_session *session; 57 struct perf_session *session;
58 struct machine *machine; 58 struct machine *machine;
59 struct perf_evsel *switch_evsel; 59 struct evsel *switch_evsel;
60 struct thread *unknown_thread; 60 struct thread *unknown_thread;
61 bool timeless_decoding; 61 bool timeless_decoding;
62 bool sampling_mode; 62 bool sampling_mode;
@@ -104,7 +104,7 @@ struct intel_pt {
104 u64 cbr_id; 104 u64 cbr_id;
105 105
106 bool sample_pebs; 106 bool sample_pebs;
107 struct perf_evsel *pebs_evsel; 107 struct evsel *pebs_evsel;
108 108
109 u64 tsc_bit; 109 u64 tsc_bit;
110 u64 mtc_bit; 110 u64 mtc_bit;
@@ -723,7 +723,7 @@ static bool intel_pt_get_config(struct intel_pt *pt,
723 723
724static bool intel_pt_exclude_kernel(struct intel_pt *pt) 724static bool intel_pt_exclude_kernel(struct intel_pt *pt)
725{ 725{
726 struct perf_evsel *evsel; 726 struct evsel *evsel;
727 727
728 evlist__for_each_entry(pt->session->evlist, evsel) { 728 evlist__for_each_entry(pt->session->evlist, evsel) {
729 if (intel_pt_get_config(pt, &evsel->attr, NULL) && 729 if (intel_pt_get_config(pt, &evsel->attr, NULL) &&
@@ -735,7 +735,7 @@ static bool intel_pt_exclude_kernel(struct intel_pt *pt)
735 735
736static bool intel_pt_return_compression(struct intel_pt *pt) 736static bool intel_pt_return_compression(struct intel_pt *pt)
737{ 737{
738 struct perf_evsel *evsel; 738 struct evsel *evsel;
739 u64 config; 739 u64 config;
740 740
741 if (!pt->noretcomp_bit) 741 if (!pt->noretcomp_bit)
@@ -751,7 +751,7 @@ static bool intel_pt_return_compression(struct intel_pt *pt)
751 751
752static bool intel_pt_branch_enable(struct intel_pt *pt) 752static bool intel_pt_branch_enable(struct intel_pt *pt)
753{ 753{
754 struct perf_evsel *evsel; 754 struct evsel *evsel;
755 u64 config; 755 u64 config;
756 756
757 evlist__for_each_entry(pt->session->evlist, evsel) { 757 evlist__for_each_entry(pt->session->evlist, evsel) {
@@ -764,7 +764,7 @@ static bool intel_pt_branch_enable(struct intel_pt *pt)
764 764
765static unsigned int intel_pt_mtc_period(struct intel_pt *pt) 765static unsigned int intel_pt_mtc_period(struct intel_pt *pt)
766{ 766{
767 struct perf_evsel *evsel; 767 struct evsel *evsel;
768 unsigned int shift; 768 unsigned int shift;
769 u64 config; 769 u64 config;
770 770
@@ -783,7 +783,7 @@ static unsigned int intel_pt_mtc_period(struct intel_pt *pt)
783 783
784static bool intel_pt_timeless_decoding(struct intel_pt *pt) 784static bool intel_pt_timeless_decoding(struct intel_pt *pt)
785{ 785{
786 struct perf_evsel *evsel; 786 struct evsel *evsel;
787 bool timeless_decoding = true; 787 bool timeless_decoding = true;
788 u64 config; 788 u64 config;
789 789
@@ -805,7 +805,7 @@ static bool intel_pt_timeless_decoding(struct intel_pt *pt)
805 805
806static bool intel_pt_tracing_kernel(struct intel_pt *pt) 806static bool intel_pt_tracing_kernel(struct intel_pt *pt)
807{ 807{
808 struct perf_evsel *evsel; 808 struct evsel *evsel;
809 809
810 evlist__for_each_entry(pt->session->evlist, evsel) { 810 evlist__for_each_entry(pt->session->evlist, evsel) {
811 if (intel_pt_get_config(pt, &evsel->attr, NULL) && 811 if (intel_pt_get_config(pt, &evsel->attr, NULL) &&
@@ -817,7 +817,7 @@ static bool intel_pt_tracing_kernel(struct intel_pt *pt)
817 817
818static bool intel_pt_have_tsc(struct intel_pt *pt) 818static bool intel_pt_have_tsc(struct intel_pt *pt)
819{ 819{
820 struct perf_evsel *evsel; 820 struct evsel *evsel;
821 bool have_tsc = false; 821 bool have_tsc = false;
822 u64 config; 822 u64 config;
823 823
@@ -1702,7 +1702,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq)
1702 struct perf_sample sample = { .ip = 0, }; 1702 struct perf_sample sample = { .ip = 0, };
1703 union perf_event *event = ptq->event_buf; 1703 union perf_event *event = ptq->event_buf;
1704 struct intel_pt *pt = ptq->pt; 1704 struct intel_pt *pt = ptq->pt;
1705 struct perf_evsel *evsel = pt->pebs_evsel; 1705 struct evsel *evsel = pt->pebs_evsel;
1706 u64 sample_type = evsel->attr.sample_type; 1706 u64 sample_type = evsel->attr.sample_type;
1707 u64 id = evsel->id[0]; 1707 u64 id = evsel->id[0];
1708 u8 cpumode; 1708 u8 cpumode;
@@ -2401,7 +2401,7 @@ static int intel_pt_sync_switch(struct intel_pt *pt, int cpu, pid_t tid,
2401static int intel_pt_process_switch(struct intel_pt *pt, 2401static int intel_pt_process_switch(struct intel_pt *pt,
2402 struct perf_sample *sample) 2402 struct perf_sample *sample)
2403{ 2403{
2404 struct perf_evsel *evsel; 2404 struct evsel *evsel;
2405 pid_t tid; 2405 pid_t tid;
2406 int cpu, ret; 2406 int cpu, ret;
2407 2407
@@ -2716,7 +2716,7 @@ static int intel_pt_synth_event(struct perf_session *session, const char *name,
2716static void intel_pt_set_event_name(struct perf_evlist *evlist, u64 id, 2716static void intel_pt_set_event_name(struct perf_evlist *evlist, u64 id,
2717 const char *name) 2717 const char *name)
2718{ 2718{
2719 struct perf_evsel *evsel; 2719 struct evsel *evsel;
2720 2720
2721 evlist__for_each_entry(evlist, evsel) { 2721 evlist__for_each_entry(evlist, evsel) {
2722 if (evsel->id && evsel->id[0] == id) { 2722 if (evsel->id && evsel->id[0] == id) {
@@ -2728,10 +2728,10 @@ static void intel_pt_set_event_name(struct perf_evlist *evlist, u64 id,
2728 } 2728 }
2729} 2729}
2730 2730
2731static struct perf_evsel *intel_pt_evsel(struct intel_pt *pt, 2731static struct evsel *intel_pt_evsel(struct intel_pt *pt,
2732 struct perf_evlist *evlist) 2732 struct perf_evlist *evlist)
2733{ 2733{
2734 struct perf_evsel *evsel; 2734 struct evsel *evsel;
2735 2735
2736 evlist__for_each_entry(evlist, evsel) { 2736 evlist__for_each_entry(evlist, evsel) {
2737 if (evsel->attr.type == pt->pmu_type && evsel->ids) 2737 if (evsel->attr.type == pt->pmu_type && evsel->ids)
@@ -2745,7 +2745,7 @@ static int intel_pt_synth_events(struct intel_pt *pt,
2745 struct perf_session *session) 2745 struct perf_session *session)
2746{ 2746{
2747 struct perf_evlist *evlist = session->evlist; 2747 struct perf_evlist *evlist = session->evlist;
2748 struct perf_evsel *evsel = intel_pt_evsel(pt, evlist); 2748 struct evsel *evsel = intel_pt_evsel(pt, evlist);
2749 struct perf_event_attr attr; 2749 struct perf_event_attr attr;
2750 u64 id; 2750 u64 id;
2751 int err; 2751 int err;
@@ -2894,9 +2894,9 @@ static int intel_pt_synth_events(struct intel_pt *pt,
2894 return 0; 2894 return 0;
2895} 2895}
2896 2896
2897static struct perf_evsel *intel_pt_find_sched_switch(struct perf_evlist *evlist) 2897static struct evsel *intel_pt_find_sched_switch(struct perf_evlist *evlist)
2898{ 2898{
2899 struct perf_evsel *evsel; 2899 struct evsel *evsel;
2900 2900
2901 evlist__for_each_entry_reverse(evlist, evsel) { 2901 evlist__for_each_entry_reverse(evlist, evsel) {
2902 const char *name = perf_evsel__name(evsel); 2902 const char *name = perf_evsel__name(evsel);
@@ -2910,7 +2910,7 @@ static struct perf_evsel *intel_pt_find_sched_switch(struct perf_evlist *evlist)
2910 2910
2911static bool intel_pt_find_switch(struct perf_evlist *evlist) 2911static bool intel_pt_find_switch(struct perf_evlist *evlist)
2912{ 2912{
2913 struct perf_evsel *evsel; 2913 struct evsel *evsel;
2914 2914
2915 evlist__for_each_entry(evlist, evsel) { 2915 evlist__for_each_entry(evlist, evsel) {
2916 if (evsel->attr.context_switch) 2916 if (evsel->attr.context_switch)
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 18c34f0c1966..8df60703411a 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -118,7 +118,7 @@ jit_close(struct jit_buf_desc *jd)
118static int 118static int
119jit_validate_events(struct perf_session *session) 119jit_validate_events(struct perf_session *session)
120{ 120{
121 struct perf_evsel *evsel; 121 struct evsel *evsel;
122 122
123 /* 123 /*
124 * check that all events use CLOCK_MONOTONIC 124 * check that all events use CLOCK_MONOTONIC
@@ -758,7 +758,7 @@ jit_process(struct perf_session *session,
758 pid_t pid, 758 pid_t pid,
759 u64 *nbytes) 759 u64 *nbytes)
760{ 760{
761 struct perf_evsel *first; 761 struct evsel *first;
762 struct jit_buf_desc jd; 762 struct jit_buf_desc jd;
763 int ret; 763 int ret;
764 764
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
index 1403dec189b4..299edd32d3d4 100644
--- a/tools/perf/util/kvm-stat.h
+++ b/tools/perf/util/kvm-stat.h
@@ -6,7 +6,7 @@
6#include "tool.h" 6#include "tool.h"
7#include "stat.h" 7#include "stat.h"
8 8
9struct perf_evsel; 9struct evsel;
10struct perf_evlist; 10struct perf_evlist;
11struct perf_session; 11struct perf_session;
12 12
@@ -45,17 +45,17 @@ struct kvm_event_key {
45struct perf_kvm_stat; 45struct perf_kvm_stat;
46 46
47struct child_event_ops { 47struct child_event_ops {
48 void (*get_key)(struct perf_evsel *evsel, 48 void (*get_key)(struct evsel *evsel,
49 struct perf_sample *sample, 49 struct perf_sample *sample,
50 struct event_key *key); 50 struct event_key *key);
51 const char *name; 51 const char *name;
52}; 52};
53 53
54struct kvm_events_ops { 54struct kvm_events_ops {
55 bool (*is_begin_event)(struct perf_evsel *evsel, 55 bool (*is_begin_event)(struct evsel *evsel,
56 struct perf_sample *sample, 56 struct perf_sample *sample,
57 struct event_key *key); 57 struct event_key *key);
58 bool (*is_end_event)(struct perf_evsel *evsel, 58 bool (*is_end_event)(struct evsel *evsel,
59 struct perf_sample *sample, struct event_key *key); 59 struct perf_sample *sample, struct event_key *key);
60 struct child_event_ops *child_ops; 60 struct child_event_ops *child_ops;
61 void (*decode_key)(struct perf_kvm_stat *kvm, struct event_key *key, 61 void (*decode_key)(struct perf_kvm_stat *kvm, struct event_key *key,
@@ -109,21 +109,21 @@ struct kvm_reg_events_ops {
109 struct kvm_events_ops *ops; 109 struct kvm_events_ops *ops;
110}; 110};
111 111
112void exit_event_get_key(struct perf_evsel *evsel, 112void exit_event_get_key(struct evsel *evsel,
113 struct perf_sample *sample, 113 struct perf_sample *sample,
114 struct event_key *key); 114 struct event_key *key);
115bool exit_event_begin(struct perf_evsel *evsel, 115bool exit_event_begin(struct evsel *evsel,
116 struct perf_sample *sample, 116 struct perf_sample *sample,
117 struct event_key *key); 117 struct event_key *key);
118bool exit_event_end(struct perf_evsel *evsel, 118bool exit_event_end(struct evsel *evsel,
119 struct perf_sample *sample, 119 struct perf_sample *sample,
120 struct event_key *key); 120 struct event_key *key);
121void exit_event_decode_key(struct perf_kvm_stat *kvm, 121void exit_event_decode_key(struct perf_kvm_stat *kvm,
122 struct event_key *key, 122 struct event_key *key,
123 char *decode); 123 char *decode);
124 124
125bool kvm_exit_event(struct perf_evsel *evsel); 125bool kvm_exit_event(struct evsel *evsel);
126bool kvm_entry_event(struct perf_evsel *evsel); 126bool kvm_entry_event(struct evsel *evsel);
127int setup_kvm_events_tp(struct perf_kvm_stat *kvm); 127int setup_kvm_events_tp(struct perf_kvm_stat *kvm);
128 128
129#define define_exit_reasons_table(name, symbols) \ 129#define define_exit_reasons_table(name, symbols) \
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a2359a33c748..ec0675b0caa8 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2287,7 +2287,7 @@ static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread,
2287 2287
2288static int thread__resolve_callchain_sample(struct thread *thread, 2288static int thread__resolve_callchain_sample(struct thread *thread,
2289 struct callchain_cursor *cursor, 2289 struct callchain_cursor *cursor,
2290 struct perf_evsel *evsel, 2290 struct evsel *evsel,
2291 struct perf_sample *sample, 2291 struct perf_sample *sample,
2292 struct symbol **parent, 2292 struct symbol **parent,
2293 struct addr_location *root_al, 2293 struct addr_location *root_al,
@@ -2493,7 +2493,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
2493 2493
2494static int thread__resolve_callchain_unwind(struct thread *thread, 2494static int thread__resolve_callchain_unwind(struct thread *thread,
2495 struct callchain_cursor *cursor, 2495 struct callchain_cursor *cursor,
2496 struct perf_evsel *evsel, 2496 struct evsel *evsel,
2497 struct perf_sample *sample, 2497 struct perf_sample *sample,
2498 int max_stack) 2498 int max_stack)
2499{ 2499{
@@ -2513,7 +2513,7 @@ static int thread__resolve_callchain_unwind(struct thread *thread,
2513 2513
2514int thread__resolve_callchain(struct thread *thread, 2514int thread__resolve_callchain(struct thread *thread,
2515 struct callchain_cursor *cursor, 2515 struct callchain_cursor *cursor,
2516 struct perf_evsel *evsel, 2516 struct evsel *evsel,
2517 struct perf_sample *sample, 2517 struct perf_sample *sample,
2518 struct symbol **parent, 2518 struct symbol **parent,
2519 struct addr_location *root_al, 2519 struct addr_location *root_al,
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 7f64016758e0..ef803f08ae12 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -11,7 +11,7 @@
11 11
12struct addr_location; 12struct addr_location;
13struct branch_stack; 13struct branch_stack;
14struct perf_evsel; 14struct evsel;
15struct perf_sample; 15struct perf_sample;
16struct symbol; 16struct symbol;
17struct thread; 17struct thread;
@@ -175,7 +175,7 @@ struct callchain_cursor;
175 175
176int thread__resolve_callchain(struct thread *thread, 176int thread__resolve_callchain(struct thread *thread,
177 struct callchain_cursor *cursor, 177 struct callchain_cursor *cursor,
178 struct perf_evsel *evsel, 178 struct evsel *evsel,
179 struct perf_sample *sample, 179 struct perf_sample *sample,
180 struct symbol **parent, 180 struct symbol **parent,
181 struct addr_location *root_al, 181 struct addr_location *root_al,
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index dc93787c74f0..c3614195ddc7 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -16,7 +16,7 @@ struct ip_callchain;
16struct ref_reloc_sym; 16struct ref_reloc_sym;
17struct map_groups; 17struct map_groups;
18struct machine; 18struct machine;
19struct perf_evsel; 19struct evsel;
20 20
21struct map { 21struct map {
22 union { 22 union {
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 416a9015405e..14c423974d63 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -21,7 +21,7 @@
21#include <linux/zalloc.h> 21#include <linux/zalloc.h>
22 22
23struct metric_event *metricgroup__lookup(struct rblist *metric_events, 23struct metric_event *metricgroup__lookup(struct rblist *metric_events,
24 struct perf_evsel *evsel, 24 struct evsel *evsel,
25 bool create) 25 bool create)
26{ 26{
27 struct rb_node *nd; 27 struct rb_node *nd;
@@ -86,10 +86,10 @@ struct egroup {
86 const char *metric_expr; 86 const char *metric_expr;
87}; 87};
88 88
89static bool record_evsel(int *ind, struct perf_evsel **start, 89static bool record_evsel(int *ind, struct evsel **start,
90 int idnum, 90 int idnum,
91 struct perf_evsel **metric_events, 91 struct evsel **metric_events,
92 struct perf_evsel *ev) 92 struct evsel *ev)
93{ 93{
94 metric_events[*ind] = ev; 94 metric_events[*ind] = ev;
95 if (*ind == 0) 95 if (*ind == 0)
@@ -101,12 +101,12 @@ static bool record_evsel(int *ind, struct perf_evsel **start,
101 return false; 101 return false;
102} 102}
103 103
104static struct perf_evsel *find_evsel_group(struct perf_evlist *perf_evlist, 104static struct evsel *find_evsel_group(struct perf_evlist *perf_evlist,
105 const char **ids, 105 const char **ids,
106 int idnum, 106 int idnum,
107 struct perf_evsel **metric_events) 107 struct evsel **metric_events)
108{ 108{
109 struct perf_evsel *ev, *start = NULL; 109 struct evsel *ev, *start = NULL;
110 int ind = 0; 110 int ind = 0;
111 111
112 evlist__for_each_entry (perf_evlist, ev) { 112 evlist__for_each_entry (perf_evlist, ev) {
@@ -148,10 +148,10 @@ static int metricgroup__setup_events(struct list_head *groups,
148 int i = 0; 148 int i = 0;
149 int ret = 0; 149 int ret = 0;
150 struct egroup *eg; 150 struct egroup *eg;
151 struct perf_evsel *evsel; 151 struct evsel *evsel;
152 152
153 list_for_each_entry (eg, groups, nd) { 153 list_for_each_entry (eg, groups, nd) {
154 struct perf_evsel **metric_events; 154 struct evsel **metric_events;
155 155
156 metric_events = calloc(sizeof(void *), eg->idnum + 1); 156 metric_events = calloc(sizeof(void *), eg->idnum + 1);
157 if (!metric_events) { 157 if (!metric_events) {
diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h
index 5c52097a5c63..500e828533f8 100644
--- a/tools/perf/util/metricgroup.h
+++ b/tools/perf/util/metricgroup.h
@@ -9,7 +9,7 @@
9 9
10struct metric_event { 10struct metric_event {
11 struct rb_node nd; 11 struct rb_node nd;
12 struct perf_evsel *evsel; 12 struct evsel *evsel;
13 struct list_head head; /* list of metric_expr */ 13 struct list_head head; /* list of metric_expr */
14}; 14};
15 15
@@ -17,11 +17,11 @@ struct metric_expr {
17 struct list_head nd; 17 struct list_head nd;
18 const char *metric_expr; 18 const char *metric_expr;
19 const char *metric_name; 19 const char *metric_name;
20 struct perf_evsel **metric_events; 20 struct evsel **metric_events;
21}; 21};
22 22
23struct metric_event *metricgroup__lookup(struct rblist *metric_events, 23struct metric_event *metricgroup__lookup(struct rblist *metric_events,
24 struct perf_evsel *evsel, 24 struct evsel *evsel,
25 bool create); 25 bool create);
26int metricgroup__parse_groups(const struct option *opt, 26int metricgroup__parse_groups(const struct option *opt,
27 const char *str, 27 const char *str,
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 352c5198b453..dfde9cb31562 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -314,14 +314,14 @@ static char *get_config_name(struct list_head *head_terms)
314 return NULL; 314 return NULL;
315} 315}
316 316
317static struct perf_evsel * 317static struct evsel *
318__add_event(struct list_head *list, int *idx, 318__add_event(struct list_head *list, int *idx,
319 struct perf_event_attr *attr, 319 struct perf_event_attr *attr,
320 char *name, struct perf_pmu *pmu, 320 char *name, struct perf_pmu *pmu,
321 struct list_head *config_terms, bool auto_merge_stats, 321 struct list_head *config_terms, bool auto_merge_stats,
322 const char *cpu_list) 322 const char *cpu_list)
323{ 323{
324 struct perf_evsel *evsel; 324 struct evsel *evsel;
325 struct perf_cpu_map *cpus = pmu ? pmu->cpus : 325 struct perf_cpu_map *cpus = pmu ? pmu->cpus :
326 cpu_list ? cpu_map__new(cpu_list) : NULL; 326 cpu_list ? cpu_map__new(cpu_list) : NULL;
327 327
@@ -357,7 +357,7 @@ static int add_event(struct list_head *list, int *idx,
357static int add_event_tool(struct list_head *list, int *idx, 357static int add_event_tool(struct list_head *list, int *idx,
358 enum perf_tool_event tool_event) 358 enum perf_tool_event tool_event)
359{ 359{
360 struct perf_evsel *evsel; 360 struct evsel *evsel;
361 struct perf_event_attr attr = { 361 struct perf_event_attr attr = {
362 .type = PERF_TYPE_SOFTWARE, 362 .type = PERF_TYPE_SOFTWARE,
363 .config = PERF_COUNT_SW_DUMMY, 363 .config = PERF_COUNT_SW_DUMMY,
@@ -510,7 +510,7 @@ static int add_tracepoint(struct list_head *list, int *idx,
510 struct parse_events_error *err, 510 struct parse_events_error *err,
511 struct list_head *head_config) 511 struct list_head *head_config)
512{ 512{
513 struct perf_evsel *evsel; 513 struct evsel *evsel;
514 514
515 evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++); 515 evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++);
516 if (IS_ERR(evsel)) { 516 if (IS_ERR(evsel)) {
@@ -637,7 +637,7 @@ static int add_bpf_event(const char *group, const char *event, int fd, struct bp
637 struct __add_bpf_event_param *param = _param; 637 struct __add_bpf_event_param *param = _param;
638 struct parse_events_state *parse_state = param->parse_state; 638 struct parse_events_state *parse_state = param->parse_state;
639 struct list_head *list = param->list; 639 struct list_head *list = param->list;
640 struct perf_evsel *pos; 640 struct evsel *pos;
641 int err; 641 int err;
642 /* 642 /*
643 * Check if we should add the event, i.e. if it is a TP but starts with a '!', 643 * Check if we should add the event, i.e. if it is a TP but starts with a '!',
@@ -656,7 +656,7 @@ static int add_bpf_event(const char *group, const char *event, int fd, struct bp
656 event, parse_state->error, 656 event, parse_state->error,
657 param->head_config); 657 param->head_config);
658 if (err) { 658 if (err) {
659 struct perf_evsel *evsel, *tmp; 659 struct evsel *evsel, *tmp;
660 660
661 pr_debug("Failed to add BPF event %s:%s\n", 661 pr_debug("Failed to add BPF event %s:%s\n",
662 group, event); 662 group, event);
@@ -1306,7 +1306,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
1306 struct perf_event_attr attr; 1306 struct perf_event_attr attr;
1307 struct perf_pmu_info info; 1307 struct perf_pmu_info info;
1308 struct perf_pmu *pmu; 1308 struct perf_pmu *pmu;
1309 struct perf_evsel *evsel; 1309 struct evsel *evsel;
1310 struct parse_events_error *err = parse_state->error; 1310 struct parse_events_error *err = parse_state->error;
1311 bool use_uncore_alias; 1311 bool use_uncore_alias;
1312 LIST_HEAD(config_terms); 1312 LIST_HEAD(config_terms);
@@ -1453,13 +1453,13 @@ static int
1453parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list, 1453parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
1454 struct parse_events_state *parse_state) 1454 struct parse_events_state *parse_state)
1455{ 1455{
1456 struct perf_evsel *evsel, *leader; 1456 struct evsel *evsel, *leader;
1457 uintptr_t *leaders; 1457 uintptr_t *leaders;
1458 bool is_leader = true; 1458 bool is_leader = true;
1459 int i, nr_pmu = 0, total_members, ret = 0; 1459 int i, nr_pmu = 0, total_members, ret = 0;
1460 1460
1461 leader = list_first_entry(list, struct perf_evsel, node); 1461 leader = list_first_entry(list, struct evsel, node);
1462 evsel = list_last_entry(list, struct perf_evsel, node); 1462 evsel = list_last_entry(list, struct evsel, node);
1463 total_members = evsel->idx - leader->idx + 1; 1463 total_members = evsel->idx - leader->idx + 1;
1464 1464
1465 leaders = calloc(total_members, sizeof(uintptr_t)); 1465 leaders = calloc(total_members, sizeof(uintptr_t));
@@ -1521,12 +1521,12 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
1521 __evlist__for_each_entry(list, evsel) { 1521 __evlist__for_each_entry(list, evsel) {
1522 if (i >= nr_pmu) 1522 if (i >= nr_pmu)
1523 i = 0; 1523 i = 0;
1524 evsel->leader = (struct perf_evsel *) leaders[i++]; 1524 evsel->leader = (struct evsel *) leaders[i++];
1525 } 1525 }
1526 1526
1527 /* The number of members and group name are same for each group */ 1527 /* The number of members and group name are same for each group */
1528 for (i = 0; i < nr_pmu; i++) { 1528 for (i = 0; i < nr_pmu; i++) {
1529 evsel = (struct perf_evsel *) leaders[i]; 1529 evsel = (struct evsel *) leaders[i];
1530 evsel->nr_members = total_members / nr_pmu; 1530 evsel->nr_members = total_members / nr_pmu;
1531 evsel->group_name = name ? strdup(name) : NULL; 1531 evsel->group_name = name ? strdup(name) : NULL;
1532 } 1532 }
@@ -1544,7 +1544,7 @@ out:
1544void parse_events__set_leader(char *name, struct list_head *list, 1544void parse_events__set_leader(char *name, struct list_head *list,
1545 struct parse_events_state *parse_state) 1545 struct parse_events_state *parse_state)
1546{ 1546{
1547 struct perf_evsel *leader; 1547 struct evsel *leader;
1548 1548
1549 if (list_empty(list)) { 1549 if (list_empty(list)) {
1550 WARN_ONCE(true, "WARNING: failed to set leader: empty list"); 1550 WARN_ONCE(true, "WARNING: failed to set leader: empty list");
@@ -1555,7 +1555,7 @@ void parse_events__set_leader(char *name, struct list_head *list,
1555 return; 1555 return;
1556 1556
1557 __perf_evlist__set_leader(list); 1557 __perf_evlist__set_leader(list);
1558 leader = list_entry(list->next, struct perf_evsel, node); 1558 leader = list_entry(list->next, struct evsel, node);
1559 leader->group_name = name ? strdup(name) : NULL; 1559 leader->group_name = name ? strdup(name) : NULL;
1560} 1560}
1561 1561
@@ -1588,7 +1588,7 @@ struct event_modifier {
1588}; 1588};
1589 1589
1590static int get_event_modifier(struct event_modifier *mod, char *str, 1590static int get_event_modifier(struct event_modifier *mod, char *str,
1591 struct perf_evsel *evsel) 1591 struct evsel *evsel)
1592{ 1592{
1593 int eu = evsel ? evsel->attr.exclude_user : 0; 1593 int eu = evsel ? evsel->attr.exclude_user : 0;
1594 int ek = evsel ? evsel->attr.exclude_kernel : 0; 1594 int ek = evsel ? evsel->attr.exclude_kernel : 0;
@@ -1701,7 +1701,7 @@ static int check_modifier(char *str)
1701 1701
1702int parse_events__modifier_event(struct list_head *list, char *str, bool add) 1702int parse_events__modifier_event(struct list_head *list, char *str, bool add)
1703{ 1703{
1704 struct perf_evsel *evsel; 1704 struct evsel *evsel;
1705 struct event_modifier mod; 1705 struct event_modifier mod;
1706 1706
1707 if (str == NULL) 1707 if (str == NULL)
@@ -1738,7 +1738,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
1738 1738
1739int parse_events_name(struct list_head *list, char *name) 1739int parse_events_name(struct list_head *list, char *name)
1740{ 1740{
1741 struct perf_evsel *evsel; 1741 struct evsel *evsel;
1742 1742
1743 __evlist__for_each_entry(list, evsel) { 1743 __evlist__for_each_entry(list, evsel) {
1744 if (!evsel->name) 1744 if (!evsel->name)
@@ -1918,7 +1918,7 @@ int parse_events(struct perf_evlist *evlist, const char *str,
1918 ret = parse_events__scanner(str, &parse_state, PE_START_EVENTS); 1918 ret = parse_events__scanner(str, &parse_state, PE_START_EVENTS);
1919 perf_pmu__parse_cleanup(); 1919 perf_pmu__parse_cleanup();
1920 if (!ret) { 1920 if (!ret) {
1921 struct perf_evsel *last; 1921 struct evsel *last;
1922 1922
1923 if (list_empty(&parse_state.list)) { 1923 if (list_empty(&parse_state.list)) {
1924 WARN_ONCE(true, "WARNING: event parser found nothing\n"); 1924 WARN_ONCE(true, "WARNING: event parser found nothing\n");
@@ -2027,11 +2027,11 @@ int parse_events_option(const struct option *opt, const char *str,
2027 2027
2028static int 2028static int
2029foreach_evsel_in_last_glob(struct perf_evlist *evlist, 2029foreach_evsel_in_last_glob(struct perf_evlist *evlist,
2030 int (*func)(struct perf_evsel *evsel, 2030 int (*func)(struct evsel *evsel,
2031 const void *arg), 2031 const void *arg),
2032 const void *arg) 2032 const void *arg)
2033{ 2033{
2034 struct perf_evsel *last = NULL; 2034 struct evsel *last = NULL;
2035 int err; 2035 int err;
2036 2036
2037 /* 2037 /*
@@ -2052,13 +2052,13 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
2052 2052
2053 if (last->node.prev == &evlist->entries) 2053 if (last->node.prev == &evlist->entries)
2054 return 0; 2054 return 0;
2055 last = list_entry(last->node.prev, struct perf_evsel, node); 2055 last = list_entry(last->node.prev, struct evsel, node);
2056 } while (!last->cmdline_group_boundary); 2056 } while (!last->cmdline_group_boundary);
2057 2057
2058 return 0; 2058 return 0;
2059} 2059}
2060 2060
2061static int set_filter(struct perf_evsel *evsel, const void *arg) 2061static int set_filter(struct evsel *evsel, const void *arg)
2062{ 2062{
2063 const char *str = arg; 2063 const char *str = arg;
2064 bool found = false; 2064 bool found = false;
@@ -2115,7 +2115,7 @@ int parse_filter(const struct option *opt, const char *str,
2115 (const void *)str); 2115 (const void *)str);
2116} 2116}
2117 2117
2118static int add_exclude_perf_filter(struct perf_evsel *evsel, 2118static int add_exclude_perf_filter(struct evsel *evsel,
2119 const void *arg __maybe_unused) 2119 const void *arg __maybe_unused)
2120{ 2120{
2121 char new_filter[64]; 2121 char new_filter[64];
@@ -2307,7 +2307,7 @@ static bool is_event_supported(u8 type, unsigned config)
2307{ 2307{
2308 bool ret = true; 2308 bool ret = true;
2309 int open_return; 2309 int open_return;
2310 struct perf_evsel *evsel; 2310 struct evsel *evsel;
2311 struct perf_event_attr attr = { 2311 struct perf_event_attr attr = {
2312 .type = type, 2312 .type = type,
2313 .config = config, 2313 .config = config,
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index f7139e1a2fd3..99e206598b60 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -12,7 +12,7 @@
12#include <string.h> 12#include <string.h>
13 13
14struct list_head; 14struct list_head;
15struct perf_evsel; 15struct evsel;
16struct perf_evlist; 16struct perf_evlist;
17struct parse_events_error; 17struct parse_events_error;
18 18
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 62dda70227e5..beafbd469b0c 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -93,7 +93,7 @@ PyMODINIT_FUNC PyInit_perf(void);
93 93
94struct pyrf_event { 94struct pyrf_event {
95 PyObject_HEAD 95 PyObject_HEAD
96 struct perf_evsel *evsel; 96 struct evsel *evsel;
97 struct perf_sample sample; 97 struct perf_sample sample;
98 union perf_event event; 98 union perf_event event;
99}; 99};
@@ -383,7 +383,7 @@ static PyObject*
383get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name) 383get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name)
384{ 384{
385 const char *str = _PyUnicode_AsString(PyObject_Str(attr_name)); 385 const char *str = _PyUnicode_AsString(PyObject_Str(attr_name));
386 struct perf_evsel *evsel = pevent->evsel; 386 struct evsel *evsel = pevent->evsel;
387 struct tep_format_field *field; 387 struct tep_format_field *field;
388 388
389 if (!evsel->tp_format) { 389 if (!evsel->tp_format) {
@@ -674,7 +674,7 @@ static int pyrf_thread_map__setup_types(void)
674struct pyrf_evsel { 674struct pyrf_evsel {
675 PyObject_HEAD 675 PyObject_HEAD
676 676
677 struct perf_evsel evsel; 677 struct evsel evsel;
678}; 678};
679 679
680static int pyrf_evsel__init(struct pyrf_evsel *pevsel, 680static int pyrf_evsel__init(struct pyrf_evsel *pevsel,
@@ -795,7 +795,7 @@ static void pyrf_evsel__delete(struct pyrf_evsel *pevsel)
795static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, 795static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel,
796 PyObject *args, PyObject *kwargs) 796 PyObject *args, PyObject *kwargs)
797{ 797{
798 struct perf_evsel *evsel = &pevsel->evsel; 798 struct evsel *evsel = &pevsel->evsel;
799 struct perf_cpu_map *cpus = NULL; 799 struct perf_cpu_map *cpus = NULL;
800 struct perf_thread_map *threads = NULL; 800 struct perf_thread_map *threads = NULL;
801 PyObject *pcpus = NULL, *pthreads = NULL; 801 PyObject *pcpus = NULL, *pthreads = NULL;
@@ -966,7 +966,7 @@ static PyObject *pyrf_evlist__add(struct pyrf_evlist *pevlist,
966{ 966{
967 struct perf_evlist *evlist = &pevlist->evlist; 967 struct perf_evlist *evlist = &pevlist->evlist;
968 PyObject *pevsel; 968 PyObject *pevsel;
969 struct perf_evsel *evsel; 969 struct evsel *evsel;
970 970
971 if (!PyArg_ParseTuple(args, "O", &pevsel)) 971 if (!PyArg_ParseTuple(args, "O", &pevsel))
972 return NULL; 972 return NULL;
@@ -1018,7 +1018,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
1018 if (event != NULL) { 1018 if (event != NULL) {
1019 PyObject *pyevent = pyrf_event__new(event); 1019 PyObject *pyevent = pyrf_event__new(event);
1020 struct pyrf_event *pevent = (struct pyrf_event *)pyevent; 1020 struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
1021 struct perf_evsel *evsel; 1021 struct evsel *evsel;
1022 1022
1023 if (pyevent == NULL) 1023 if (pyevent == NULL)
1024 return PyErr_NoMemory(); 1024 return PyErr_NoMemory();
@@ -1118,7 +1118,7 @@ static Py_ssize_t pyrf_evlist__length(PyObject *obj)
1118static PyObject *pyrf_evlist__item(PyObject *obj, Py_ssize_t i) 1118static PyObject *pyrf_evlist__item(PyObject *obj, Py_ssize_t i)
1119{ 1119{
1120 struct pyrf_evlist *pevlist = (void *)obj; 1120 struct pyrf_evlist *pevlist = (void *)obj;
1121 struct perf_evsel *pos; 1121 struct evsel *pos;
1122 1122
1123 if (i >= pevlist->evlist.nr_entries) 1123 if (i >= pevlist->evlist.nr_entries)
1124 return NULL; 1124 return NULL;
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index 051c67f82548..ef8f686729fd 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -9,12 +9,12 @@
9#include "util.h" 9#include "util.h"
10#include "cloexec.h" 10#include "cloexec.h"
11 11
12typedef void (*setup_probe_fn_t)(struct perf_evsel *evsel); 12typedef void (*setup_probe_fn_t)(struct evsel *evsel);
13 13
14static int perf_do_probe_api(setup_probe_fn_t fn, int cpu, const char *str) 14static int perf_do_probe_api(setup_probe_fn_t fn, int cpu, const char *str)
15{ 15{
16 struct perf_evlist *evlist; 16 struct perf_evlist *evlist;
17 struct perf_evsel *evsel; 17 struct evsel *evsel;
18 unsigned long flags = perf_event_open_cloexec_flag(); 18 unsigned long flags = perf_event_open_cloexec_flag();
19 int err = -EAGAIN, fd; 19 int err = -EAGAIN, fd;
20 static pid_t pid = -1; 20 static pid_t pid = -1;
@@ -78,17 +78,17 @@ static bool perf_probe_api(setup_probe_fn_t fn)
78 return false; 78 return false;
79} 79}
80 80
81static void perf_probe_sample_identifier(struct perf_evsel *evsel) 81static void perf_probe_sample_identifier(struct evsel *evsel)
82{ 82{
83 evsel->attr.sample_type |= PERF_SAMPLE_IDENTIFIER; 83 evsel->attr.sample_type |= PERF_SAMPLE_IDENTIFIER;
84} 84}
85 85
86static void perf_probe_comm_exec(struct perf_evsel *evsel) 86static void perf_probe_comm_exec(struct evsel *evsel)
87{ 87{
88 evsel->attr.comm_exec = 1; 88 evsel->attr.comm_exec = 1;
89} 89}
90 90
91static void perf_probe_context_switch(struct perf_evsel *evsel) 91static void perf_probe_context_switch(struct evsel *evsel)
92{ 92{
93 evsel->attr.context_switch = 1; 93 evsel->attr.context_switch = 1;
94} 94}
@@ -135,7 +135,7 @@ bool perf_can_record_cpu_wide(void)
135void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts, 135void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts,
136 struct callchain_param *callchain) 136 struct callchain_param *callchain)
137{ 137{
138 struct perf_evsel *evsel; 138 struct evsel *evsel;
139 bool use_sample_identifier = false; 139 bool use_sample_identifier = false;
140 bool use_comm_exec; 140 bool use_comm_exec;
141 bool sample_id = opts->sample_id; 141 bool sample_id = opts->sample_id;
@@ -167,7 +167,7 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts,
167 use_sample_identifier = perf_can_sample_identifier(); 167 use_sample_identifier = perf_can_sample_identifier();
168 sample_id = true; 168 sample_id = true;
169 } else if (evlist->nr_entries > 1) { 169 } else if (evlist->nr_entries > 1) {
170 struct perf_evsel *first = perf_evlist__first(evlist); 170 struct evsel *first = perf_evlist__first(evlist);
171 171
172 evlist__for_each_entry(evlist, evsel) { 172 evlist__for_each_entry(evlist, evsel) {
173 if (evsel->attr.sample_type == first->attr.sample_type) 173 if (evsel->attr.sample_type == first->attr.sample_type)
@@ -259,7 +259,7 @@ int record_opts__config(struct record_opts *opts)
259bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str) 259bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str)
260{ 260{
261 struct perf_evlist *temp_evlist; 261 struct perf_evlist *temp_evlist;
262 struct perf_evsel *evsel; 262 struct evsel *evsel;
263 int err, fd, cpu; 263 int err, fd, cpu;
264 bool ret = false; 264 bool ret = false;
265 pid_t pid = -1; 265 pid_t pid = -1;
diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c
index 83d2e149ef19..59d78a9fe703 100644
--- a/tools/perf/util/s390-cpumsf.c
+++ b/tools/perf/util/s390-cpumsf.c
@@ -918,7 +918,7 @@ s390_cpumsf_process_event(struct perf_session *session,
918 struct s390_cpumsf, 918 struct s390_cpumsf,
919 auxtrace); 919 auxtrace);
920 u64 timestamp = sample->time; 920 u64 timestamp = sample->time;
921 struct perf_evsel *ev_bc000; 921 struct evsel *ev_bc000;
922 922
923 int err = 0; 923 int err = 0;
924 924
diff --git a/tools/perf/util/s390-sample-raw.c b/tools/perf/util/s390-sample-raw.c
index 6650f599ed9c..159a08220947 100644
--- a/tools/perf/util/s390-sample-raw.c
+++ b/tools/perf/util/s390-sample-raw.c
@@ -203,7 +203,7 @@ static void s390_cpumcfdg_dump(struct perf_sample *sample)
203void perf_evlist__s390_sample_raw(struct perf_evlist *evlist, union perf_event *event, 203void perf_evlist__s390_sample_raw(struct perf_evlist *evlist, union perf_event *event,
204 struct perf_sample *sample) 204 struct perf_sample *sample)
205{ 205{
206 struct perf_evsel *ev_bc000; 206 struct evsel *ev_bc000;
207 207
208 if (event->header.type != PERF_RECORD_SAMPLE) 208 if (event->header.type != PERF_RECORD_SAMPLE)
209 return; 209 return;
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 61aa7f3df915..98dcdb9a79a4 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -258,7 +258,7 @@ static void define_event_symbols(struct tep_event *event,
258} 258}
259 259
260static SV *perl_process_callchain(struct perf_sample *sample, 260static SV *perl_process_callchain(struct perf_sample *sample,
261 struct perf_evsel *evsel, 261 struct evsel *evsel,
262 struct addr_location *al) 262 struct addr_location *al)
263{ 263{
264 AV *list; 264 AV *list;
@@ -336,7 +336,7 @@ exit:
336} 336}
337 337
338static void perl_process_tracepoint(struct perf_sample *sample, 338static void perl_process_tracepoint(struct perf_sample *sample,
339 struct perf_evsel *evsel, 339 struct evsel *evsel,
340 struct addr_location *al) 340 struct addr_location *al)
341{ 341{
342 struct thread *thread = al->thread; 342 struct thread *thread = al->thread;
@@ -431,7 +431,7 @@ static void perl_process_tracepoint(struct perf_sample *sample,
431 431
432static void perl_process_event_generic(union perf_event *event, 432static void perl_process_event_generic(union perf_event *event,
433 struct perf_sample *sample, 433 struct perf_sample *sample,
434 struct perf_evsel *evsel) 434 struct evsel *evsel)
435{ 435{
436 dSP; 436 dSP;
437 437
@@ -455,7 +455,7 @@ static void perl_process_event_generic(union perf_event *event,
455 455
456static void perl_process_event(union perf_event *event, 456static void perl_process_event(union perf_event *event,
457 struct perf_sample *sample, 457 struct perf_sample *sample,
458 struct perf_evsel *evsel, 458 struct evsel *evsel,
459 struct addr_location *al) 459 struct addr_location *al)
460{ 460{
461 perl_process_tracepoint(sample, evsel, al); 461 perl_process_tracepoint(sample, evsel, al);
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 0a7e662036b4..106aec31c07c 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -392,7 +392,7 @@ static const char *get_dsoname(struct map *map)
392} 392}
393 393
394static PyObject *python_process_callchain(struct perf_sample *sample, 394static PyObject *python_process_callchain(struct perf_sample *sample,
395 struct perf_evsel *evsel, 395 struct evsel *evsel,
396 struct addr_location *al) 396 struct addr_location *al)
397{ 397{
398 PyObject *pylist; 398 PyObject *pylist;
@@ -634,7 +634,7 @@ static PyObject *get_sample_value_as_tuple(struct sample_read_value *value)
634 634
635static void set_sample_read_in_dict(PyObject *dict_sample, 635static void set_sample_read_in_dict(PyObject *dict_sample,
636 struct perf_sample *sample, 636 struct perf_sample *sample,
637 struct perf_evsel *evsel) 637 struct evsel *evsel)
638{ 638{
639 u64 read_format = evsel->attr.read_format; 639 u64 read_format = evsel->attr.read_format;
640 PyObject *values; 640 PyObject *values;
@@ -705,7 +705,7 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size)
705 705
706static void set_regs_in_dict(PyObject *dict, 706static void set_regs_in_dict(PyObject *dict,
707 struct perf_sample *sample, 707 struct perf_sample *sample,
708 struct perf_evsel *evsel) 708 struct evsel *evsel)
709{ 709{
710 struct perf_event_attr *attr = &evsel->attr; 710 struct perf_event_attr *attr = &evsel->attr;
711 char bf[512]; 711 char bf[512];
@@ -722,7 +722,7 @@ static void set_regs_in_dict(PyObject *dict,
722} 722}
723 723
724static PyObject *get_perf_sample_dict(struct perf_sample *sample, 724static PyObject *get_perf_sample_dict(struct perf_sample *sample,
725 struct perf_evsel *evsel, 725 struct evsel *evsel,
726 struct addr_location *al, 726 struct addr_location *al,
727 PyObject *callchain) 727 PyObject *callchain)
728{ 728{
@@ -790,7 +790,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
790} 790}
791 791
792static void python_process_tracepoint(struct perf_sample *sample, 792static void python_process_tracepoint(struct perf_sample *sample,
793 struct perf_evsel *evsel, 793 struct evsel *evsel,
794 struct addr_location *al) 794 struct addr_location *al)
795{ 795{
796 struct tep_event *event = evsel->tp_format; 796 struct tep_event *event = evsel->tp_format;
@@ -955,7 +955,7 @@ static int tuple_set_bytes(PyObject *t, unsigned int pos, void *bytes,
955 return PyTuple_SetItem(t, pos, _PyBytes_FromStringAndSize(bytes, sz)); 955 return PyTuple_SetItem(t, pos, _PyBytes_FromStringAndSize(bytes, sz));
956} 956}
957 957
958static int python_export_evsel(struct db_export *dbe, struct perf_evsel *evsel) 958static int python_export_evsel(struct db_export *dbe, struct evsel *evsel)
959{ 959{
960 struct tables *tables = container_of(dbe, struct tables, dbe); 960 struct tables *tables = container_of(dbe, struct tables, dbe);
961 PyObject *t; 961 PyObject *t;
@@ -1275,7 +1275,7 @@ static int python_process_call_return(struct call_return *cr, u64 *parent_db_id,
1275} 1275}
1276 1276
1277static void python_process_general_event(struct perf_sample *sample, 1277static void python_process_general_event(struct perf_sample *sample,
1278 struct perf_evsel *evsel, 1278 struct evsel *evsel,
1279 struct addr_location *al) 1279 struct addr_location *al)
1280{ 1280{
1281 PyObject *handler, *t, *dict, *callchain; 1281 PyObject *handler, *t, *dict, *callchain;
@@ -1311,7 +1311,7 @@ static void python_process_general_event(struct perf_sample *sample,
1311 1311
1312static void python_process_event(union perf_event *event, 1312static void python_process_event(union perf_event *event,
1313 struct perf_sample *sample, 1313 struct perf_sample *sample,
1314 struct perf_evsel *evsel, 1314 struct evsel *evsel,
1315 struct addr_location *al) 1315 struct addr_location *al)
1316{ 1316{
1317 struct tables *tables = &tables_global; 1317 struct tables *tables = &tables_global;
@@ -1340,7 +1340,7 @@ static void python_process_switch(union perf_event *event,
1340} 1340}
1341 1341
1342static void get_handler_name(char *str, size_t size, 1342static void get_handler_name(char *str, size_t size,
1343 struct perf_evsel *evsel) 1343 struct evsel *evsel)
1344{ 1344{
1345 char *p = str; 1345 char *p = str;
1346 1346
@@ -1353,7 +1353,7 @@ static void get_handler_name(char *str, size_t size,
1353} 1353}
1354 1354
1355static void 1355static void
1356process_stat(struct perf_evsel *counter, int cpu, int thread, u64 tstamp, 1356process_stat(struct evsel *counter, int cpu, int thread, u64 tstamp,
1357 struct perf_counts_values *count) 1357 struct perf_counts_values *count)
1358{ 1358{
1359 PyObject *handler, *t; 1359 PyObject *handler, *t;
@@ -1390,7 +1390,7 @@ process_stat(struct perf_evsel *counter, int cpu, int thread, u64 tstamp,
1390} 1390}
1391 1391
1392static void python_process_stat(struct perf_stat_config *config, 1392static void python_process_stat(struct perf_stat_config *config,
1393 struct perf_evsel *counter, u64 tstamp) 1393 struct evsel *counter, u64 tstamp)
1394{ 1394{
1395 struct perf_thread_map *threads = counter->threads; 1395 struct perf_thread_map *threads = counter->threads;
1396 struct perf_cpu_map *cpus = counter->cpus; 1396 struct perf_cpu_map *cpus = counter->cpus;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 69d1d158a610..e9d1cf8eb274 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -151,7 +151,7 @@ static void perf_session__destroy_kernel_maps(struct perf_session *session)
151 151
152static bool perf_session__has_comm_exec(struct perf_session *session) 152static bool perf_session__has_comm_exec(struct perf_session *session)
153{ 153{
154 struct perf_evsel *evsel; 154 struct evsel *evsel;
155 155
156 evlist__for_each_entry(session->evlist, evsel) { 156 evlist__for_each_entry(session->evlist, evsel) {
157 if (evsel->attr.comm_exec) 157 if (evsel->attr.comm_exec)
@@ -322,7 +322,7 @@ static int process_event_synth_event_update_stub(struct perf_tool *tool __maybe_
322static int process_event_sample_stub(struct perf_tool *tool __maybe_unused, 322static int process_event_sample_stub(struct perf_tool *tool __maybe_unused,
323 union perf_event *event __maybe_unused, 323 union perf_event *event __maybe_unused,
324 struct perf_sample *sample __maybe_unused, 324 struct perf_sample *sample __maybe_unused,
325 struct perf_evsel *evsel __maybe_unused, 325 struct evsel *evsel __maybe_unused,
326 struct machine *machine __maybe_unused) 326 struct machine *machine __maybe_unused)
327{ 327{
328 dump_printf(": unhandled!\n"); 328 dump_printf(": unhandled!\n");
@@ -1033,7 +1033,7 @@ static void callchain__lbr_callstack_printf(struct perf_sample *sample)
1033 } 1033 }
1034} 1034}
1035 1035
1036static void callchain__printf(struct perf_evsel *evsel, 1036static void callchain__printf(struct evsel *evsel,
1037 struct perf_sample *sample) 1037 struct perf_sample *sample)
1038{ 1038{
1039 unsigned int i; 1039 unsigned int i;
@@ -1198,7 +1198,7 @@ static void dump_event(struct perf_evlist *evlist, union perf_event *event,
1198 event->header.size, perf_event__name(event->header.type)); 1198 event->header.size, perf_event__name(event->header.type));
1199} 1199}
1200 1200
1201static void dump_sample(struct perf_evsel *evsel, union perf_event *event, 1201static void dump_sample(struct evsel *evsel, union perf_event *event,
1202 struct perf_sample *sample) 1202 struct perf_sample *sample)
1203{ 1203{
1204 u64 sample_type; 1204 u64 sample_type;
@@ -1243,7 +1243,7 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
1243 sample_read__printf(sample, evsel->attr.read_format); 1243 sample_read__printf(sample, evsel->attr.read_format);
1244} 1244}
1245 1245
1246static void dump_read(struct perf_evsel *evsel, union perf_event *event) 1246static void dump_read(struct evsel *evsel, union perf_event *event)
1247{ 1247{
1248 struct read_event *read_event = &event->read; 1248 struct read_event *read_event = &event->read;
1249 u64 read_format; 1249 u64 read_format;
@@ -1351,7 +1351,7 @@ static int
1351 struct perf_tool *tool, 1351 struct perf_tool *tool,
1352 union perf_event *event, 1352 union perf_event *event,
1353 struct perf_sample *sample, 1353 struct perf_sample *sample,
1354 struct perf_evsel *evsel, 1354 struct evsel *evsel,
1355 struct machine *machine) 1355 struct machine *machine)
1356{ 1356{
1357 /* We know evsel != NULL. */ 1357 /* We know evsel != NULL. */
@@ -1377,7 +1377,7 @@ static int machines__deliver_event(struct machines *machines,
1377 struct perf_sample *sample, 1377 struct perf_sample *sample,
1378 struct perf_tool *tool, u64 file_offset) 1378 struct perf_tool *tool, u64 file_offset)
1379{ 1379{
1380 struct perf_evsel *evsel; 1380 struct evsel *evsel;
1381 struct machine *machine; 1381 struct machine *machine;
1382 1382
1383 dump_event(evlist, event, file_offset, sample); 1383 dump_event(evlist, event, file_offset, sample);
@@ -1705,7 +1705,7 @@ static void
1705perf_session__warn_order(const struct perf_session *session) 1705perf_session__warn_order(const struct perf_session *session)
1706{ 1706{
1707 const struct ordered_events *oe = &session->ordered_events; 1707 const struct ordered_events *oe = &session->ordered_events;
1708 struct perf_evsel *evsel; 1708 struct evsel *evsel;
1709 bool should_warn = true; 1709 bool should_warn = true;
1710 1710
1711 evlist__for_each_entry(session->evlist, evsel) { 1711 evlist__for_each_entry(session->evlist, evsel) {
@@ -2183,7 +2183,7 @@ int perf_session__process_events(struct perf_session *session)
2183 2183
2184bool perf_session__has_traces(struct perf_session *session, const char *msg) 2184bool perf_session__has_traces(struct perf_session *session, const char *msg)
2185{ 2185{
2186 struct perf_evsel *evsel; 2186 struct evsel *evsel;
2187 2187
2188 evlist__for_each_entry(session->evlist, evsel) { 2188 evlist__for_each_entry(session->evlist, evsel) {
2189 if (evsel->attr.type == PERF_TYPE_TRACEPOINT) 2189 if (evsel->attr.type == PERF_TYPE_TRACEPOINT)
@@ -2257,10 +2257,10 @@ size_t perf_session__fprintf(struct perf_session *session, FILE *fp)
2257 return machine__fprintf(&session->machines.host, fp); 2257 return machine__fprintf(&session->machines.host, fp);
2258} 2258}
2259 2259
2260struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session, 2260struct evsel *perf_session__find_first_evtype(struct perf_session *session,
2261 unsigned int type) 2261 unsigned int type)
2262{ 2262{
2263 struct perf_evsel *pos; 2263 struct evsel *pos;
2264 2264
2265 evlist__for_each_entry(session->evlist, pos) { 2265 evlist__for_each_entry(session->evlist, pos) {
2266 if (pos->attr.type == type) 2266 if (pos->attr.type == type)
@@ -2276,7 +2276,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
2276 struct perf_cpu_map *map; 2276 struct perf_cpu_map *map;
2277 2277
2278 for (i = 0; i < PERF_TYPE_MAX; ++i) { 2278 for (i = 0; i < PERF_TYPE_MAX; ++i) {
2279 struct perf_evsel *evsel; 2279 struct evsel *evsel;
2280 2280
2281 evsel = perf_session__find_first_evtype(session, i); 2281 evsel = perf_session__find_first_evtype(session, i);
2282 if (!evsel) 2282 if (!evsel)
@@ -2327,10 +2327,10 @@ void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
2327 2327
2328 2328
2329int __perf_session__set_tracepoints_handlers(struct perf_session *session, 2329int __perf_session__set_tracepoints_handlers(struct perf_session *session,
2330 const struct perf_evsel_str_handler *assocs, 2330 const struct evsel_str_handler *assocs,
2331 size_t nr_assocs) 2331 size_t nr_assocs)
2332{ 2332{
2333 struct perf_evsel *evsel; 2333 struct evsel *evsel;
2334 size_t i; 2334 size_t i;
2335 int err; 2335 int err;
2336 2336
@@ -2397,7 +2397,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool,
2397 struct machine *machine) 2397 struct machine *machine)
2398{ 2398{
2399 union perf_event *ev; 2399 union perf_event *ev;
2400 struct perf_evsel *evsel; 2400 struct evsel *evsel;
2401 size_t nr = 0, i = 0, sz, max_nr, n; 2401 size_t nr = 0, i = 0, sz, max_nr, n;
2402 int err; 2402 int err;
2403 2403
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 863dbad87849..2b2427c4c0b9 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -73,7 +73,7 @@ int perf_session__queue_event(struct perf_session *s, union perf_event *event,
73void perf_tool__fill_defaults(struct perf_tool *tool); 73void perf_tool__fill_defaults(struct perf_tool *tool);
74 74
75int perf_session__resolve_callchain(struct perf_session *session, 75int perf_session__resolve_callchain(struct perf_session *session,
76 struct perf_evsel *evsel, 76 struct evsel *evsel,
77 struct thread *thread, 77 struct thread *thread,
78 struct ip_callchain *chain, 78 struct ip_callchain *chain,
79 struct symbol **parent); 79 struct symbol **parent);
@@ -110,7 +110,7 @@ size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp
110 110
111size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp); 111size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
112 112
113struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session, 113struct evsel *perf_session__find_first_evtype(struct perf_session *session,
114 unsigned int type); 114 unsigned int type);
115 115
116int perf_session__cpu_bitmap(struct perf_session *session, 116int perf_session__cpu_bitmap(struct perf_session *session,
@@ -118,10 +118,10 @@ int perf_session__cpu_bitmap(struct perf_session *session,
118 118
119void perf_session__fprintf_info(struct perf_session *s, FILE *fp, bool full); 119void perf_session__fprintf_info(struct perf_session *s, FILE *fp, bool full);
120 120
121struct perf_evsel_str_handler; 121struct evsel_str_handler;
122 122
123int __perf_session__set_tracepoints_handlers(struct perf_session *session, 123int __perf_session__set_tracepoints_handlers(struct perf_session *session,
124 const struct perf_evsel_str_handler *assocs, 124 const struct evsel_str_handler *assocs,
125 size_t nr_assocs); 125 size_t nr_assocs);
126 126
127#define perf_session__set_tracepoints_handlers(session, array) \ 127#define perf_session__set_tracepoints_handlers(session, array) \
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5d2518e89fc4..133d3a45997f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -698,7 +698,7 @@ struct sort_entry sort_time = {
698static char *get_trace_output(struct hist_entry *he) 698static char *get_trace_output(struct hist_entry *he)
699{ 699{
700 struct trace_seq seq; 700 struct trace_seq seq;
701 struct perf_evsel *evsel; 701 struct evsel *evsel;
702 struct tep_record rec = { 702 struct tep_record rec = {
703 .data = he->raw_data, 703 .data = he->raw_data,
704 .size = he->raw_size, 704 .size = he->raw_size,
@@ -723,7 +723,7 @@ static char *get_trace_output(struct hist_entry *he)
723static int64_t 723static int64_t
724sort__trace_cmp(struct hist_entry *left, struct hist_entry *right) 724sort__trace_cmp(struct hist_entry *left, struct hist_entry *right)
725{ 725{
726 struct perf_evsel *evsel; 726 struct evsel *evsel;
727 727
728 evsel = hists_to_evsel(left->hists); 728 evsel = hists_to_evsel(left->hists);
729 if (evsel->attr.type != PERF_TYPE_TRACEPOINT) 729 if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
@@ -740,7 +740,7 @@ sort__trace_cmp(struct hist_entry *left, struct hist_entry *right)
740static int hist_entry__trace_snprintf(struct hist_entry *he, char *bf, 740static int hist_entry__trace_snprintf(struct hist_entry *he, char *bf,
741 size_t size, unsigned int width) 741 size_t size, unsigned int width)
742{ 742{
743 struct perf_evsel *evsel; 743 struct evsel *evsel;
744 744
745 evsel = hists_to_evsel(he->hists); 745 evsel = hists_to_evsel(he->hists);
746 if (evsel->attr.type != PERF_TYPE_TRACEPOINT) 746 if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
@@ -1984,7 +1984,7 @@ static int __sort_dimension__add_hpp_output(struct sort_dimension *sd,
1984 1984
1985struct hpp_dynamic_entry { 1985struct hpp_dynamic_entry {
1986 struct perf_hpp_fmt hpp; 1986 struct perf_hpp_fmt hpp;
1987 struct perf_evsel *evsel; 1987 struct evsel *evsel;
1988 struct tep_format_field *field; 1988 struct tep_format_field *field;
1989 unsigned dynamic_len; 1989 unsigned dynamic_len;
1990 bool raw_trace; 1990 bool raw_trace;
@@ -2218,7 +2218,7 @@ static void hde_free(struct perf_hpp_fmt *fmt)
2218} 2218}
2219 2219
2220static struct hpp_dynamic_entry * 2220static struct hpp_dynamic_entry *
2221__alloc_dynamic_entry(struct perf_evsel *evsel, struct tep_format_field *field, 2221__alloc_dynamic_entry(struct evsel *evsel, struct tep_format_field *field,
2222 int level) 2222 int level)
2223{ 2223{
2224 struct hpp_dynamic_entry *hde; 2224 struct hpp_dynamic_entry *hde;
@@ -2313,10 +2313,10 @@ static int parse_field_name(char *str, char **event, char **field, char **opt)
2313 * 2. full event name (e.g. sched:sched_switch) 2313 * 2. full event name (e.g. sched:sched_switch)
2314 * 3. partial event name (should not contain ':') 2314 * 3. partial event name (should not contain ':')
2315 */ 2315 */
2316static struct perf_evsel *find_evsel(struct perf_evlist *evlist, char *event_name) 2316static struct evsel *find_evsel(struct perf_evlist *evlist, char *event_name)
2317{ 2317{
2318 struct perf_evsel *evsel = NULL; 2318 struct evsel *evsel = NULL;
2319 struct perf_evsel *pos; 2319 struct evsel *pos;
2320 bool full_name; 2320 bool full_name;
2321 2321
2322 /* case 1 */ 2322 /* case 1 */
@@ -2352,7 +2352,7 @@ static struct perf_evsel *find_evsel(struct perf_evlist *evlist, char *event_nam
2352 return evsel; 2352 return evsel;
2353} 2353}
2354 2354
2355static int __dynamic_dimension__add(struct perf_evsel *evsel, 2355static int __dynamic_dimension__add(struct evsel *evsel,
2356 struct tep_format_field *field, 2356 struct tep_format_field *field,
2357 bool raw_trace, int level) 2357 bool raw_trace, int level)
2358{ 2358{
@@ -2368,7 +2368,7 @@ static int __dynamic_dimension__add(struct perf_evsel *evsel,
2368 return 0; 2368 return 0;
2369} 2369}
2370 2370
2371static int add_evsel_fields(struct perf_evsel *evsel, bool raw_trace, int level) 2371static int add_evsel_fields(struct evsel *evsel, bool raw_trace, int level)
2372{ 2372{
2373 int ret; 2373 int ret;
2374 struct tep_format_field *field; 2374 struct tep_format_field *field;
@@ -2388,7 +2388,7 @@ static int add_all_dynamic_fields(struct perf_evlist *evlist, bool raw_trace,
2388 int level) 2388 int level)
2389{ 2389{
2390 int ret; 2390 int ret;
2391 struct perf_evsel *evsel; 2391 struct evsel *evsel;
2392 2392
2393 evlist__for_each_entry(evlist, evsel) { 2393 evlist__for_each_entry(evlist, evsel) {
2394 if (evsel->attr.type != PERF_TYPE_TRACEPOINT) 2394 if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
@@ -2405,7 +2405,7 @@ static int add_all_matching_fields(struct perf_evlist *evlist,
2405 char *field_name, bool raw_trace, int level) 2405 char *field_name, bool raw_trace, int level)
2406{ 2406{
2407 int ret = -ESRCH; 2407 int ret = -ESRCH;
2408 struct perf_evsel *evsel; 2408 struct evsel *evsel;
2409 struct tep_format_field *field; 2409 struct tep_format_field *field;
2410 2410
2411 evlist__for_each_entry(evlist, evsel) { 2411 evlist__for_each_entry(evlist, evsel) {
@@ -2427,7 +2427,7 @@ static int add_dynamic_entry(struct perf_evlist *evlist, const char *tok,
2427 int level) 2427 int level)
2428{ 2428{
2429 char *str, *event_name, *field_name, *opt_name; 2429 char *str, *event_name, *field_name, *opt_name;
2430 struct perf_evsel *evsel; 2430 struct evsel *evsel;
2431 struct tep_format_field *field; 2431 struct tep_format_field *field;
2432 bool raw_trace = symbol_conf.raw_trace; 2432 bool raw_trace = symbol_conf.raw_trace;
2433 int ret = 0; 2433 int ret = 0;
@@ -2720,7 +2720,7 @@ static const char *get_default_sort_order(struct perf_evlist *evlist)
2720 default_tracepoint_sort_order, 2720 default_tracepoint_sort_order,
2721 }; 2721 };
2722 bool use_trace = true; 2722 bool use_trace = true;
2723 struct perf_evsel *evsel; 2723 struct evsel *evsel;
2724 2724
2725 BUG_ON(sort__mode >= ARRAY_SIZE(default_sort_orders)); 2725 BUG_ON(sort__mode >= ARRAY_SIZE(default_sort_orders));
2726 2726
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 58df6a0dbb9f..8da4ddcb2e44 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -45,7 +45,7 @@ static void print_noise_pct(struct perf_stat_config *config,
45} 45}
46 46
47static void print_noise(struct perf_stat_config *config, 47static void print_noise(struct perf_stat_config *config,
48 struct perf_evsel *evsel, double avg) 48 struct evsel *evsel, double avg)
49{ 49{
50 struct perf_stat_evsel *ps; 50 struct perf_stat_evsel *ps;
51 51
@@ -56,7 +56,7 @@ static void print_noise(struct perf_stat_config *config,
56 print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg); 56 print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg);
57} 57}
58 58
59static void print_cgroup(struct perf_stat_config *config, struct perf_evsel *evsel) 59static void print_cgroup(struct perf_stat_config *config, struct evsel *evsel)
60{ 60{
61 if (nr_cgroups) { 61 if (nr_cgroups) {
62 const char *cgrp_name = evsel->cgrp ? evsel->cgrp->name : ""; 62 const char *cgrp_name = evsel->cgrp ? evsel->cgrp->name : "";
@@ -66,7 +66,7 @@ static void print_cgroup(struct perf_stat_config *config, struct perf_evsel *evs
66 66
67 67
68static void aggr_printout(struct perf_stat_config *config, 68static void aggr_printout(struct perf_stat_config *config,
69 struct perf_evsel *evsel, int id, int nr) 69 struct evsel *evsel, int id, int nr)
70{ 70{
71 switch (config->aggr_mode) { 71 switch (config->aggr_mode) {
72 case AGGR_CORE: 72 case AGGR_CORE:
@@ -134,7 +134,7 @@ struct outstate {
134 const char *prefix; 134 const char *prefix;
135 int nfields; 135 int nfields;
136 int id, nr; 136 int id, nr;
137 struct perf_evsel *evsel; 137 struct evsel *evsel;
138}; 138};
139 139
140#define METRIC_LEN 35 140#define METRIC_LEN 35
@@ -233,7 +233,7 @@ static bool valid_only_metric(const char *unit)
233 return true; 233 return true;
234} 234}
235 235
236static const char *fixunit(char *buf, struct perf_evsel *evsel, 236static const char *fixunit(char *buf, struct evsel *evsel,
237 const char *unit) 237 const char *unit)
238{ 238{
239 if (!strncmp(unit, "of all", 6)) { 239 if (!strncmp(unit, "of all", 6)) {
@@ -310,7 +310,7 @@ static void print_metric_header(struct perf_stat_config *config,
310} 310}
311 311
312static int first_shadow_cpu(struct perf_stat_config *config, 312static int first_shadow_cpu(struct perf_stat_config *config,
313 struct perf_evsel *evsel, int id) 313 struct evsel *evsel, int id)
314{ 314{
315 struct perf_evlist *evlist = evsel->evlist; 315 struct perf_evlist *evlist = evsel->evlist;
316 int i; 316 int i;
@@ -334,7 +334,7 @@ static int first_shadow_cpu(struct perf_stat_config *config,
334} 334}
335 335
336static void abs_printout(struct perf_stat_config *config, 336static void abs_printout(struct perf_stat_config *config,
337 int id, int nr, struct perf_evsel *evsel, double avg) 337 int id, int nr, struct evsel *evsel, double avg)
338{ 338{
339 FILE *output = config->output; 339 FILE *output = config->output;
340 double sc = evsel->scale; 340 double sc = evsel->scale;
@@ -363,11 +363,11 @@ static void abs_printout(struct perf_stat_config *config,
363 print_cgroup(config, evsel); 363 print_cgroup(config, evsel);
364} 364}
365 365
366static bool is_mixed_hw_group(struct perf_evsel *counter) 366static bool is_mixed_hw_group(struct evsel *counter)
367{ 367{
368 struct perf_evlist *evlist = counter->evlist; 368 struct perf_evlist *evlist = counter->evlist;
369 u32 pmu_type = counter->attr.type; 369 u32 pmu_type = counter->attr.type;
370 struct perf_evsel *pos; 370 struct evsel *pos;
371 371
372 if (counter->nr_members < 2) 372 if (counter->nr_members < 2)
373 return false; 373 return false;
@@ -388,7 +388,7 @@ static bool is_mixed_hw_group(struct perf_evsel *counter)
388} 388}
389 389
390static void printout(struct perf_stat_config *config, int id, int nr, 390static void printout(struct perf_stat_config *config, int id, int nr,
391 struct perf_evsel *counter, double uval, 391 struct evsel *counter, double uval,
392 char *prefix, u64 run, u64 ena, double noise, 392 char *prefix, u64 run, u64 ena, double noise,
393 struct runtime_stat *st) 393 struct runtime_stat *st)
394{ 394{
@@ -493,7 +493,7 @@ static void aggr_update_shadow(struct perf_stat_config *config,
493{ 493{
494 int cpu, s2, id, s; 494 int cpu, s2, id, s;
495 u64 val; 495 u64 val;
496 struct perf_evsel *counter; 496 struct evsel *counter;
497 497
498 for (s = 0; s < config->aggr_map->nr; s++) { 498 for (s = 0; s < config->aggr_map->nr; s++) {
499 id = config->aggr_map->map[s]; 499 id = config->aggr_map->map[s];
@@ -512,7 +512,7 @@ static void aggr_update_shadow(struct perf_stat_config *config,
512 } 512 }
513} 513}
514 514
515static void uniquify_event_name(struct perf_evsel *counter) 515static void uniquify_event_name(struct evsel *counter)
516{ 516{
517 char *new_name; 517 char *new_name;
518 char *config; 518 char *config;
@@ -540,13 +540,13 @@ static void uniquify_event_name(struct perf_evsel *counter)
540 counter->uniquified_name = true; 540 counter->uniquified_name = true;
541} 541}
542 542
543static void collect_all_aliases(struct perf_stat_config *config, struct perf_evsel *counter, 543static void collect_all_aliases(struct perf_stat_config *config, struct evsel *counter,
544 void (*cb)(struct perf_stat_config *config, struct perf_evsel *counter, void *data, 544 void (*cb)(struct perf_stat_config *config, struct evsel *counter, void *data,
545 bool first), 545 bool first),
546 void *data) 546 void *data)
547{ 547{
548 struct perf_evlist *evlist = counter->evlist; 548 struct perf_evlist *evlist = counter->evlist;
549 struct perf_evsel *alias; 549 struct evsel *alias;
550 550
551 alias = list_prepare_entry(counter, &(evlist->entries), node); 551 alias = list_prepare_entry(counter, &(evlist->entries), node);
552 list_for_each_entry_continue (alias, &evlist->entries, node) { 552 list_for_each_entry_continue (alias, &evlist->entries, node) {
@@ -562,8 +562,8 @@ static void collect_all_aliases(struct perf_stat_config *config, struct perf_evs
562 } 562 }
563} 563}
564 564
565static bool collect_data(struct perf_stat_config *config, struct perf_evsel *counter, 565static bool collect_data(struct perf_stat_config *config, struct evsel *counter,
566 void (*cb)(struct perf_stat_config *config, struct perf_evsel *counter, void *data, 566 void (*cb)(struct perf_stat_config *config, struct evsel *counter, void *data,
567 bool first), 567 bool first),
568 void *data) 568 void *data)
569{ 569{
@@ -585,7 +585,7 @@ struct aggr_data {
585}; 585};
586 586
587static void aggr_cb(struct perf_stat_config *config, 587static void aggr_cb(struct perf_stat_config *config,
588 struct perf_evsel *counter, void *data, bool first) 588 struct evsel *counter, void *data, bool first)
589{ 589{
590 struct aggr_data *ad = data; 590 struct aggr_data *ad = data;
591 int cpu, s2; 591 int cpu, s2;
@@ -616,7 +616,7 @@ static void aggr_cb(struct perf_stat_config *config,
616} 616}
617 617
618static void print_counter_aggrdata(struct perf_stat_config *config, 618static void print_counter_aggrdata(struct perf_stat_config *config,
619 struct perf_evsel *counter, int s, 619 struct evsel *counter, int s,
620 char *prefix, bool metric_only, 620 char *prefix, bool metric_only,
621 bool *first) 621 bool *first)
622{ 622{
@@ -656,7 +656,7 @@ static void print_aggr(struct perf_stat_config *config,
656{ 656{
657 bool metric_only = config->metric_only; 657 bool metric_only = config->metric_only;
658 FILE *output = config->output; 658 FILE *output = config->output;
659 struct perf_evsel *counter; 659 struct evsel *counter;
660 int s; 660 int s;
661 bool first; 661 bool first;
662 662
@@ -691,7 +691,7 @@ static int cmp_val(const void *a, const void *b)
691} 691}
692 692
693static struct perf_aggr_thread_value *sort_aggr_thread( 693static struct perf_aggr_thread_value *sort_aggr_thread(
694 struct perf_evsel *counter, 694 struct evsel *counter,
695 int nthreads, int ncpus, 695 int nthreads, int ncpus,
696 int *ret, 696 int *ret,
697 struct target *_target) 697 struct target *_target)
@@ -741,7 +741,7 @@ static struct perf_aggr_thread_value *sort_aggr_thread(
741 741
742static void print_aggr_thread(struct perf_stat_config *config, 742static void print_aggr_thread(struct perf_stat_config *config,
743 struct target *_target, 743 struct target *_target,
744 struct perf_evsel *counter, char *prefix) 744 struct evsel *counter, char *prefix)
745{ 745{
746 FILE *output = config->output; 746 FILE *output = config->output;
747 int nthreads = thread_map__nr(counter->threads); 747 int nthreads = thread_map__nr(counter->threads);
@@ -779,7 +779,7 @@ struct caggr_data {
779}; 779};
780 780
781static void counter_aggr_cb(struct perf_stat_config *config __maybe_unused, 781static void counter_aggr_cb(struct perf_stat_config *config __maybe_unused,
782 struct perf_evsel *counter, void *data, 782 struct evsel *counter, void *data,
783 bool first __maybe_unused) 783 bool first __maybe_unused)
784{ 784{
785 struct caggr_data *cd = data; 785 struct caggr_data *cd = data;
@@ -795,7 +795,7 @@ static void counter_aggr_cb(struct perf_stat_config *config __maybe_unused,
795 * aggregated counts in system-wide mode 795 * aggregated counts in system-wide mode
796 */ 796 */
797static void print_counter_aggr(struct perf_stat_config *config, 797static void print_counter_aggr(struct perf_stat_config *config,
798 struct perf_evsel *counter, char *prefix) 798 struct evsel *counter, char *prefix)
799{ 799{
800 bool metric_only = config->metric_only; 800 bool metric_only = config->metric_only;
801 FILE *output = config->output; 801 FILE *output = config->output;
@@ -816,7 +816,7 @@ static void print_counter_aggr(struct perf_stat_config *config,
816} 816}
817 817
818static void counter_cb(struct perf_stat_config *config __maybe_unused, 818static void counter_cb(struct perf_stat_config *config __maybe_unused,
819 struct perf_evsel *counter, void *data, 819 struct evsel *counter, void *data,
820 bool first __maybe_unused) 820 bool first __maybe_unused)
821{ 821{
822 struct aggr_data *ad = data; 822 struct aggr_data *ad = data;
@@ -831,7 +831,7 @@ static void counter_cb(struct perf_stat_config *config __maybe_unused,
831 * does not use aggregated count in system-wide 831 * does not use aggregated count in system-wide
832 */ 832 */
833static void print_counter(struct perf_stat_config *config, 833static void print_counter(struct perf_stat_config *config,
834 struct perf_evsel *counter, char *prefix) 834 struct evsel *counter, char *prefix)
835{ 835{
836 FILE *output = config->output; 836 FILE *output = config->output;
837 u64 ena, run, val; 837 u64 ena, run, val;
@@ -864,7 +864,7 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
864{ 864{
865 int cpu; 865 int cpu;
866 int nrcpus = 0; 866 int nrcpus = 0;
867 struct perf_evsel *counter; 867 struct evsel *counter;
868 u64 ena, run, val; 868 u64 ena, run, val;
869 double uval; 869 double uval;
870 870
@@ -914,7 +914,7 @@ static void print_metric_headers(struct perf_stat_config *config,
914 const char *prefix, bool no_indent) 914 const char *prefix, bool no_indent)
915{ 915{
916 struct perf_stat_output_ctx out; 916 struct perf_stat_output_ctx out;
917 struct perf_evsel *counter; 917 struct evsel *counter;
918 struct outstate os = { 918 struct outstate os = {
919 .fh = config->output 919 .fh = config->output
920 }; 920 };
@@ -1132,7 +1132,7 @@ static void print_footer(struct perf_stat_config *config)
1132} 1132}
1133 1133
1134static void print_percore(struct perf_stat_config *config, 1134static void print_percore(struct perf_stat_config *config,
1135 struct perf_evsel *counter, char *prefix) 1135 struct evsel *counter, char *prefix)
1136{ 1136{
1137 bool metric_only = config->metric_only; 1137 bool metric_only = config->metric_only;
1138 FILE *output = config->output; 1138 FILE *output = config->output;
@@ -1164,7 +1164,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist,
1164{ 1164{
1165 bool metric_only = config->metric_only; 1165 bool metric_only = config->metric_only;
1166 int interval = config->interval; 1166 int interval = config->interval;
1167 struct perf_evsel *counter; 1167 struct evsel *counter;
1168 char buf[64], *prefix = NULL; 1168 char buf[64], *prefix = NULL;
1169 1169
1170 if (interval) 1170 if (interval)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index accb1bf1cfd8..8c19f3149f34 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -25,7 +25,7 @@ struct stats walltime_nsecs_stats;
25 25
26struct saved_value { 26struct saved_value {
27 struct rb_node rb_node; 27 struct rb_node rb_node;
28 struct perf_evsel *evsel; 28 struct evsel *evsel;
29 enum stat_type type; 29 enum stat_type type;
30 int ctx; 30 int ctx;
31 int cpu; 31 int cpu;
@@ -94,7 +94,7 @@ static void saved_value_delete(struct rblist *rblist __maybe_unused,
94 free(v); 94 free(v);
95} 95}
96 96
97static struct saved_value *saved_value_lookup(struct perf_evsel *evsel, 97static struct saved_value *saved_value_lookup(struct evsel *evsel,
98 int cpu, 98 int cpu,
99 bool create, 99 bool create,
100 enum stat_type type, 100 enum stat_type type,
@@ -146,7 +146,7 @@ void perf_stat__init_shadow_stats(void)
146 runtime_stat__init(&rt_stat); 146 runtime_stat__init(&rt_stat);
147} 147}
148 148
149static int evsel_context(struct perf_evsel *evsel) 149static int evsel_context(struct evsel *evsel)
150{ 150{
151 int ctx = 0; 151 int ctx = 0;
152 152
@@ -207,7 +207,7 @@ static void update_runtime_stat(struct runtime_stat *st,
207 * more semantic information such as miss/hit ratios, 207 * more semantic information such as miss/hit ratios,
208 * instruction rates, etc: 208 * instruction rates, etc:
209 */ 209 */
210void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 count, 210void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
211 int cpu, struct runtime_stat *st) 211 int cpu, struct runtime_stat *st)
212{ 212{
213 int ctx = evsel_context(counter); 213 int ctx = evsel_context(counter);
@@ -299,10 +299,10 @@ static const char *get_ratio_color(enum grc_type type, double ratio)
299 return color; 299 return color;
300} 300}
301 301
302static struct perf_evsel *perf_stat__find_event(struct perf_evlist *evsel_list, 302static struct evsel *perf_stat__find_event(struct perf_evlist *evsel_list,
303 const char *name) 303 const char *name)
304{ 304{
305 struct perf_evsel *c2; 305 struct evsel *c2;
306 306
307 evlist__for_each_entry (evsel_list, c2) { 307 evlist__for_each_entry (evsel_list, c2) {
308 if (!strcasecmp(c2->name, name) && !c2->collect_stat) 308 if (!strcasecmp(c2->name, name) && !c2->collect_stat)
@@ -314,7 +314,7 @@ static struct perf_evsel *perf_stat__find_event(struct perf_evlist *evsel_list,
314/* Mark MetricExpr target events and link events using them to them. */ 314/* Mark MetricExpr target events and link events using them to them. */
315void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list) 315void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list)
316{ 316{
317 struct perf_evsel *counter, *leader, **metric_events, *oc; 317 struct evsel *counter, *leader, **metric_events, *oc;
318 bool found; 318 bool found;
319 const char **metric_names; 319 const char **metric_names;
320 int i; 320 int i;
@@ -332,7 +332,7 @@ void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list)
332 &metric_names, &num_metric_names) < 0) 332 &metric_names, &num_metric_names) < 0)
333 continue; 333 continue;
334 334
335 metric_events = calloc(sizeof(struct perf_evsel *), 335 metric_events = calloc(sizeof(struct evsel *),
336 num_metric_names + 1); 336 num_metric_names + 1);
337 if (!metric_events) 337 if (!metric_events)
338 return; 338 return;
@@ -415,7 +415,7 @@ static double runtime_stat_n(struct runtime_stat *st,
415 415
416static void print_stalled_cycles_frontend(struct perf_stat_config *config, 416static void print_stalled_cycles_frontend(struct perf_stat_config *config,
417 int cpu, 417 int cpu,
418 struct perf_evsel *evsel, double avg, 418 struct evsel *evsel, double avg,
419 struct perf_stat_output_ctx *out, 419 struct perf_stat_output_ctx *out,
420 struct runtime_stat *st) 420 struct runtime_stat *st)
421{ 421{
@@ -439,7 +439,7 @@ static void print_stalled_cycles_frontend(struct perf_stat_config *config,
439 439
440static void print_stalled_cycles_backend(struct perf_stat_config *config, 440static void print_stalled_cycles_backend(struct perf_stat_config *config,
441 int cpu, 441 int cpu,
442 struct perf_evsel *evsel, double avg, 442 struct evsel *evsel, double avg,
443 struct perf_stat_output_ctx *out, 443 struct perf_stat_output_ctx *out,
444 struct runtime_stat *st) 444 struct runtime_stat *st)
445{ 445{
@@ -459,7 +459,7 @@ static void print_stalled_cycles_backend(struct perf_stat_config *config,
459 459
460static void print_branch_misses(struct perf_stat_config *config, 460static void print_branch_misses(struct perf_stat_config *config,
461 int cpu, 461 int cpu,
462 struct perf_evsel *evsel, 462 struct evsel *evsel,
463 double avg, 463 double avg,
464 struct perf_stat_output_ctx *out, 464 struct perf_stat_output_ctx *out,
465 struct runtime_stat *st) 465 struct runtime_stat *st)
@@ -480,7 +480,7 @@ static void print_branch_misses(struct perf_stat_config *config,
480 480
481static void print_l1_dcache_misses(struct perf_stat_config *config, 481static void print_l1_dcache_misses(struct perf_stat_config *config,
482 int cpu, 482 int cpu,
483 struct perf_evsel *evsel, 483 struct evsel *evsel,
484 double avg, 484 double avg,
485 struct perf_stat_output_ctx *out, 485 struct perf_stat_output_ctx *out,
486 struct runtime_stat *st) 486 struct runtime_stat *st)
@@ -502,7 +502,7 @@ static void print_l1_dcache_misses(struct perf_stat_config *config,
502 502
503static void print_l1_icache_misses(struct perf_stat_config *config, 503static void print_l1_icache_misses(struct perf_stat_config *config,
504 int cpu, 504 int cpu,
505 struct perf_evsel *evsel, 505 struct evsel *evsel,
506 double avg, 506 double avg,
507 struct perf_stat_output_ctx *out, 507 struct perf_stat_output_ctx *out,
508 struct runtime_stat *st) 508 struct runtime_stat *st)
@@ -523,7 +523,7 @@ static void print_l1_icache_misses(struct perf_stat_config *config,
523 523
524static void print_dtlb_cache_misses(struct perf_stat_config *config, 524static void print_dtlb_cache_misses(struct perf_stat_config *config,
525 int cpu, 525 int cpu,
526 struct perf_evsel *evsel, 526 struct evsel *evsel,
527 double avg, 527 double avg,
528 struct perf_stat_output_ctx *out, 528 struct perf_stat_output_ctx *out,
529 struct runtime_stat *st) 529 struct runtime_stat *st)
@@ -543,7 +543,7 @@ static void print_dtlb_cache_misses(struct perf_stat_config *config,
543 543
544static void print_itlb_cache_misses(struct perf_stat_config *config, 544static void print_itlb_cache_misses(struct perf_stat_config *config,
545 int cpu, 545 int cpu,
546 struct perf_evsel *evsel, 546 struct evsel *evsel,
547 double avg, 547 double avg,
548 struct perf_stat_output_ctx *out, 548 struct perf_stat_output_ctx *out,
549 struct runtime_stat *st) 549 struct runtime_stat *st)
@@ -563,7 +563,7 @@ static void print_itlb_cache_misses(struct perf_stat_config *config,
563 563
564static void print_ll_cache_misses(struct perf_stat_config *config, 564static void print_ll_cache_misses(struct perf_stat_config *config,
565 int cpu, 565 int cpu,
566 struct perf_evsel *evsel, 566 struct evsel *evsel,
567 double avg, 567 double avg,
568 struct perf_stat_output_ctx *out, 568 struct perf_stat_output_ctx *out,
569 struct runtime_stat *st) 569 struct runtime_stat *st)
@@ -686,7 +686,7 @@ static double td_be_bound(int ctx, int cpu, struct runtime_stat *st)
686} 686}
687 687
688static void print_smi_cost(struct perf_stat_config *config, 688static void print_smi_cost(struct perf_stat_config *config,
689 int cpu, struct perf_evsel *evsel, 689 int cpu, struct evsel *evsel,
690 struct perf_stat_output_ctx *out, 690 struct perf_stat_output_ctx *out,
691 struct runtime_stat *st) 691 struct runtime_stat *st)
692{ 692{
@@ -712,7 +712,7 @@ static void print_smi_cost(struct perf_stat_config *config,
712 712
713static void generic_metric(struct perf_stat_config *config, 713static void generic_metric(struct perf_stat_config *config,
714 const char *metric_expr, 714 const char *metric_expr,
715 struct perf_evsel **metric_events, 715 struct evsel **metric_events,
716 char *name, 716 char *name,
717 const char *metric_name, 717 const char *metric_name,
718 double avg, 718 double avg,
@@ -780,7 +780,7 @@ static void generic_metric(struct perf_stat_config *config,
780} 780}
781 781
782void perf_stat__print_shadow_stats(struct perf_stat_config *config, 782void perf_stat__print_shadow_stats(struct perf_stat_config *config,
783 struct perf_evsel *evsel, 783 struct evsel *evsel,
784 double avg, int cpu, 784 double avg, int cpu,
785 struct perf_stat_output_ctx *out, 785 struct perf_stat_output_ctx *out,
786 struct rblist *metric_events, 786 struct rblist *metric_events,
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 62791c063f7a..7acb9a6730fe 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -68,7 +68,7 @@ double rel_stddev_stats(double stddev, double avg)
68 return pct; 68 return pct;
69} 69}
70 70
71bool __perf_evsel_stat__is(struct perf_evsel *evsel, 71bool __perf_evsel_stat__is(struct evsel *evsel,
72 enum perf_stat_evsel_id id) 72 enum perf_stat_evsel_id id)
73{ 73{
74 struct perf_stat_evsel *ps = evsel->stats; 74 struct perf_stat_evsel *ps = evsel->stats;
@@ -93,7 +93,7 @@ static const char *id_str[PERF_STAT_EVSEL_ID__MAX] = {
93}; 93};
94#undef ID 94#undef ID
95 95
96static void perf_stat_evsel_id_init(struct perf_evsel *evsel) 96static void perf_stat_evsel_id_init(struct evsel *evsel)
97{ 97{
98 struct perf_stat_evsel *ps = evsel->stats; 98 struct perf_stat_evsel *ps = evsel->stats;
99 int i; 99 int i;
@@ -108,7 +108,7 @@ static void perf_stat_evsel_id_init(struct perf_evsel *evsel)
108 } 108 }
109} 109}
110 110
111static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) 111static void perf_evsel__reset_stat_priv(struct evsel *evsel)
112{ 112{
113 int i; 113 int i;
114 struct perf_stat_evsel *ps = evsel->stats; 114 struct perf_stat_evsel *ps = evsel->stats;
@@ -119,7 +119,7 @@ static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
119 perf_stat_evsel_id_init(evsel); 119 perf_stat_evsel_id_init(evsel);
120} 120}
121 121
122static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) 122static int perf_evsel__alloc_stat_priv(struct evsel *evsel)
123{ 123{
124 evsel->stats = zalloc(sizeof(struct perf_stat_evsel)); 124 evsel->stats = zalloc(sizeof(struct perf_stat_evsel));
125 if (evsel->stats == NULL) 125 if (evsel->stats == NULL)
@@ -128,7 +128,7 @@ static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
128 return 0; 128 return 0;
129} 129}
130 130
131static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) 131static void perf_evsel__free_stat_priv(struct evsel *evsel)
132{ 132{
133 struct perf_stat_evsel *ps = evsel->stats; 133 struct perf_stat_evsel *ps = evsel->stats;
134 134
@@ -137,7 +137,7 @@ static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
137 zfree(&evsel->stats); 137 zfree(&evsel->stats);
138} 138}
139 139
140static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, 140static int perf_evsel__alloc_prev_raw_counts(struct evsel *evsel,
141 int ncpus, int nthreads) 141 int ncpus, int nthreads)
142{ 142{
143 struct perf_counts *counts; 143 struct perf_counts *counts;
@@ -149,13 +149,13 @@ static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
149 return counts ? 0 : -ENOMEM; 149 return counts ? 0 : -ENOMEM;
150} 150}
151 151
152static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) 152static void perf_evsel__free_prev_raw_counts(struct evsel *evsel)
153{ 153{
154 perf_counts__delete(evsel->prev_raw_counts); 154 perf_counts__delete(evsel->prev_raw_counts);
155 evsel->prev_raw_counts = NULL; 155 evsel->prev_raw_counts = NULL;
156} 156}
157 157
158static int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw) 158static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)
159{ 159{
160 int ncpus = perf_evsel__nr_cpus(evsel); 160 int ncpus = perf_evsel__nr_cpus(evsel);
161 int nthreads = thread_map__nr(evsel->threads); 161 int nthreads = thread_map__nr(evsel->threads);
@@ -170,7 +170,7 @@ static int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw)
170 170
171int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw) 171int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw)
172{ 172{
173 struct perf_evsel *evsel; 173 struct evsel *evsel;
174 174
175 evlist__for_each_entry(evlist, evsel) { 175 evlist__for_each_entry(evlist, evsel) {
176 if (perf_evsel__alloc_stats(evsel, alloc_raw)) 176 if (perf_evsel__alloc_stats(evsel, alloc_raw))
@@ -186,7 +186,7 @@ out_free:
186 186
187void perf_evlist__free_stats(struct perf_evlist *evlist) 187void perf_evlist__free_stats(struct perf_evlist *evlist)
188{ 188{
189 struct perf_evsel *evsel; 189 struct evsel *evsel;
190 190
191 evlist__for_each_entry(evlist, evsel) { 191 evlist__for_each_entry(evlist, evsel) {
192 perf_evsel__free_stat_priv(evsel); 192 perf_evsel__free_stat_priv(evsel);
@@ -197,7 +197,7 @@ void perf_evlist__free_stats(struct perf_evlist *evlist)
197 197
198void perf_evlist__reset_stats(struct perf_evlist *evlist) 198void perf_evlist__reset_stats(struct perf_evlist *evlist)
199{ 199{
200 struct perf_evsel *evsel; 200 struct evsel *evsel;
201 201
202 evlist__for_each_entry(evlist, evsel) { 202 evlist__for_each_entry(evlist, evsel) {
203 perf_evsel__reset_stat_priv(evsel); 203 perf_evsel__reset_stat_priv(evsel);
@@ -205,13 +205,13 @@ void perf_evlist__reset_stats(struct perf_evlist *evlist)
205 } 205 }
206} 206}
207 207
208static void zero_per_pkg(struct perf_evsel *counter) 208static void zero_per_pkg(struct evsel *counter)
209{ 209{
210 if (counter->per_pkg_mask) 210 if (counter->per_pkg_mask)
211 memset(counter->per_pkg_mask, 0, MAX_NR_CPUS); 211 memset(counter->per_pkg_mask, 0, MAX_NR_CPUS);
212} 212}
213 213
214static int check_per_pkg(struct perf_evsel *counter, 214static int check_per_pkg(struct evsel *counter,
215 struct perf_counts_values *vals, int cpu, bool *skip) 215 struct perf_counts_values *vals, int cpu, bool *skip)
216{ 216{
217 unsigned long *mask = counter->per_pkg_mask; 217 unsigned long *mask = counter->per_pkg_mask;
@@ -254,7 +254,7 @@ static int check_per_pkg(struct perf_evsel *counter,
254} 254}
255 255
256static int 256static int
257process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel, 257process_counter_values(struct perf_stat_config *config, struct evsel *evsel,
258 int cpu, int thread, 258 int cpu, int thread,
259 struct perf_counts_values *count) 259 struct perf_counts_values *count)
260{ 260{
@@ -306,7 +306,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
306} 306}
307 307
308static int process_counter_maps(struct perf_stat_config *config, 308static int process_counter_maps(struct perf_stat_config *config,
309 struct perf_evsel *counter) 309 struct evsel *counter)
310{ 310{
311 int nthreads = thread_map__nr(counter->threads); 311 int nthreads = thread_map__nr(counter->threads);
312 int ncpus = perf_evsel__nr_cpus(counter); 312 int ncpus = perf_evsel__nr_cpus(counter);
@@ -327,7 +327,7 @@ static int process_counter_maps(struct perf_stat_config *config,
327} 327}
328 328
329int perf_stat_process_counter(struct perf_stat_config *config, 329int perf_stat_process_counter(struct perf_stat_config *config,
330 struct perf_evsel *counter) 330 struct evsel *counter)
331{ 331{
332 struct perf_counts_values *aggr = &counter->counts->aggr; 332 struct perf_counts_values *aggr = &counter->counts->aggr;
333 struct perf_stat_evsel *ps = counter->stats; 333 struct perf_stat_evsel *ps = counter->stats;
@@ -381,7 +381,7 @@ int perf_event__process_stat_event(struct perf_session *session,
381{ 381{
382 struct perf_counts_values count; 382 struct perf_counts_values count;
383 struct stat_event *st = &event->stat; 383 struct stat_event *st = &event->stat;
384 struct perf_evsel *counter; 384 struct evsel *counter;
385 385
386 count.val = st->val; 386 count.val = st->val;
387 count.ena = st->ena; 387 count.ena = st->ena;
@@ -437,12 +437,12 @@ size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp)
437 return ret; 437 return ret;
438} 438}
439 439
440int create_perf_stat_counter(struct perf_evsel *evsel, 440int create_perf_stat_counter(struct evsel *evsel,
441 struct perf_stat_config *config, 441 struct perf_stat_config *config,
442 struct target *target) 442 struct target *target)
443{ 443{
444 struct perf_event_attr *attr = &evsel->attr; 444 struct perf_event_attr *attr = &evsel->attr;
445 struct perf_evsel *leader = evsel->leader; 445 struct evsel *leader = evsel->leader;
446 446
447 attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | 447 attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
448 PERF_FORMAT_TOTAL_TIME_RUNNING; 448 PERF_FORMAT_TOTAL_TIME_RUNNING;
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index fa675d09febd..b64cf0177a91 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -143,11 +143,11 @@ static inline void init_stats(struct stats *stats)
143 stats->max = 0; 143 stats->max = 0;
144} 144}
145 145
146struct perf_evsel; 146struct evsel;
147struct perf_evlist; 147struct perf_evlist;
148 148
149struct perf_aggr_thread_value { 149struct perf_aggr_thread_value {
150 struct perf_evsel *counter; 150 struct evsel *counter;
151 int id; 151 int id;
152 double uval; 152 double uval;
153 u64 val; 153 u64 val;
@@ -155,7 +155,7 @@ struct perf_aggr_thread_value {
155 u64 ena; 155 u64 ena;
156}; 156};
157 157
158bool __perf_evsel_stat__is(struct perf_evsel *evsel, 158bool __perf_evsel_stat__is(struct evsel *evsel,
159 enum perf_stat_evsel_id id); 159 enum perf_stat_evsel_id id);
160 160
161#define perf_stat_evsel__is(evsel, id) \ 161#define perf_stat_evsel__is(evsel, id) \
@@ -174,7 +174,7 @@ void runtime_stat__exit(struct runtime_stat *st);
174void perf_stat__init_shadow_stats(void); 174void perf_stat__init_shadow_stats(void);
175void perf_stat__reset_shadow_stats(void); 175void perf_stat__reset_shadow_stats(void);
176void perf_stat__reset_shadow_per_stat(struct runtime_stat *st); 176void perf_stat__reset_shadow_per_stat(struct runtime_stat *st);
177void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 count, 177void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
178 int cpu, struct runtime_stat *st); 178 int cpu, struct runtime_stat *st);
179struct perf_stat_output_ctx { 179struct perf_stat_output_ctx {
180 void *ctx; 180 void *ctx;
@@ -184,7 +184,7 @@ struct perf_stat_output_ctx {
184}; 184};
185 185
186void perf_stat__print_shadow_stats(struct perf_stat_config *config, 186void perf_stat__print_shadow_stats(struct perf_stat_config *config,
187 struct perf_evsel *evsel, 187 struct evsel *evsel,
188 double avg, int cpu, 188 double avg, int cpu,
189 struct perf_stat_output_ctx *out, 189 struct perf_stat_output_ctx *out,
190 struct rblist *metric_events, 190 struct rblist *metric_events,
@@ -196,7 +196,7 @@ void perf_evlist__free_stats(struct perf_evlist *evlist);
196void perf_evlist__reset_stats(struct perf_evlist *evlist); 196void perf_evlist__reset_stats(struct perf_evlist *evlist);
197 197
198int perf_stat_process_counter(struct perf_stat_config *config, 198int perf_stat_process_counter(struct perf_stat_config *config,
199 struct perf_evsel *counter); 199 struct evsel *counter);
200struct perf_tool; 200struct perf_tool;
201union perf_event; 201union perf_event;
202struct perf_session; 202struct perf_session;
@@ -207,7 +207,7 @@ size_t perf_event__fprintf_stat(union perf_event *event, FILE *fp);
207size_t perf_event__fprintf_stat_round(union perf_event *event, FILE *fp); 207size_t perf_event__fprintf_stat_round(union perf_event *event, FILE *fp);
208size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp); 208size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp);
209 209
210int create_perf_stat_counter(struct perf_evsel *evsel, 210int create_perf_stat_counter(struct evsel *evsel,
211 struct perf_stat_config *config, 211 struct perf_stat_config *config,
212 struct target *target); 212 struct target *target);
213int perf_stat_synthesize_config(struct perf_stat_config *config, 213int perf_stat_synthesize_config(struct perf_stat_config *config,
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index 9096a6e3de59..5d880a6f0a34 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -9,7 +9,7 @@
9struct perf_session; 9struct perf_session;
10union perf_event; 10union perf_event;
11struct perf_evlist; 11struct perf_evlist;
12struct perf_evsel; 12struct evsel;
13struct perf_sample; 13struct perf_sample;
14struct perf_tool; 14struct perf_tool;
15struct machine; 15struct machine;
@@ -17,7 +17,7 @@ struct ordered_events;
17 17
18typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event, 18typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event,
19 struct perf_sample *sample, 19 struct perf_sample *sample,
20 struct perf_evsel *evsel, struct machine *machine); 20 struct evsel *evsel, struct machine *machine);
21 21
22typedef int (*event_op)(struct perf_tool *tool, union perf_event *event, 22typedef int (*event_op)(struct perf_tool *tool, union perf_event *event,
23 struct perf_sample *sample, struct machine *machine); 23 struct perf_sample *sample, struct machine *machine);
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c
index 251bbf124fb0..9f098db76e3c 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->nr_entries == 1) { 73 if (top->evlist->nr_entries == 1) {
74 struct perf_evsel *first = perf_evlist__first(top->evlist); 74 struct evsel *first = perf_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->attr.sample_period, 76 (uint64_t)first->attr.sample_period,
77 opts->freq ? "Hz" : ""); 77 opts->freq ? "Hz" : "");
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 19f95eaf75c8..7e0f363c0658 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -10,7 +10,7 @@
10#include <sys/ioctl.h> 10#include <sys/ioctl.h>
11 11
12struct perf_evlist; 12struct perf_evlist;
13struct perf_evsel; 13struct evsel;
14struct perf_session; 14struct perf_session;
15 15
16struct perf_top { 16struct perf_top {
@@ -33,7 +33,7 @@ struct perf_top {
33 bool vmlinux_warned; 33 bool vmlinux_warned;
34 bool dump_symtab; 34 bool dump_symtab;
35 struct hist_entry *sym_filter_entry; 35 struct hist_entry *sym_filter_entry;
36 struct perf_evsel *sym_evsel; 36 struct evsel *sym_evsel;
37 struct perf_session *session; 37 struct perf_session *session;
38 struct winsize winsize; 38 struct winsize winsize;
39 int realtime_prio; 39 int realtime_prio;
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 4550015b9d5d..d7ae0627ac47 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -405,7 +405,7 @@ static struct tracepoint_path *
405get_tracepoints_path(struct list_head *pattrs) 405get_tracepoints_path(struct list_head *pattrs)
406{ 406{
407 struct tracepoint_path path, *ppath = &path; 407 struct tracepoint_path path, *ppath = &path;
408 struct perf_evsel *pos; 408 struct evsel *pos;
409 int nr_tracepoints = 0; 409 int nr_tracepoints = 0;
410 410
411 list_for_each_entry(pos, pattrs, node) { 411 list_for_each_entry(pos, pattrs, node) {
@@ -441,7 +441,7 @@ next:
441 441
442bool have_tracepoints(struct list_head *pattrs) 442bool have_tracepoints(struct list_head *pattrs)
443{ 443{
444 struct perf_evsel *pos; 444 struct evsel *pos;
445 445
446 list_for_each_entry(pos, pattrs, node) 446 list_for_each_entry(pos, pattrs, node)
447 if (pos->attr.type == PERF_TYPE_TRACEPOINT) 447 if (pos->attr.type == PERF_TYPE_TRACEPOINT)
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index ba58f69777a1..dfd2640c763a 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -29,7 +29,7 @@ static int stop_script_unsupported(void)
29 29
30static void process_event_unsupported(union perf_event *event __maybe_unused, 30static void process_event_unsupported(union perf_event *event __maybe_unused,
31 struct perf_sample *sample __maybe_unused, 31 struct perf_sample *sample __maybe_unused,
32 struct perf_evsel *evsel __maybe_unused, 32 struct evsel *evsel __maybe_unused,
33 struct addr_location *al __maybe_unused) 33 struct addr_location *al __maybe_unused)
34{ 34{
35} 35}
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index c7002fe11673..258d79071d81 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -79,13 +79,13 @@ struct scripting_ops {
79 int (*stop_script) (void); 79 int (*stop_script) (void);
80 void (*process_event) (union perf_event *event, 80 void (*process_event) (union perf_event *event,
81 struct perf_sample *sample, 81 struct perf_sample *sample,
82 struct perf_evsel *evsel, 82 struct evsel *evsel,
83 struct addr_location *al); 83 struct addr_location *al);
84 void (*process_switch)(union perf_event *event, 84 void (*process_switch)(union perf_event *event,
85 struct perf_sample *sample, 85 struct perf_sample *sample,
86 struct machine *machine); 86 struct machine *machine);
87 void (*process_stat)(struct perf_stat_config *config, 87 void (*process_stat)(struct perf_stat_config *config,
88 struct perf_evsel *evsel, u64 tstamp); 88 struct evsel *evsel, u64 tstamp);
89 void (*process_stat_interval)(u64 tstamp); 89 void (*process_stat_interval)(u64 tstamp);
90 int (*generate_script) (struct tep_handle *pevent, const char *outfile); 90 int (*generate_script) (struct tep_handle *pevent, const char *outfile);
91}; 91};