From nobody Wed Feb 11 02:06:34 2026 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A6A038884A for ; Mon, 9 Feb 2026 17:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658852; cv=none; b=qMqSxPrqD0AUrkI5HTkcJx72Lua/NZ4CMBZUEpWwQGGt4oBxkJMrjlWE8DlrF7aOnATyIk3RlSyTZlgNVtT1GDfhcZdcqQQkXBUNYMJyTVFuR8/DjV5MfhXNWegrnmQVpQRjSJPO6tJw7ziDzhv6NU1GeAMrh87dBaWrG6O2mXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658852; c=relaxed/simple; bh=HNEiiWhnUQLxdtAE4GnbQ73uA/8MYEy1ucU62v4DuOs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=L1GLt+DNrPw0HugR1lRV9YhzWFiOXC5uhXuCVR/OI64/DwKhonsCJgsF/78TOz66JqxFOT/RrLYdiNhwA2S/vrPz3IquRCMWZ4dTzvXl/JVCcHBdPLUMLCj0cZh46UfX/HiPBpSNUEySWJJqPOHZgXcOBIrWfHBRCeq3QDJkOlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TNPXyHmR; arc=none smtp.client-ip=74.125.82.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TNPXyHmR" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2b9ea5408fbso1301219eec.1 for ; Mon, 09 Feb 2026 09:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770658852; x=1771263652; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ErWOZTTtdJxWa/jtgCcLmtuouqonO/2dAlUFfZo9s/Q=; b=TNPXyHmRpw+TmdGw2OagD9NW+rBGrSMBQVx0iJ60xa0RulNfqknSQ1Nz8nfZx8JhPZ EInR8vK8SkHUFpxO39Abf7UmaA4+3OY2rnuLJEb97jfn0jC93KBUebThwLHOdqL0bbjy Mi9O0sqMmYngRTmzG3TtYR7Z8KTXNO062EZ7yxIg8OcacetLcUS9YH+885xXj6ZnmRxY gb06DsUI/d1GbXnsgTAq3vHJosVvdHGR7Le7j+gDZV5DOg2ZdEX6NSQfIN9pNKKgg3Jo b558y9gPNvtK0+UbURFRy1lCA/JI4iAaMEwbX7Uv1x32a/mSGihcwC+N18UMnuRnxvo4 EdcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770658852; x=1771263652; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ErWOZTTtdJxWa/jtgCcLmtuouqonO/2dAlUFfZo9s/Q=; b=bHACh9uPYVpqE87oVAxtmdvB4dPuk2/A9q/+g5Z5SmxJN0m4QZynr09FE1b5CR5rch epycXXKv+qz2TwtlKk47pr5jYeoSK/+UydEhsUT+kkm1gv6G3t+NiyzIBYEUoDv5AoR6 RRi8IscmSdfnZHNhmc/uEggsvbyKaZpAxOKDj28bfHlquTD3kVjhyJl2GdhoBeOuzqOa O8cvEYcjKyon7rC2kUg/+vGpI2D6qr4YH34oW5Vtd00tfIgMM2MSYKoZkkWekMIOlnGg 99uLbLD6JhBIq69SO/UYSEsr3X7RoIAuI8Ew6Epe/xvjWxOSnNrTwRFD+710ufXQt5SZ CQog== X-Forwarded-Encrypted: i=1; AJvYcCUDtviduV/JJ8ysqUCBoz97BFE0wh9CnupSgOHvnRnc+qczhZXPFxHab/lc4yJji3r/LrvFzFUwRlU4Q2Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzASf1bSDP+79Y5240SyHla98Z4YjCncJl99vZNokmkF9krhamL QQkwFXeFydsedxylA2SJ4i8pboOVJ/EacclK7vLZ8UXFUzDjtGJeUqIVnPTq7bRrw1iYC0wtdai CGEZ3bOturA== X-Received: from dlbcm19.prod.google.com ([2002:a05:7022:6893:b0:123:35cc:b60f]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:3c0e:b0:2b8:1d16:9726 with SMTP id 5a478bee46e88-2b856830f07mr5632296eec.31.1770658851558; Mon, 09 Feb 2026 09:40:51 -0800 (PST) Date: Mon, 9 Feb 2026 09:40:11 -0800 In-Reply-To: <20260209174032.4142096-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260209174032.4142096-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260209174032.4142096-5-irogers@google.com> Subject: [PATCH v1 04/25] perf tool: Remove evsel from tool APIs that pass the sample From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Leo Yan , Tianyou Li , Athira Rajeev , Derek Foreman , Thomas Falcon , Howard Chu , Dmitry Vyukov , Andi Kleen , tanze , Hrishikesh Suresh , Quan Zhou , Andrew Jones , Anup Patel , Dapeng Mi , "Dr. David Alan Gilbert" , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , Chun-Tse Shao , Ravi Bangoria , Swapnil Sapkal , Chen Ni , Blake Jones , Yujie Liu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now struct perf_sample has the evsel within it there is no need to pass the evsel along with the sample. In the called functions read the sample's evsel in to a variable if there are multiple uses, or use directly if there is just one use - the goal being to leave the code with as little change as possible. Some functions only use the evsel to pass to another function which they also pass the sample, in those cases just pass the sample and get the evsel in the called function. Signed-off-by: Ian Rogers --- tools/perf/builtin-annotate.c | 3 +-- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-inject.c | 19 ++++++--------- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 5 ++-- tools/perf/builtin-kwork.c | 2 +- tools/perf/builtin-lock.c | 2 +- tools/perf/builtin-mem.c | 1 - tools/perf/builtin-record.c | 3 +-- tools/perf/builtin-report.c | 10 +++----- tools/perf/builtin-sched.c | 4 +-- tools/perf/builtin-script.c | 4 +-- tools/perf/builtin-timechart.c | 2 +- tools/perf/builtin-trace.c | 2 +- tools/perf/util/build-id.c | 3 +-- tools/perf/util/build-id.h | 7 +----- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/data-convert-json.c | 5 ++-- tools/perf/util/intel-tpebs.c | 3 +-- tools/perf/util/jitdump.c | 2 +- tools/perf/util/session.c | 38 ++++++++++++++--------------- tools/perf/util/tool.c | 4 +-- tools/perf/util/tool.h | 4 +-- 24 files changed, 55 insertions(+), 76 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 9c27bb30b708..a4903e4ccdb5 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -284,7 +284,6 @@ static int evsel__add_sample(struct evsel *evsel, struc= t 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 =3D container_of(tool, struct perf_annotate, to= ol); @@ -303,7 +302,7 @@ static int process_sample_event(const struct perf_tool = *tool, goto out_put; =20 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 =3D -1; diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index d390ae4e3ec8..89456ba6fcbb 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -314,9 +314,9 @@ static void perf_c2c__evsel_hists_inc_stats(struct evse= l *evsel, static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { + struct evsel *evsel =3D sample->evsel; struct c2c_hists *c2c_hists =3D &c2c.hists; struct c2c_hist_entry *c2c_he; struct c2c_stats stats =3D { .nr_entries =3D 0, }; diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 59bf1f72d12e..793538ad3b4c 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -390,11 +390,11 @@ struct hist_entry_ops block_hist_ops =3D { 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 =3D container_of(tool, struct perf_diff, tool); struct addr_location al; + struct evsel *evsel =3D sample->evsel; struct hists *hists =3D evsel__hists(evsel); struct hist_entry_iter iter =3D { .evsel =3D evsel, diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 8ae76bf5253e..3c243dba6240 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -363,18 +363,17 @@ 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 =3D container_of(tool, struct perf_inject, - tool); + struct perf_inject *inject =3D container_of(tool, struct perf_inject, too= l); + struct evsel *evsel =3D sample->evsel; =20 if (evsel && evsel->handler) { inject_handler f =3D evsel->handler; return f(tool, event, sample, evsel, machine); } =20 - build_id__mark_dso_hit(tool, event, sample, evsel, machine); + build_id__mark_dso_hit(tool, event, sample, machine); =20 if (inject->itrace_synth_opts.set && sample->aux_sample.size) { event =3D perf_inject__cut_auxtrace_sample(inject, event, sample); @@ -388,10 +387,10 @@ static int perf_event__repipe_sample(const struct per= f_tool *tool, static int perf_event__convert_sample_callchain(const struct perf_tool *to= ol, union perf_event *event, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { struct perf_inject *inject =3D container_of(tool, struct perf_inject, too= l); + struct evsel *evsel =3D sample->evsel; struct callchain_cursor *cursor =3D get_tls_callchain_cursor(); union perf_event *event_copy =3D (void *)inject->event_copy; struct callchain_cursor_node *node; @@ -988,10 +987,8 @@ static int mark_dso_hit_callback(struct callchain_curs= or_node *node, void *data) args->mmap_evsel, map, /*sample_in_dso=3D*/false); } =20 -int perf_event__inject_buildid(const struct perf_tool *tool, union perf_ev= ent *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; @@ -1023,7 +1020,7 @@ int perf_event__inject_buildid(const struct perf_tool= *tool, union perf_event *e } =20 sample->evsel =3D inject__mmap_evsel(inject); - sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEP= TH, + sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_S= TACK_DEPTH, /*symbols=3D*/false, mark_dso_hit_callback, &args); sample->evsel =3D saved_evsel; thread__put(thread); @@ -1107,7 +1104,7 @@ static int perf_inject__sched_stat(const struct perf_= tool *tool, sample_sw.time =3D sample->time; perf_event__synthesize_sample(event_sw, evsel->core.attr.sample_type, evsel->core.attr.read_format, &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 =3D perf_event__repipe(tool, event_sw, &sample_sw, machine); perf_sample__exit(&sample_sw); return ret; diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 7929a5fa5f46..34852a4c3fc8 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -960,9 +960,9 @@ typedef int (*tracepoint_handler)(struct evsel *evsel, static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { + struct evsel *evsel =3D sample->evsel; int err =3D 0; struct thread *thread =3D machine__findnew_thread(machine, sample->pid, sample->tid); diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 0c5e6b3aac74..5e8e6fde097a 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -941,9 +941,9 @@ struct vcpu_event_record *per_vcpu_record(struct thread= *thread, =20 static bool handle_kvm_event(struct perf_kvm_stat *kvm, struct thread *thread, - struct evsel *evsel, struct perf_sample *sample) { + struct evsel *evsel =3D sample->evsel; struct vcpu_event_record *vcpu_record; struct event_key key =3D { .key =3D INVALID_KEY, .exit_reasons =3D 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 =3D 0; @@ -1156,7 +1155,7 @@ static int process_sample_event(const struct perf_too= l *tool, return -1; } =20 - if (!handle_kvm_event(kvm, thread, evsel, sample)) + if (!handle_kvm_event(kvm, thread, sample)) err =3D -1; =20 thread__put(thread); diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index 7f3068264568..1cf9fe22f234 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -1955,9 +1955,9 @@ typedef int (*tracepoint_handler)(const struct perf_t= ool *tool, static int perf_kwork__process_tracepoint_sample(const struct perf_tool *t= ool, union perf_event *event __maybe_unused, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { + struct evsel *evsel =3D sample->evsel; int err =3D 0; =20 if (evsel->handler !=3D NULL) { diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index e8962c985d34..dc8d1d3b4cd7 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1430,9 +1430,9 @@ typedef int (*tracepoint_handler)(struct evsel *evsel, static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { + struct evsel *evsel =3D sample->evsel; int err =3D 0; struct thread *thread =3D machine__findnew_thread(machine, sample->pid, sample->tid); diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index d43500b92a7b..6101a26b3a78 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -255,7 +255,6 @@ dump_raw_samples(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 __maybe_unused, struct machine *machine) { return dump_raw_samples(tool, event, sample, machine); diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 60d764068302..8aabe27b57a0 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1489,7 +1489,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 =3D container_of(tool, struct record, tool); @@ -1500,7 +1499,7 @@ static int process_sample_event(const struct perf_too= l *tool, return 0; =20 rec->samples++; - return build_id__mark_dso_hit(tool, event, sample, evsel, machine); + return build_id__mark_dso_hit(tool, event, sample, machine); } =20 static int process_buildids(struct record *rec) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3b81f4b3dc49..35791fe0bd90 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -269,10 +269,10 @@ static int process_feature_event(const struct perf_to= ol *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 =3D container_of(tool, struct report, tool); + struct evsel *evsel =3D sample->evsel; struct addr_location al; struct hist_entry_iter iter =3D { .evsel =3D evsel, @@ -349,7 +349,6 @@ static int process_sample_event(const struct perf_tool = *tool, 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 =3D container_of(tool, struct report, tool); @@ -357,7 +356,7 @@ static int process_read_event(const struct perf_tool *t= ool, if (rep->show_threads) { int err =3D perf_read_values_add_value(&rep->show_threads_values, event->read.pid, event->read.tid, - evsel, + sample->evsel, event->read.value); =20 if (err) @@ -783,11 +782,10 @@ static void report__output_resort(struct report *rep) =20 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 =3D evsel__hists(evsel); + struct hists *hists =3D evsel__hists(sample->evsel); =20 hists__inc_nr_events(hists); return 0; diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 3f509cfdd58c..01ac42f0ec1f 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1867,9 +1867,9 @@ typedef int (*tracepoint_handler)(const struct perf_t= ool *tool, static int perf_sched__process_tracepoint_sample(const struct perf_tool *t= ool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine) { + struct evsel *evsel =3D sample->evsel; int err =3D 0; =20 if (evsel->handler !=3D 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 =3D container_of(tool, struct perf_sched, tool); + struct evsel *evsel =3D sample->evsel; int err =3D 0; struct perf_cpu this_cpu =3D { .cpu =3D sample->cpu, diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index c28897186341..28fe3ff02cf5 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -2640,10 +2640,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 =3D container_of(tool, struct perf_script, tool); + struct evsel *evsel =3D sample->evsel; struct addr_location al; struct addr_location addr_al; int ret =3D 0; @@ -2724,10 +2724,10 @@ static int process_sample_event(const struct perf_t= ool *tool, 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 =3D container_of(tool, struct perf_script, tool); + struct evsel *evsel =3D sample->evsel; struct perf_event_attr *attr =3D &evsel->core.attr; struct evsel_script *es =3D evsel->priv; unsigned int type =3D output_type(attr->type); diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index f8b49d69e9a5..f3f0e4ec0502 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -574,10 +574,10 @@ typedef int (*tracepoint_handler)(struct timechart *t= chart, 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 =3D container_of(tool, struct timechart, tool); + struct evsel *evsel =3D sample->evsel; =20 if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) { if (!tchart->first_time || tchart->first_time > sample->time) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 311d9da9896a..cb2d72c2a921 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -3461,10 +3461,10 @@ static void trace__set_base_time(struct trace *trac= e, 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 =3D container_of(tool, struct trace, tool); + struct evsel *evsel =3D sample->evsel; struct thread *thread; int err =3D 0; =20 diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index fdb35133fde4..55b72235f891 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -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, =20 addr_location__exit(&al); =20 - sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEP= TH, + sample__for_each_callchain_node(thread, sample->evsel, sample, PERF_MAX_S= TACK_DEPTH, /*symbols=3D*/false, mark_dso_hit_callback, /*data=3D*/NULL); =20 =20 diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index 47e621cebe1b..73bad90b06f9 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h @@ -34,12 +34,7 @@ char *__dso__build_id_filename(const struct dso *dso, ch= ar *bf, size_t size, bool is_debug, bool is_kallsyms); =20 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_ev= ent *event, - struct perf_sample *sample, struct evsel *evsel, - struct machine *machine); + struct perf_sample *sample, struct machine *machine); =20 bool perf_session__read_build_ids(struct perf_session *session, bool with_= hits); int perf_session__write_buildid_table(struct perf_session *session, diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-conve= rt-bt.c index a22e9049ff30..c4b12b33d060 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -802,10 +802,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 =3D container_of(tool, struct convert, tool); + struct evsel *evsel =3D sample->evsel; struct evsel_priv *priv =3D evsel->priv; struct ctf_writer *cw =3D &c->writer; struct ctf_stream *cs; diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-con= vert-json.c index eefa3a94c813..f42de990a709 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -155,13 +155,12 @@ static void output_sample_callchain_entry(const struc= t 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 =3D container_of(tool, struct convert_json, tool); FILE *out =3D c->out; struct addr_location al; - u64 sample_type =3D __evlist__combined_sample_type(evsel->evlist); + u64 sample_type =3D __evlist__combined_sample_type(sample->evsel->evlist); u8 cpumode =3D PERF_RECORD_MISC_USER; =20 addr_location__init(&al); @@ -241,7 +240,7 @@ static int process_sample_event(const struct perf_tool = *tool, =20 #ifdef HAVE_LIBTRACEEVENT if (sample->raw_data) { - struct tep_event *tp_format =3D evsel__tp_format(evsel); + struct tep_event *tp_format =3D evsel__tp_format(sample->evsel); struct tep_format_field **fields =3D tp_format ? tep_event_fields(tp_for= mat) : NULL; =20 if (fields) { diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c index 3c958d738ca6..21a672813099 100644 --- a/tools/perf/util/intel-tpebs.c +++ b/tools/perf/util/intel-tpebs.c @@ -186,7 +186,6 @@ static bool should_ignore_sample(const struct perf_samp= le *sample, const struct static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event __maybe_unused, struct perf_sample *sample, - struct evsel *evsel, struct machine *machine __maybe_unused) { struct tpebs_retire_lat *t; @@ -197,7 +196,7 @@ static int process_sample_event(const struct perf_tool = *tool __maybe_unused, mutex_unlock(tpebs_mtx_get()); return 0; } - t =3D tpebs_retire_lat__find(evsel); + t =3D tpebs_retire_lat__find(sample->evsel); if (!t) { mutex_unlock(tpebs_mtx_get()); return -EINVAL; diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index e0ce8b904729..52e6ffac2b3e 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -642,7 +642,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd= , union jr_entry *jr) =20 ret =3D 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; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 3794d3a04afb..150398b383fe 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1110,9 +1110,10 @@ char *get_page_size_name(u64 size, char *str) return str; } =20 -static void dump_sample(struct machine *machine, struct evsel *evsel, unio= n perf_event *event, +static void dump_sample(struct machine *machine, union perf_event *event, struct perf_sample *sample) { + struct evsel *evsel =3D sample->evsel; u64 sample_type; char str[PAGE_SIZE_NAME_LEN]; uint16_t e_machine =3D EM_NONE; @@ -1176,9 +1177,10 @@ static void dump_sample(struct machine *machine, str= uct evsel *evsel, union perf sample_read__printf(sample, evsel->core.attr.read_format); } =20 -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_s= ample *sample) { + struct evsel *evsel =3D sample->evsel; + if (!dump_trace) return; =20 @@ -1284,7 +1286,7 @@ static int deliver_sample_value(struct evlist *evlist, return 0; =20 sample->evsel =3D container_of(sid->evsel, struct evsel, core); - ret =3D tool->sample(tool, event, sample, sample->evsel, machine); + ret =3D tool->sample(tool, event, sample, machine); sample->evsel =3D saved_evsel; return ret; } @@ -1316,8 +1318,9 @@ static int deliver_sample_group(struct evlist *evlist, =20 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 =3D sample->evsel; /* We know evsel !=3D NULL. */ u64 sample_type =3D evsel->core.attr.sample_type; u64 read_format =3D evsel->core.attr.read_format; @@ -1325,7 +1328,7 @@ static int evlist__deliver_sample(struct evlist *evli= st, const struct perf_tool =20 /* Standard sample delivery. */ if (!(sample_type & PERF_SAMPLE_READ)) - return tool->sample(tool, event, sample, evsel, machine); + return tool->sample(tool, event, sample, machine); =20 /* For PERF_SAMPLE_READ we have either single or group mode. */ if (read_format & PERF_FORMAT_GROUP) @@ -1364,8 +1367,7 @@ static int evlist__deliver_deferred_callchain(struct = evlist *evlist, struct evsel *saved_evsel =3D sample->evsel; =20 sample->evsel =3D evlist__id2evsel(evlist, sample->id); - ret =3D tool->callchain_deferred(tool, event, sample, - sample->evsel, machine); + ret =3D tool->callchain_deferred(tool, event, sample, machine); sample->evsel =3D saved_evsel; return ret; } @@ -1393,7 +1395,7 @@ static int evlist__deliver_deferred_callchain(struct = evlist *evlist, =20 orig_sample.evsel =3D evlist__id2evsel(evlist, orig_sample.id); ret =3D evlist__deliver_sample(evlist, tool, de->event, - &orig_sample, orig_sample.evsel, machine); + &orig_sample, machine); =20 perf_sample__exit(&orig_sample); list_del(&de->list); @@ -1431,7 +1433,7 @@ static int session__flush_deferred_samples(struct per= f_session *session, =20 sample.evsel =3D evlist__id2evsel(evlist, sample.id); ret =3D evlist__deliver_sample(evlist, tool, de->event, - &sample, sample.evsel, machine); + &sample, machine); =20 perf_sample__exit(&sample); list_del(&de->list); @@ -1451,7 +1453,6 @@ static int machines__deliver_event(struct machines *m= achines, const struct perf_tool *tool, u64 file_offset, const char *file_path) { - struct evsel *evsel; struct machine *machine; =20 dump_event(evlist, event, file_offset, sample, file_path); @@ -1461,21 +1462,20 @@ static int machines__deliver_event(struct machines = *machines, else assert(sample->evsel =3D=3D evlist__id2evsel(evlist, sample->id)); =20 - evsel =3D sample->evsel; machine =3D machines__find_for_cpumode(machines, event, sample); =20 switch (event->header.type) { case PERF_RECORD_SAMPLE: - if (evsel =3D=3D NULL) { + if (sample->evsel =3D=3D NULL) { ++evlist->stats.nr_unknown_id; return 0; } if (machine =3D=3D 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 =3D malloc(sizeof(*de)); size_t sz =3D event->header.size; @@ -1492,7 +1492,7 @@ static int machines__deliver_event(struct machines *m= achines, list_add_tail(&de->list, &evlist->deferred_samples); return 0; } - return evlist__deliver_sample(evlist, tool, event, sample, evsel, machin= e); + return evlist__deliver_sample(evlist, tool, event, sample, machine); case PERF_RECORD_MMAP: return tool->mmap(tool, event, sample, machine); case PERF_RECORD_MMAP2: @@ -1520,8 +1520,8 @@ static int machines__deliver_event(struct machines *m= achines, evlist->stats.total_lost_samples +=3D 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: @@ -1550,7 +1550,7 @@ static int machines__deliver_event(struct machines *m= achines, 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: diff --git a/tools/perf/util/tool.c b/tools/perf/util/tool.c index 013c7839e2cf..0f285a2574c8 100644 --- a/tools/perf/util/tool.c +++ b/tools/perf/util/tool.c @@ -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"); @@ -348,12 +347,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 =3D container_of(tool, struct delegate_to= ol, tool); \ struct perf_tool *delegate =3D 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); diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index 2d9a4b1ca9d0..2a4f124ffd8d 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -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; =20 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); =20 typedef int (*event_op)(const struct perf_tool *tool, union perf_event *ev= ent, struct perf_sample *sample, struct machine *machine); @@ -103,7 +102,6 @@ bool perf_tool__compressed_is_stub(const struct perf_to= ol *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); =20 struct delegate_tool { --=20 2.53.0.239.g8d8fc8a987-goog