]> git.baikalelectronics.ru Git - kernel.git/commit
samples: bpf: Refactor test_overhead program with libbpf
authorDaniel T. Lee <danieltimlee@gmail.com>
Tue, 24 Nov 2020 09:03:08 +0000 (09:03 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 27 Nov 2020 03:33:36 +0000 (19:33 -0800)
commit113fc5d1c75779490bcfecfc8960092d9a69e2b4
treeaf1e28c619db0869ce548a670c9a24faf754a2d0
parent406aaf4c8f65090ea90019de208bae19d6d81d86
samples: bpf: Refactor test_overhead program with libbpf

This commit refactors the existing program with libbpf bpf loader.
Since the kprobe, tracepoint and raw_tracepoint bpf program can be
attached with single bpf_program__attach() interface, so the
corresponding function of libbpf is used here.

Rather than specifying the number of cpus inside the code, this commit
uses the number of available cpus with _SC_NPROCESSORS_ONLN.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201124090310.24374-6-danieltimlee@gmail.com
samples/bpf/Makefile
samples/bpf/test_overhead_user.c