mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-01 15:15:19 -04:00
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>
This commit is contained in:
16
tools/tracing/rtla/example/timerlat_bpf_action.c
Normal file
16
tools/tracing/rtla/example/timerlat_bpf_action.c
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user