mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
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>
17 lines
413 B
C
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;
|
|
}
|