Commit 55fa8b8c authored by Changbin Du's avatar Changbin Du Committed by Arnaldo Carvalho de Melo

perf tools: Add documentation for BPF event selection

Add documentation for how to pass a BPF program as a perf event.
Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190201134651.12373-1-changbin.du@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dbd2a1d5
...@@ -120,6 +120,10 @@ Given a $HOME/.perfconfig like this: ...@@ -120,6 +120,10 @@ Given a $HOME/.perfconfig like this:
children = true children = true
group = true group = true
[llvm]
dump-obj = true
clang-opt = -g
You can hide source code of annotate feature setting the config to false with You can hide source code of annotate feature setting the config to false with
% perf config annotate.hide_src_code=true % perf config annotate.hide_src_code=true
...@@ -553,6 +557,33 @@ trace.*:: ...@@ -553,6 +557,33 @@ trace.*::
trace.show_zeros:: trace.show_zeros::
Do not suppress syscall arguments that are equal to zero. Do not suppress syscall arguments that are equal to zero.
llvm.*::
llvm.clang-path::
Path to clang. If omit, search it from $PATH.
llvm.clang-bpf-cmd-template::
Cmdline template. Below lines show its default value. Environment
variable is used to pass options.
"$CLANG_EXEC -D__KERNEL__ $CLANG_OPTIONS $KERNEL_INC_OPTIONS \
-Wno-unused-value -Wno-pointer-sign -working-directory \
$WORKING_DIR -c $CLANG_SOURCE -target bpf -O2 -o -"
llvm.clang-opt::
Options passed to clang.
llvm.kbuild-dir::
kbuild directory. If not set, use /lib/modules/`uname -r`/build.
If set to "" deliberately, skip kernel header auto-detector.
llvm.kbuild-opts::
Options passed to 'make' when detecting kernel header options.
llvm.dump-obj::
Enable perf dump BPF object files compiled by LLVM.
llvm.opts::
Options passed to llc.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf[1] linkperf:perf[1]
...@@ -88,6 +88,20 @@ OPTIONS ...@@ -88,6 +88,20 @@ OPTIONS
If you want to profile write accesses in [0x1000~1008), just set If you want to profile write accesses in [0x1000~1008), just set
'mem:0x1000/8:w'. 'mem:0x1000/8:w'.
- a BPF source file (ending in .c) or a precompiled object file (ending
in .o) selects one or more BPF events.
The BPF program can attach to various perf events based on the ELF section
names.
When processing a '.c' file, perf searches an installed LLVM to compile it
into an object file first. Optional clang options can be passed via the
'--clang-opt' command line option, e.g.:
perf record --clang-opt "-DLINUX_VERSION_CODE=0x50000" \
-e tests/bpf-script-example.c
Note: '--clang-opt' must be placed before '--event/-e'.
- a group of events surrounded by a pair of brace ("{event1,event2,...}"). - a group of events surrounded by a pair of brace ("{event1,event2,...}").
Each event is separated by commas and the group should be quoted to Each event is separated by commas and the group should be quoted to
prevent the shell interpretation. You also need to use --group on prevent the shell interpretation. You also need to use --group on
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment