From nobody Mon Apr 6 09:11:45 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 D07B93750A6 for ; Fri, 20 Mar 2026 08:09:25 +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=1773994167; cv=none; b=AMXOcHwK8ihTRtmHbjPCbHcWlPsjPEzjtw/xAxLghZW8LLaov5ZsKXaV9wQRJL+crrVLOz6nDYX2jrLrwlVsCoc9GPEnFUGgMy7B9aoE29m9OaVX/GurH4P92ti1I1yWc9sDe/bhH85So0p24JpOK1TGHyJXby9heDAGJGqRm5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773994167; c=relaxed/simple; bh=b1q+qRV+At0JLsDOsNkH956C5B10DnO2uxTL740Xww4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dwGajaDYErs+ETSsfhHadwvYULjvCc2O3fZCeC3Pbamp0qrdAtdxqPnVW9+7Uwyhw3ICvYdB588mT8rGB+0QPKqM0pF/FPwkJuaicUPZrwWWcbeKjYR0UtJDe4e3WqobVH9Fb1KlmhvTRtoeiDzR+QULABTdu5DiYqPSz+hjLgs= 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=FHF/6CEP; 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="FHF/6CEP" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2c105e5ac70so430186eec.0 for ; Fri, 20 Mar 2026 01:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773994165; x=1774598965; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=WvEYIKKmbnmDZbuhcZrAyECfys9Mz1QG/5rN/unSXvM=; b=FHF/6CEPr8U+1Mzhv+N7xPPWX6TMa/G7jlk0Y80ELE2nH1aWgEzkJa9HeQy7yZhzBG OPAHQl4PKlGLMqz+hEGGC//uqB+ktFpmsDGj1LF/ij/0rsydX1PZyCdlBgx2geNkISqJ t/ND1AeBnKJE7fcmdf4LQIax423YqCZnB3slkm1Ep5YkJVRuw1anNymNCc0rXaE+gc7r TN5rkMWLk206fJaPBi0Ae/3fUMdsojYwU35c/GSPNmaicrMMI74aUkmuVHAEhcTW/tVB tSbssAfhxAvJRq0FtK4amQOqmZ68mdE5un+F+3s+oOBV/ro1aLy9YZ8tTnVBrR60Tl5/ 7Adg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773994165; x=1774598965; h=cc: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=WvEYIKKmbnmDZbuhcZrAyECfys9Mz1QG/5rN/unSXvM=; b=IKDLFw2N2kvWmPupOZoVhwCqPU8bDslkx6RvF4xyv6iE3M8m/5Hln9wykUTbLd/HXu r56W2AjFQR+ysGrWt1C4/SXg0No6LKbjiu7zVQm4q7rpoRCKYh6ELJQ+NiqCiLo3W/sY WdoTGihrV81NDw7ajOTtYLdOxt/61JjWDY9pGsVu1irm5dKmRH7R7Fasg3aPkiJiaZ8w ha+kjnU7hXkJfx/jtt4NJJlevpa+utG0XvYStO81msVXgzlfKX6Pb0q3J9tRSlK6WqCI LtJtUIerPsovcjouPJO/otmdu8ajdWDxYSuxuDRacW693YYAuUKSVqmWSEvoNC7yaTiw 6vTg== X-Forwarded-Encrypted: i=1; AJvYcCVrFeZZy7hynX8FtEddIvNcS3PMMSPUahFOM5+tS3RVDE2/K0jtu2s321F5MEzALVewxDcJbLcTerfEd9k=@vger.kernel.org X-Gm-Message-State: AOJu0Ywrum0HwvfEDQVUzG1IVvMVAiDVbP5pR+skOQOwa03ASO8KE3NO WTf6oha8oDFXM+x4rXfmtMDO7Y+dgZ0A4mR5595XomNJBRXGfEqIjFSerlB8zcKnosy/HVIDjQ3 P8Ch8dZatlA== X-Received: from dybup7.prod.google.com ([2002:a05:7301:c087:b0:2c0:cd67:64cd]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:4083:b0:2be:8da:3207 with SMTP id 5a478bee46e88-2c1095a5704mr1105205eec.6.1773994164692; Fri, 20 Mar 2026 01:09:24 -0700 (PDT) Date: Fri, 20 Mar 2026 01:08:29 -0700 In-Reply-To: <20260320080835.724836-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: <20260319232334.287517-1-irogers@google.com> <20260320080835.724836-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.959.g497ff81fa9-goog Message-ID: <20260320080835.724836-21-irogers@google.com> Subject: [PATCH v3 20/25] perf timechart: Don't pass evsel with sample From: Ian Rogers To: namhyung@kernel.org Cc: irogers@google.com, acme@kernel.org, adrian.hunter@intel.com, ajones@ventanamicro.com, ak@linux.intel.com, alex@ghiti.fr, alexander.shishkin@linux.intel.com, anup@brainfault.org, aou@eecs.berkeley.edu, atrajeev@linux.ibm.com, blakejones@google.com, ctshao@google.com, dapeng1.mi@linux.intel.com, derek.foreman@collabora.com, dvyukov@google.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, krzysztof.m.lopatowski@gmail.com, leo.yan@arm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux@treblig.org, mingo@redhat.com, nichen@iscas.ac.cn, palmer@dabbelt.com, peterz@infradead.org, pjw@kernel.org, ravi.bangoria@amd.com, swapnil.sapkal@amd.com, tanze@kylinos.cn, thomas.falcon@intel.com, tianyou.li@intel.com, yujie.liu@intel.com, zhouquan@iscas.ac.cn Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The sample contains the evsel and so it is unnecessary to pass the evsel as well. Add missing backtrace argument to tracepoint_handler functions and mark them unused. Fix missing free from cat_backtrace. Signed-off-by: Ian Rogers --- tools/perf/builtin-timechart.c | 71 ++++++++++++++++------------------ 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 657aab126477..13edcfe39d2d 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -489,9 +489,9 @@ static void sched_switch(struct timechart *tchart, int = cpu, u64 timestamp, } } =20 -static const char *cat_backtrace(union perf_event *event, - struct perf_sample *sample, - struct machine *machine) +static char *cat_backtrace(union perf_event *event, + struct perf_sample *sample, + struct machine *machine) { struct addr_location al; unsigned int i; @@ -567,7 +567,6 @@ static const char *cat_backtrace(union perf_event *even= t, } =20 typedef int (*tracepoint_handler)(struct timechart *tchart, - struct evsel *evsel, struct perf_sample *sample, const char *backtrace); =20 @@ -578,6 +577,7 @@ static int process_sample_event(const struct perf_tool = *tool, { struct timechart *tchart =3D container_of(tool, struct timechart, tool); struct evsel *evsel =3D sample->evsel; + int ret =3D 0; =20 if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) { if (!tchart->first_time || tchart->first_time > sample->time) @@ -588,16 +588,17 @@ static int process_sample_event(const struct perf_too= l *tool, =20 if (evsel->handler !=3D NULL) { tracepoint_handler f =3D evsel->handler; - return f(tchart, evsel, sample, - cat_backtrace(event, sample, machine)); + char *backtrace =3D cat_backtrace(event, sample, machine); + + ret =3D f(tchart, sample, backtrace); + free(backtrace); } =20 - return 0; + return ret; } =20 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) { @@ -617,7 +618,6 @@ process_sample_cpu_idle(struct timechart *tchart __mayb= e_unused, =20 static int process_sample_cpu_frequency(struct timechart *tchart, - struct evsel *evsel __maybe_unused, struct perf_sample *sample, const char *backtrace __maybe_unused) { @@ -630,7 +630,6 @@ process_sample_cpu_frequency(struct timechart *tchart, =20 static int process_sample_sched_wakeup(struct timechart *tchart, - struct evsel *evsel __maybe_unused, struct perf_sample *sample, const char *backtrace) { @@ -644,7 +643,6 @@ process_sample_sched_wakeup(struct timechart *tchart, =20 static int process_sample_sched_switch(struct timechart *tchart, - struct evsel *evsel __maybe_unused, struct perf_sample *sample, const char *backtrace) { @@ -660,7 +658,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) { @@ -673,7 +670,6 @@ process_sample_power_start(struct timechart *tchart __m= aybe_unused, =20 static int process_sample_power_end(struct timechart *tchart, - struct evsel *evsel __maybe_unused, struct perf_sample *sample, const char *backtrace __maybe_unused) { @@ -683,7 +679,6 @@ process_sample_power_end(struct timechart *tchart, =20 static int process_sample_power_frequency(struct timechart *tchart, - struct evsel *evsel __maybe_unused, struct perf_sample *sample, const char *backtrace __maybe_unused) { @@ -853,8 +848,8 @@ static int pid_end_io_sample(struct timechart *tchart, = int pid, int type, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_READ, @@ -863,8 +858,8 @@ process_enter_read(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_READ, @@ -873,8 +868,8 @@ process_exit_read(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_WRITE, @@ -883,8 +878,8 @@ process_enter_write(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_WRITE, @@ -893,8 +888,8 @@ process_exit_write(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_SYNC, @@ -903,8 +898,8 @@ process_enter_sync(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_SYNC, @@ -913,8 +908,8 @@ process_exit_sync(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_TX, @@ -923,8 +918,8 @@ process_enter_tx(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_TX, @@ -933,8 +928,8 @@ process_exit_tx(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_RX, @@ -943,8 +938,8 @@ process_enter_rx(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_RX, @@ -953,8 +948,8 @@ process_exit_rx(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_POLL, @@ -963,8 +958,8 @@ process_enter_poll(struct timechart *tchart, =20 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 =3D perf_sample__intval(sample, "ret"); return pid_end_io_sample(tchart, sample->tid, IOTYPE_POLL, --=20 2.53.0.959.g497ff81fa9-goog