diff options
Diffstat (limited to 'tools/testing/selftests/bpf/test_tracepoint.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_tracepoint.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_tracepoint.c b/tools/testing/selftests/bpf/test_tracepoint.c new file mode 100644 index 000000000000..04bf084517e0 --- /dev/null +++ b/tools/testing/selftests/bpf/test_tracepoint.c | |||
@@ -0,0 +1,26 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | // Copyright (c) 2017 Facebook | ||
3 | |||
4 | #include <linux/bpf.h> | ||
5 | #include "bpf_helpers.h" | ||
6 | |||
7 | /* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */ | ||
8 | struct sched_switch_args { | ||
9 | unsigned long long pad; | ||
10 | char prev_comm[16]; | ||
11 | int prev_pid; | ||
12 | int prev_prio; | ||
13 | long long prev_state; | ||
14 | char next_comm[16]; | ||
15 | int next_pid; | ||
16 | int next_prio; | ||
17 | }; | ||
18 | |||
19 | SEC("tracepoint/sched/sched_switch") | ||
20 | int oncpu(struct sched_switch_args *ctx) | ||
21 | { | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | char _license[] SEC("license") = "GPL"; | ||
26 | __u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ | ||