[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251017144650.663238-4-tglozar@redhat.com>
Date: Fri, 17 Oct 2025 16:46:49 +0200
From: Tomas Glozar <tglozar@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>,
John Kacur <jkacur@...hat.com>,
Luis Goncalves <lgoncalv@...hat.com>,
Costa Shulyupin <costa.shul@...hat.com>,
Crystal Wood <crwood@...hat.com>,
Wander Lairson Costa <wander@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Tomas Glozar <tglozar@...hat.com>
Subject: [PATCH 3/4] rtla/timerlat: Add example for BPF action program
Add an example BPF action program that prints the measured latency to
the tracefs buffer via bpf_printk().
Signed-off-by: Tomas Glozar <tglozar@...hat.com>
---
tools/tracing/rtla/sample/timerlat_bpf_action.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 tools/tracing/rtla/sample/timerlat_bpf_action.c
diff --git a/tools/tracing/rtla/sample/timerlat_bpf_action.c b/tools/tracing/rtla/sample/timerlat_bpf_action.c
new file mode 100644
index 000000000000..ac1be049a848
--- /dev/null
+++ b/tools/tracing/rtla/sample/timerlat_bpf_action.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/bpf.h>
+#include <bpf/bpf_tracing.h>
+
+char LICENSE[] SEC("license") = "GPL";
+
+struct trace_event_raw_timerlat_sample {
+ unsigned long long timer_latency;
+} __attribute__((preserve_access_index));
+
+SEC("tp/timerlat_action")
+int action_handler(struct trace_event_raw_timerlat_sample *tp_args)
+{
+ bpf_printk("Latency: %lld\n", tp_args->timer_latency);
+ return 0;
+}
--
2.51.0
Powered by blists - more mailing lists