diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-12-29 15:41:19 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-01-15 16:31:46 -0300 |
commit | 301f0203e04293c13372c032198665bd75adf81b (patch) | |
tree | f15bc7f5445f6a4be90bf0c28867c4e2acaad2e5 | |
parent | f4e087c666f54559cb4e530af1fbfc9967e14a15 (diff) |
perf bpf examples: Fix bpf.h header include directive in 5sec.c example
It was looking at bpf/bpf.h, which caused this problem:
# perf trace -e tools/perf/examples/bpf/5sec.c
/home/acme/git/perf/tools/perf/examples/bpf/5sec.c:42:10: fatal error: 'bpf/bpf.h' file not found
#include <bpf/bpf.h>
^~~~~~~~~~~
1 error generated.
ERROR: unable to compile tools/perf/examples/bpf/5sec.c
Hint: Check error message shown above.
Hint: You can also pre-compile it into .o using:
clang -target bpf -O2 -c tools/perf/examples/bpf/5sec.c
with proper -I and -D options.
event syntax error: 'tools/perf/examples/bpf/5sec.c'
\___ Failed to load tools/perf/examples/bpf/5sec.c from source: Error when compiling BPF scriptlet
#
Change that to plain bpf.h, to make it work again:
# perf trace -e tools/perf/examples/bpf/5sec.c sleep 5s
0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1776891872, rqtp: 5000000000)
# perf trace -e tools/perf/examples/bpf/5sec.c/max-stack=16/ sleep 5s
0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1776891872, rqtp: 5000000000)
hrtimer_nanosleep ([kernel.kallsyms])
common_nsleep ([kernel.kallsyms])
__x64_sys_clock_nanosleep ([kernel.kallsyms])
do_syscall_64 ([kernel.kallsyms])
entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
__clock_nanosleep_2 (/usr/lib64/libc-2.32.so)
# perf trace -e tools/perf/examples/bpf/5sec.c sleep 4s
#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/examples/bpf/5sec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/examples/bpf/5sec.c b/tools/perf/examples/bpf/5sec.c index 65c4ff6892d9..e6b6181c6dc6 100644 --- a/tools/perf/examples/bpf/5sec.c +++ b/tools/perf/examples/bpf/5sec.c @@ -39,7 +39,7 @@ Copyright (C) 2018 Red Hat, Inc., Arnaldo Carvalho de Melo <acme@redhat.com> */ -#include <bpf/bpf.h> +#include <bpf.h> #define NSEC_PER_SEC 1000000000L |