perf timechart: Don't pass evsel with sample

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 timechart-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>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2026-05-20 12:05:22 -07:00 committed by Arnaldo Carvalho de Melo
parent 1ac10645bb
commit 6d2b06b4ef

View File

@ -567,7 +567,6 @@ static const char *cat_backtrace(union perf_event *event,
}
typedef int (*tracepoint_handler)(struct timechart *tchart,
struct evsel *evsel,
struct perf_sample *sample,
const char *backtrace);
@ -588,8 +587,8 @@ static int process_sample_event(const struct perf_tool *tool,
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
return f(tchart, evsel, sample,
cat_backtrace(event, sample, machine));
return f(tchart, sample, cat_backtrace(event, sample, machine));
}
return 0;
@ -597,7 +596,6 @@ static int process_sample_event(const struct perf_tool *tool,
static int
process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
@ -613,7 +611,6 @@ process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
static int
process_sample_cpu_frequency(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
@ -626,7 +623,6 @@ process_sample_cpu_frequency(struct timechart *tchart,
static int
process_sample_sched_wakeup(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace)
{
@ -640,7 +636,6 @@ process_sample_sched_wakeup(struct timechart *tchart,
static int
process_sample_sched_switch(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace)
{
@ -656,7 +651,6 @@ process_sample_sched_switch(struct timechart *tchart,
#ifdef SUPPORT_OLD_POWER_EVENTS
static int
process_sample_power_start(struct timechart *tchart __maybe_unused,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
@ -669,7 +663,6 @@ process_sample_power_start(struct timechart *tchart __maybe_unused,
static int
process_sample_power_end(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
@ -679,7 +672,6 @@ process_sample_power_end(struct timechart *tchart,
static int
process_sample_power_frequency(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
@ -849,8 +841,8 @@ static int pid_end_io_sample(struct timechart *tchart, int pid, int type,
static int
process_enter_read(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_READ,
@ -859,8 +851,8 @@ process_enter_read(struct timechart *tchart,
static int
process_exit_read(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_READ,
@ -869,8 +861,8 @@ process_exit_read(struct timechart *tchart,
static int
process_enter_write(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_WRITE,
@ -879,8 +871,8 @@ process_enter_write(struct timechart *tchart,
static int
process_exit_write(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_WRITE,
@ -889,8 +881,8 @@ process_exit_write(struct timechart *tchart,
static int
process_enter_sync(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_SYNC,
@ -899,8 +891,8 @@ process_enter_sync(struct timechart *tchart,
static int
process_exit_sync(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_SYNC,
@ -909,8 +901,8 @@ process_exit_sync(struct timechart *tchart,
static int
process_enter_tx(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_TX,
@ -919,8 +911,8 @@ process_enter_tx(struct timechart *tchart,
static int
process_exit_tx(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_TX,
@ -929,8 +921,8 @@ process_exit_tx(struct timechart *tchart,
static int
process_enter_rx(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_RX,
@ -939,8 +931,8 @@ process_enter_rx(struct timechart *tchart,
static int
process_exit_rx(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_RX,
@ -949,8 +941,8 @@ process_exit_rx(struct timechart *tchart,
static int
process_enter_poll(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long fd = perf_sample__intval(sample, "fd");
return pid_begin_io_sample(tchart, sample->tid, IOTYPE_POLL,
@ -959,8 +951,8 @@ process_enter_poll(struct timechart *tchart,
static int
process_exit_poll(struct timechart *tchart,
struct evsel *evsel __maybe_unused,
struct perf_sample *sample)
struct perf_sample *sample,
const char *backtrace __maybe_unused)
{
long ret = perf_sample__intval(sample, "ret");
return pid_end_io_sample(tchart, sample->tid, IOTYPE_POLL,