]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf tool: Remove evsel from tool APIs that pass the sample
authorIan Rogers <irogers@google.com>
Wed, 20 May 2026 19:05:07 +0000 (12:05 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 May 2026 19:34:23 +0000 (16:34 -0300)
As struct perf_sample now directly contains its own resolved evsel pointer,
passing the evsel separately is redundant and clutters the interface.

Remove the redundant evsel parameter from tool-specific handlers and
structures, ensuring the tool always directly accesses the evsel bound to the
sample. This simplifies the API signatures and eliminates the risk of passing
an inconsistent evsel.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: Anup Patel <anup@brainfault.org>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chen Ni <nichen@iscas.ac.cn>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Derek Foreman <derek.foreman@collabora.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Hrishikesh Suresh <hrishikesh123s@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Krzysztof Ɓopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quan Zhou <zhouquan@iscas.ac.cn>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Yujie Liu <yujie.liu@intel.com>
Cc: tanze <tanze@kylinos.cn>
[ Fixed up conflict with "perf inject: Fix itrace branch stack synthesis" series ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
24 files changed:
tools/perf/builtin-annotate.c
tools/perf/builtin-c2c.c
tools/perf/builtin-diff.c
tools/perf/builtin-inject.c
tools/perf/builtin-kmem.c
tools/perf/builtin-kvm.c
tools/perf/builtin-kwork.c
tools/perf/builtin-lock.c
tools/perf/builtin-mem.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-script.c
tools/perf/builtin-timechart.c
tools/perf/builtin-trace.c
tools/perf/util/build-id.c
tools/perf/util/build-id.h
tools/perf/util/data-convert-bt.c
tools/perf/util/data-convert-json.c
tools/perf/util/intel-tpebs.c
tools/perf/util/jitdump.c
tools/perf/util/session.c
tools/perf/util/tool.c
tools/perf/util/tool.h

index 5e57b78548f4210d26230eec3688d372141dd5ac..58e56f826367d6c0eb03896315361f1e3450540f 100644 (file)
@@ -283,7 +283,6 @@ static int evsel__add_sample(struct evsel *evsel, struct perf_sample *sample,
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct perf_annotate *ann = container_of(tool, struct perf_annotate, tool);
@@ -302,7 +301,7 @@ static int process_sample_event(const struct perf_tool *tool,
                goto out_put;
 
        if (!al.filtered &&
-           evsel__add_sample(evsel, sample, &al, ann, machine)) {
+           evsel__add_sample(sample->evsel, sample, &al, ann, machine)) {
                pr_warning("problem incrementing symbol count, "
                           "skipping event\n");
                ret = -1;
index 72a7802775ee965fec74bfa82bf74f2a65cead20..7593e5908fcce9d6de80f59994943619b01977b9 100644 (file)
@@ -314,9 +314,9 @@ static void perf_c2c__evsel_hists_inc_stats(struct evsel *evsel,
 static int process_sample_event(const struct perf_tool *tool __maybe_unused,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        struct c2c_hists *c2c_hists = &c2c.hists;
        struct c2c_hist_entry *c2c_he;
        struct c2c_stats stats = { .nr_entries = 0, };
index 1b3df868849a99c0af986cf04461521439c4e906..82e9e514922bd50524d903c9df72dd23ed44ae76 100644 (file)
@@ -390,11 +390,11 @@ static struct hist_entry_ops block_hist_ops = {
 static int diff__process_sample_event(const struct perf_tool *tool,
                                      union perf_event *event,
                                      struct perf_sample *sample,
-                                     struct evsel *evsel,
                                      struct machine *machine)
 {
        struct perf_diff *pdiff = container_of(tool, struct perf_diff, tool);
        struct addr_location al;
+       struct evsel *evsel = sample->evsel;
        struct hists *hists = evsel__hists(evsel);
        struct hist_entry_iter iter = {
                .evsel  = evsel,
index 7a64935b7e2b0ba44aaa35a731fed73493a1e1ef..e8cf8d399528f0178118e3de4798a82a0e531fbc 100644 (file)
@@ -403,11 +403,10 @@ typedef int (*inject_handler)(const struct perf_tool *tool,
 static int perf_event__repipe_sample(const struct perf_tool *tool,
                                     union perf_event *event,
                                     struct perf_sample *sample,
-                                    struct evsel *evsel,
                                     struct machine *machine)
 {
-       struct perf_inject *inject = container_of(tool, struct perf_inject,
-                                                 tool);
+       struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
+       struct evsel *evsel = sample->evsel;
 
        if (evsel == NULL)
                return perf_event__repipe_synth(tool, event);
@@ -417,7 +416,7 @@ static int perf_event__repipe_sample(const struct perf_tool *tool,
                return f(tool, event, sample, evsel, machine);
        }
 
-       build_id__mark_dso_hit(tool, event, sample, evsel, machine);
+       build_id__mark_dso_hit(tool, event, sample, machine);
 
        if (inject->itrace_synth_opts.set &&
            (inject->itrace_synth_opts.last_branch ||
@@ -491,10 +490,10 @@ static int perf_event__repipe_sample(const struct perf_tool *tool,
 static int perf_event__convert_sample_callchain(const struct perf_tool *tool,
                                                union perf_event *event,
                                                struct perf_sample *sample,
-                                               struct evsel *evsel,
                                                struct machine *machine)
 {
        struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
+       struct evsel *evsel = sample->evsel;
        struct callchain_cursor *cursor = get_tls_callchain_cursor();
        union perf_event *event_copy = (void *)inject->event_copy;
        struct callchain_cursor_node *node;
@@ -1100,10 +1099,8 @@ static int mark_dso_hit_callback(struct callchain_cursor_node *node, void *data)
                            args->mmap_evsel, map, /*sample_in_dso=*/false);
 }
 
-int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
-                              struct perf_sample *sample,
-                              struct evsel *evsel __maybe_unused,
-                              struct machine *machine)
+static int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
+                                     struct perf_sample *sample, struct machine *machine)
 {
        struct addr_location al;
        struct thread *thread;
@@ -1133,7 +1130,7 @@ int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *e
                             /*sample_in_dso=*/true);
        }
 
-       sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
+       sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_STACK_DEPTH,
                                        /*symbols=*/false, mark_dso_hit_callback, &args);
        thread__put(thread);
 repipe:
@@ -1215,7 +1212,7 @@ found:
        perf_event__synthesize_sample(event_sw, evsel->core.attr.sample_type,
                                      evsel->core.attr.read_format,
                                      evsel->core.attr.branch_sample_type, &sample_sw);
-       build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
+       build_id__mark_dso_hit(tool, event_sw, &sample_sw, machine);
        ret = perf_event__repipe(tool, event_sw, &sample_sw, machine);
        perf_sample__exit(&sample_sw);
        return ret;
index 9c64a0d7482378cc2fe2f7081a00a8ab91e2fa4f..45b383fa9ce92fa688ebe598b154b7ece2700017 100644 (file)
@@ -960,9 +960,9 @@ typedef int (*tracepoint_handler)(struct evsel *evsel,
 static int process_sample_event(const struct perf_tool *tool __maybe_unused,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        int err = 0;
        struct thread *thread = machine__findnew_thread(machine, sample->pid,
                                                        sample->tid);
index 0c5e6b3aac74dec5d3eee7789cb46890da8d338d..5e8e6fde097a51094df0533db846cfd8172e1943 100644 (file)
@@ -941,9 +941,9 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread,
 
 static bool handle_kvm_event(struct perf_kvm_stat *kvm,
                             struct thread *thread,
-                            struct evsel *evsel,
                             struct perf_sample *sample)
 {
+       struct evsel *evsel = sample->evsel;
        struct vcpu_event_record *vcpu_record;
        struct event_key key = { .key = INVALID_KEY,
                                 .exit_reasons = kvm->exit_reasons };
@@ -1133,7 +1133,6 @@ static bool skip_sample(struct perf_kvm_stat *kvm,
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        int err = 0;
@@ -1156,7 +1155,7 @@ static int process_sample_event(const struct perf_tool *tool,
                return -1;
        }
 
-       if (!handle_kvm_event(kvm, thread, evsel, sample))
+       if (!handle_kvm_event(kvm, thread, sample))
                err = -1;
 
        thread__put(thread);
index 9d3a4c779a41e383f8321d1a151fc09712f38712..d4bb19ed91b59bb5c12addf752ac3c2db7933315 100644 (file)
@@ -1955,9 +1955,9 @@ typedef int (*tracepoint_handler)(const struct perf_tool *tool,
 static int perf_kwork__process_tracepoint_sample(const struct perf_tool *tool,
                                                 union perf_event *event __maybe_unused,
                                                 struct perf_sample *sample,
-                                                struct evsel *evsel,
                                                 struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        int err = 0;
 
        if (evsel->handler != NULL) {
index 5585aeb97684dd36178405c74fe92c4f592b6446..4d8ddf6391e87f0a1423e369544bae868d5f9b87 100644 (file)
@@ -1430,9 +1430,9 @@ typedef int (*tracepoint_handler)(struct evsel *evsel,
 static int process_sample_event(const struct perf_tool *tool __maybe_unused,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        int err = 0;
        struct thread *thread = machine__findnew_thread(machine, sample->pid,
                                                        sample->tid);
index d43500b92a7b9f3c76955c3b6779de1100cd6558..6101a26b3a781e69b0fe44db6158e2db9f111a58 100644 (file)
@@ -255,7 +255,6 @@ out_put:
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel __maybe_unused,
                                struct machine *machine)
 {
        return dump_raw_samples(tool, event, sample, machine);
index 272bba7f4b9ec7ee32a1debf98eb3a21fe9655c1..cc601796b2c8ae6026ebbc9220435665bd655018 100644 (file)
@@ -1490,7 +1490,6 @@ static void set_timestamp_boundary(struct record *rec, u64 sample_time)
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct record *rec = container_of(tool, struct record, tool);
@@ -1501,7 +1500,7 @@ static int process_sample_event(const struct perf_tool *tool,
                return 0;
 
        rec->samples++;
-       return build_id__mark_dso_hit(tool, event, sample, evsel, machine);
+       return build_id__mark_dso_hit(tool, event, sample, machine);
 }
 
 static int process_buildids(struct record *rec)
index 0b0966d94128ee479ea47139ea2c64f63a9d214e..9955ce8cce00bdb92e97590ed1fddd17b6b1194c 100644 (file)
@@ -265,10 +265,10 @@ static int process_feature_event(const struct perf_tool *tool,
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct report *rep = container_of(tool, struct report, tool);
+       struct evsel *evsel = sample->evsel;
        struct addr_location al;
        struct hist_entry_iter iter = {
                .evsel                  = evsel,
@@ -345,7 +345,6 @@ out_put:
 static int process_read_event(const struct perf_tool *tool,
                              union perf_event *event,
                              struct perf_sample *sample __maybe_unused,
-                             struct evsel *evsel,
                              struct machine *machine __maybe_unused)
 {
        struct report *rep = container_of(tool, struct report, tool);
@@ -353,7 +352,7 @@ static int process_read_event(const struct perf_tool *tool,
        if (rep->show_threads) {
                int err = perf_read_values_add_value(&rep->show_threads_values,
                                           event->read.pid, event->read.tid,
-                                          evsel,
+                                          sample->evsel,
                                           event->read.value);
 
                if (err)
@@ -779,11 +778,10 @@ static void report__output_resort(struct report *rep)
 
 static int count_sample_event(const struct perf_tool *tool __maybe_unused,
                              union perf_event *event __maybe_unused,
-                             struct perf_sample *sample __maybe_unused,
-                             struct evsel *evsel,
+                             struct perf_sample *sample,
                              struct machine *machine __maybe_unused)
 {
-       struct hists *hists = evsel__hists(evsel);
+       struct hists *hists = evsel__hists(sample->evsel);
 
        hists__inc_nr_events(hists);
        return 0;
index 53a93aa18853e43476d133c86c11fa4b1bfb5de8..2950c5c3026ef49abeab9b24857ab08f7cb85276 100644 (file)
@@ -1867,9 +1867,9 @@ typedef int (*tracepoint_handler)(const struct perf_tool *tool,
 static int perf_sched__process_tracepoint_sample(const struct perf_tool *tool __maybe_unused,
                                                 union perf_event *event __maybe_unused,
                                                 struct perf_sample *sample,
-                                                struct evsel *evsel,
                                                 struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        int err = 0;
 
        if (evsel->handler != NULL) {
@@ -3184,10 +3184,10 @@ typedef int (*sched_handler)(const struct perf_tool *tool,
 static int perf_timehist__process_sample(const struct perf_tool *tool,
                                         union perf_event *event,
                                         struct perf_sample *sample,
-                                        struct evsel *evsel,
                                         struct machine *machine)
 {
        struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
+       struct evsel *evsel = sample->evsel;
        int err = 0;
        struct perf_cpu this_cpu = {
                .cpu = sample->cpu,
index fd0b4609516b3e1a83bc582b0ec85e39096434b3..d4e8f49a875185e3b5428c128ea0fcf2757e23dc 100644 (file)
@@ -2646,10 +2646,10 @@ static bool filter_cpu(struct perf_sample *sample)
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct perf_script *scr = container_of(tool, struct perf_script, tool);
+       struct evsel *evsel = sample->evsel;
        struct addr_location al;
        struct addr_location addr_al;
        int ret = 0;
@@ -2730,10 +2730,10 @@ out_put:
 static int process_deferred_sample_event(const struct perf_tool *tool,
                                         union perf_event *event,
                                         struct perf_sample *sample,
-                                        struct evsel *evsel,
                                         struct machine *machine)
 {
        struct perf_script *scr = container_of(tool, struct perf_script, tool);
+       struct evsel *evsel = sample->evsel;
        struct perf_event_attr *attr = &evsel->core.attr;
        struct evsel_script *es = evsel->priv;
        unsigned int type = output_type(attr->type);
index 28f33e39895d362d57683c7d3a86a1a7957f32df..8692d11ccd299ebf79ce5d19e984cbd34b2edfbd 100644 (file)
@@ -574,10 +574,10 @@ typedef int (*tracepoint_handler)(struct timechart *tchart,
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct timechart *tchart = container_of(tool, struct timechart, tool);
+       struct evsel *evsel = sample->evsel;
 
        if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) {
                if (!tchart->first_time || tchart->first_time > sample->time)
index e9cc870a5acda45d415a816839dc9aab884011de..1aafa77f72cfc98820e766360f06dd31aeb21344 100644 (file)
@@ -3501,10 +3501,10 @@ static void trace__set_base_time(struct trace *trace,
 static int trace__process_sample(const struct perf_tool *tool,
                                 union perf_event *event,
                                 struct perf_sample *sample,
-                                struct evsel *evsel,
                                 struct machine *machine __maybe_unused)
 {
        struct trace *trace = container_of(tool, struct trace, tool);
+       struct evsel *evsel = sample->evsel;
        struct thread *thread;
        int err = 0;
 
index fdb35133fde43a1d295f64e71249243cf0b1b635..55b72235f89184c42435655c1abd3c24e157bc4f 100644 (file)
@@ -55,7 +55,6 @@ static int mark_dso_hit_callback(struct callchain_cursor_node *node, void *data
 int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
                           union perf_event *event,
                           struct perf_sample *sample,
-                          struct evsel *evsel,
                           struct machine *machine)
 {
        struct addr_location al;
@@ -74,7 +73,7 @@ int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
 
        addr_location__exit(&al);
 
-       sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
+       sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_STACK_DEPTH,
                                        /*symbols=*/false, mark_dso_hit_callback, /*data=*/NULL);
 
 
index 47e621cebe1b712925d1cdc7b7676b94ec14d467..73bad90b06f9308592210809519c1bc8a9f588e0 100644 (file)
@@ -34,12 +34,7 @@ char *__dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
                               bool is_debug, bool is_kallsyms);
 
 int build_id__mark_dso_hit(const struct perf_tool *tool, union perf_event *event,
-                          struct perf_sample *sample, struct evsel *evsel,
-                          struct machine *machine);
-
-int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
-                              struct perf_sample *sample, struct evsel *evsel,
-                              struct machine *machine);
+                          struct perf_sample *sample, struct machine *machine);
 
 bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
 int perf_session__write_buildid_table(struct perf_session *session,
index 3b8f2df823a9b7900997e7a6061f6a78d5fc84b5..b3f745cff2a75d9e2cb78889a48f7c17c7ded9e9 100644 (file)
@@ -803,10 +803,10 @@ static bool is_flush_needed(struct ctf_stream *cs)
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *_event,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine __maybe_unused)
 {
        struct convert *c = container_of(tool, struct convert, tool);
+       struct evsel *evsel = sample->evsel;
        struct evsel_priv *priv = evsel->priv;
        struct ctf_writer *cw = &c->writer;
        struct ctf_stream *cs;
index d526c91312ed8b93388a05df8d08aa5eb4ac51ca..a7da93a7ff0e6b4ae61057b66b917bf7e627d2c8 100644 (file)
@@ -159,13 +159,12 @@ static void output_sample_callchain_entry(const struct perf_tool *tool,
 static int process_sample_event(const struct perf_tool *tool,
                                union perf_event *event __maybe_unused,
                                struct perf_sample *sample,
-                               struct evsel *evsel __maybe_unused,
                                struct machine *machine)
 {
        struct convert_json *c = container_of(tool, struct convert_json, tool);
        FILE *out = c->out;
        struct addr_location al;
-       u64 sample_type = __evlist__combined_sample_type(evsel->evlist);
+       u64 sample_type = __evlist__combined_sample_type(sample->evsel->evlist);
        u8 cpumode = PERF_RECORD_MISC_USER;
 
        addr_location__init(&al);
@@ -245,7 +244,7 @@ static int process_sample_event(const struct perf_tool *tool,
 
 #ifdef HAVE_LIBTRACEEVENT
        if (sample->raw_data) {
-               struct tep_event *tp_format = evsel__tp_format(evsel);
+               struct tep_event *tp_format = evsel__tp_format(sample->evsel);
                struct tep_format_field **fields = tp_format ? tep_event_fields(tp_format) : NULL;
 
                if (fields) {
index 8b615dc94e9ea34aabc74dc412ab594637a414b1..ed8cfe2ba2fae651e41cce40b5acd3184e7a8d22 100644 (file)
@@ -185,7 +185,6 @@ static bool should_ignore_sample(const struct perf_sample *sample, const struct
 static int process_sample_event(const struct perf_tool *tool __maybe_unused,
                                union perf_event *event __maybe_unused,
                                struct perf_sample *sample,
-                               struct evsel *evsel,
                                struct machine *machine __maybe_unused)
 {
        struct tpebs_retire_lat *t;
@@ -196,7 +195,7 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
                mutex_unlock(tpebs_mtx_get());
                return 0;
        }
-       t = tpebs_retire_lat__find(evsel);
+       t = tpebs_retire_lat__find(sample->evsel);
        if (!t) {
                mutex_unlock(tpebs_mtx_get());
                return -EINVAL;
index e0ce8b904729836291764274fe27f30d68a901b8..52e6ffac2b3e1039d0e6242fc73d7053ae1608f9 100644 (file)
@@ -642,7 +642,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)
 
        ret = jit_inject_event(jd, event);
        if (!ret)
-               build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine);
+               build_id__mark_dso_hit(tool, event, &sample, jd->machine);
 out:
        perf_sample__exit(&sample);
        return ret;
index fe0de2a0277f09f927f7b90413f02351e5ce6a5c..1e25892963b7857a3bfa21f771f5a7f0b7a66053 100644 (file)
@@ -1117,9 +1117,10 @@ char *get_page_size_name(u64 size, char *str)
        return str;
 }
 
-static void dump_sample(struct machine *machine, struct evsel *evsel, union perf_event *event,
+static void dump_sample(struct machine *machine, union perf_event *event,
                        struct perf_sample *sample)
 {
+       struct evsel *evsel = sample->evsel;
        u64 sample_type;
        char str[PAGE_SIZE_NAME_LEN];
        uint16_t e_machine = EM_NONE;
@@ -1183,9 +1184,10 @@ static void dump_sample(struct machine *machine, struct evsel *evsel, union perf
                sample_read__printf(sample, evsel->core.attr.read_format);
 }
 
-static void dump_deferred_callchain(struct evsel *evsel, union perf_event *event,
-                                   struct perf_sample *sample)
+static void dump_deferred_callchain(union perf_event *event, struct perf_sample *sample)
 {
+       struct evsel *evsel = sample->evsel;
+
        if (!dump_trace)
                return;
 
@@ -1291,7 +1293,7 @@ static int deliver_sample_value(struct evlist *evlist,
                return 0;
 
        sample->evsel = container_of(sid->evsel, struct evsel, core);
-       ret = tool->sample(tool, event, sample, sample->evsel, machine);
+       ret = tool->sample(tool, event, sample, machine);
        sample->evsel = saved_evsel;
        return ret;
 }
@@ -1323,8 +1325,9 @@ static int deliver_sample_group(struct evlist *evlist,
 
 static int evlist__deliver_sample(struct evlist *evlist, const struct perf_tool *tool,
                                  union  perf_event *event, struct perf_sample *sample,
-                                 struct evsel *evsel, struct machine *machine)
+                                 struct machine *machine)
 {
+       struct evsel *evsel = sample->evsel;
        /* We know evsel != NULL. */
        u64 sample_type = evsel->core.attr.sample_type;
        u64 read_format = evsel->core.attr.read_format;
@@ -1332,7 +1335,7 @@ static int evlist__deliver_sample(struct evlist *evlist, const struct perf_tool
 
        /* Standard sample delivery. */
        if (!(sample_type & PERF_SAMPLE_READ))
-               return tool->sample(tool, event, sample, evsel, machine);
+               return tool->sample(tool, event, sample, machine);
 
        /* For PERF_SAMPLE_READ we have either single or group mode. */
        if (read_format & PERF_FORMAT_GROUP)
@@ -1371,8 +1374,7 @@ static int evlist__deliver_deferred_callchain(struct evlist *evlist,
                struct evsel *saved_evsel = sample->evsel;
 
                sample->evsel = evlist__id2evsel(evlist, sample->id);
-               ret = tool->callchain_deferred(tool, event, sample,
-                                              sample->evsel, machine);
+               ret = tool->callchain_deferred(tool, event, sample, machine);
                sample->evsel = saved_evsel;
                return ret;
        }
@@ -1400,7 +1402,7 @@ static int evlist__deliver_deferred_callchain(struct evlist *evlist,
 
                orig_sample.evsel = evlist__id2evsel(evlist, orig_sample.id);
                ret = evlist__deliver_sample(evlist, tool, de->event,
-                                            &orig_sample, orig_sample.evsel, machine);
+                                            &orig_sample, machine);
 
                perf_sample__exit(&orig_sample);
                list_del(&de->list);
@@ -1438,7 +1440,7 @@ static int session__flush_deferred_samples(struct perf_session *session,
 
                sample.evsel = evlist__id2evsel(evlist, sample.id);
                ret = evlist__deliver_sample(evlist, tool, de->event,
-                                            &sample, sample.evsel, machine);
+                                            &sample, machine);
 
                perf_sample__exit(&sample);
                list_del(&de->list);
@@ -1458,7 +1460,6 @@ static int machines__deliver_event(struct machines *machines,
                                   const struct perf_tool *tool, u64 file_offset,
                                   const char *file_path)
 {
-       struct evsel *evsel;
        struct machine *machine;
 
        dump_event(evlist, event, file_offset, sample, file_path);
@@ -1468,21 +1469,20 @@ static int machines__deliver_event(struct machines *machines,
        else
                assert(sample->evsel == evlist__id2evsel(evlist, sample->id));
 
-       evsel = sample->evsel;
        machine = machines__find_for_cpumode(machines, event, sample);
 
        switch (event->header.type) {
        case PERF_RECORD_SAMPLE:
-               if (evsel == NULL) {
+               if (sample->evsel == NULL) {
                        ++evlist->stats.nr_unknown_id;
                        return 0;
                }
                if (machine == NULL) {
                        ++evlist->stats.nr_unprocessable_samples;
-                       dump_sample(machine, evsel, event, sample);
+                       dump_sample(machine, event, sample);
                        return 0;
                }
-               dump_sample(machine, evsel, event, sample);
+               dump_sample(machine, event, sample);
                if (sample->deferred_callchain && tool->merge_deferred_callchains) {
                        struct deferred_event *de = malloc(sizeof(*de));
                        size_t sz = event->header.size;
@@ -1499,7 +1499,7 @@ static int machines__deliver_event(struct machines *machines,
                        list_add_tail(&de->list, &evlist->deferred_samples);
                        return 0;
                }
-               return evlist__deliver_sample(evlist, tool, event, sample, evsel, machine);
+               return evlist__deliver_sample(evlist, tool, event, sample, machine);
        case PERF_RECORD_MMAP:
                return tool->mmap(tool, event, sample, machine);
        case PERF_RECORD_MMAP2:
@@ -1527,8 +1527,8 @@ static int machines__deliver_event(struct machines *machines,
                        evlist->stats.total_lost_samples += event->lost_samples.lost;
                return tool->lost_samples(tool, event, sample, machine);
        case PERF_RECORD_READ:
-               dump_read(evsel, event);
-               return tool->read(tool, event, sample, evsel, machine);
+               dump_read(sample->evsel, event);
+               return tool->read(tool, event, sample, machine);
        case PERF_RECORD_THROTTLE:
                return tool->throttle(tool, event, sample, machine);
        case PERF_RECORD_UNTHROTTLE:
@@ -1557,7 +1557,7 @@ static int machines__deliver_event(struct machines *machines,
        case PERF_RECORD_AUX_OUTPUT_HW_ID:
                return tool->aux_output_hw_id(tool, event, sample, machine);
        case PERF_RECORD_CALLCHAIN_DEFERRED:
-               dump_deferred_callchain(evsel, event, sample);
+               dump_deferred_callchain(event, sample);
                return evlist__deliver_deferred_callchain(evlist, tool, event,
                                                          sample, machine);
        default:
index ff2150517b75587a4a804c15900ce4ce1ab753e7..225a77d530ce8ab3b01f612250fc1b5ec64ff16f 100644 (file)
@@ -110,7 +110,6 @@ static int process_event_synth_event_update_stub(const struct perf_tool *tool __
 int process_event_sample_stub(const struct perf_tool *tool __maybe_unused,
                              union perf_event *event __maybe_unused,
                              struct perf_sample *sample __maybe_unused,
-                             struct evsel *evsel __maybe_unused,
                              struct machine *machine __maybe_unused)
 {
        dump_printf(": unhandled!\n");
@@ -349,12 +348,11 @@ bool perf_tool__compressed_is_stub(const struct perf_tool *tool)
        static int delegate_ ## name(const struct perf_tool *tool, \
                                     union perf_event *event, \
                                     struct perf_sample *sample, \
-                                    struct evsel *evsel, \
                                     struct machine *machine) \
        {                                                               \
                struct delegate_tool *del_tool = container_of(tool, struct delegate_tool, tool); \
                struct perf_tool *delegate = del_tool->delegate;                \
-               return delegate->name(delegate, event, sample, evsel, machine); \
+               return delegate->name(delegate, event, sample, machine);        \
        }
 CREATE_DELEGATE_SAMPLE(read);
 CREATE_DELEGATE_SAMPLE(sample);
index 2d9a4b1ca9d0fad5359ebc42f36ff572c69b0bc3..2a4f124ffd8d158727050d1dd88405e5ab63f922 100644 (file)
@@ -9,7 +9,6 @@
 struct perf_session;
 union perf_event;
 struct evlist;
-struct evsel;
 struct perf_sample;
 struct perf_tool;
 struct machine;
@@ -17,7 +16,7 @@ struct ordered_events;
 
 typedef int (*event_sample)(const struct perf_tool *tool, union perf_event *event,
                            struct perf_sample *sample,
-                           struct evsel *evsel, struct machine *machine);
+                           struct machine *machine);
 
 typedef int (*event_op)(const struct perf_tool *tool, union perf_event *event,
                        struct perf_sample *sample, struct machine *machine);
@@ -103,7 +102,6 @@ bool perf_tool__compressed_is_stub(const struct perf_tool *tool);
 int process_event_sample_stub(const struct perf_tool *tool,
                              union perf_event *event,
                              struct perf_sample *sample,
-                             struct evsel *evsel,
                              struct machine *machine);
 
 struct delegate_tool {