You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aya/test/integration-test/bpf/ring_buf_sched_tracepoint.b...

18 lines
456 B
C

#include <bpf/bpf_helpers.h>
#include <vmlinux.h>
char _license[] SEC("license") = "GPL";
struct {
__uint(type, BPF_MAP_TYPE_RINGBUF);
__uint(max_entries, 256 * 1024 /* 256 KB */);
} rb SEC(".maps");
// This probe writes a zero to rb every time the sched_switch tracepoint is hit.
SEC("tracepoint/sched/sched_switch")
int sched_switch(struct switch_args *ctx) {
unsigned long long e = 0;
bpf_ringbuf_output(&rb, &e, sizeof(e), 0);
return 0;
}