Files
linux-cryptodev-2.6/tools/tracing/rtla/example/timerlat_bpf_action.c
Tomas Glozar 0304a3b7ec 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().

A new Makefile target, "examples", is added to build the example. In
addition, "sample/" subfolder is renamed to "example".

If BPF skeleton support is unavailable or disabled, a warning will be
displayed when building the BPF action program example.

Link: https://lore.kernel.org/r/20251126144205.331954-4-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2026-01-07 15:57:16 +01:00

17 lines
413 B
C

// 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;
}