summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/example/timerlat_bpf_action.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tracing/rtla/example/timerlat_bpf_action.c')
-rw-r--r--tools/tracing/rtla/example/timerlat_bpf_action.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/tracing/rtla/example/timerlat_bpf_action.c b/tools/tracing/rtla/example/timerlat_bpf_action.c
new file mode 100644
index 000000000..ac1be049a
--- /dev/null
+++ b/tools/tracing/rtla/example/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;
+}