diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-08-15 00:06:05 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-08-17 00:45:08 +0200 |
commit | f36d3557a132ec0ccb8a3536d3ebd778049d48ca (patch) | |
tree | 95f74a393aa015d423988c1fff9e055b0973776f /tools/testing/selftests/bpf/progs/test_perf_link.c | |
parent | 47faff371755ba0f1ad76e2df7f5003377d974a5 (diff) |
selftests/bpf: Test low-level perf BPF link API
Add tests utilizing low-level bpf_link_create() API to create perf BPF link.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210815070609.987780-13-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_perf_link.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_perf_link.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_perf_link.c b/tools/testing/selftests/bpf/progs/test_perf_link.c new file mode 100644 index 000000000000..c1db9fd98d0c --- /dev/null +++ b/tools/testing/selftests/bpf/progs/test_perf_link.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2021 Facebook */ +#include "vmlinux.h" +#include <bpf/bpf_helpers.h> +#include <bpf/bpf_tracing.h> + +int run_cnt = 0; + +SEC("perf_event") +int handler(struct pt_regs *ctx) +{ + __sync_fetch_and_add(&run_cnt, 1); + return 0; +} + +char _license[] SEC("license") = "GPL"; |