xref: /linux/tools/tracing/rtla/example/timerlat_bpf_action.c (revision 582a1ef360a05bff4350bbf6e383f61d26b804f0)
1*0304a3b7STomas Glozar // SPDX-License-Identifier: GPL-2.0
2*0304a3b7STomas Glozar #include <linux/bpf.h>
3*0304a3b7STomas Glozar #include <bpf/bpf_tracing.h>
4*0304a3b7STomas Glozar 
5*0304a3b7STomas Glozar char LICENSE[] SEC("license") = "GPL";
6*0304a3b7STomas Glozar 
7*0304a3b7STomas Glozar struct trace_event_raw_timerlat_sample {
8*0304a3b7STomas Glozar 	unsigned long long timer_latency;
9*0304a3b7STomas Glozar } __attribute__((preserve_access_index));
10*0304a3b7STomas Glozar 
11*0304a3b7STomas Glozar SEC("tp/timerlat_action")
12*0304a3b7STomas Glozar int action_handler(struct trace_event_raw_timerlat_sample *tp_args)
13*0304a3b7STomas Glozar {
14*0304a3b7STomas Glozar 	bpf_printk("Latency: %lld\n", tp_args->timer_latency);
15*0304a3b7STomas Glozar 	return 0;
16*0304a3b7STomas Glozar }
17