diff options
author | Changbin Du <changbin.du@gmail.com> | 2019-02-01 08:46:51 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-02-06 08:00:40 -0500 |
commit | 55fa8b8c0a37618c94df38d50d6871cb3e755ad2 (patch) | |
tree | 3f055e963047d038cd98a79d2c04a57f53219f4c | |
parent | dbd2a1d57f4ee6b909c94072ae9484199308acbd (diff) |
perf tools: Add documentation for BPF event selection
Add documentation for how to pass a BPF program as a perf event.
Signed-off-by: Changbin 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.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-config.txt | 31 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-record.txt | 14 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 4ac7775fbc11..86f3dcc15f83 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt | |||
@@ -120,6 +120,10 @@ Given a $HOME/.perfconfig like this: | |||
120 | children = true | 120 | children = true |
121 | group = true | 121 | group = true |
122 | 122 | ||
123 | [llvm] | ||
124 | dump-obj = true | ||
125 | clang-opt = -g | ||
126 | |||
123 | You can hide source code of annotate feature setting the config to false with | 127 | You can hide source code of annotate feature setting the config to false with |
124 | 128 | ||
125 | % perf config annotate.hide_src_code=true | 129 | % perf config annotate.hide_src_code=true |
@@ -553,6 +557,33 @@ trace.*:: | |||
553 | trace.show_zeros:: | 557 | trace.show_zeros:: |
554 | Do not suppress syscall arguments that are equal to zero. | 558 | Do not suppress syscall arguments that are equal to zero. |
555 | 559 | ||
560 | llvm.*:: | ||
561 | llvm.clang-path:: | ||
562 | Path to clang. If omit, search it from $PATH. | ||
563 | |||
564 | llvm.clang-bpf-cmd-template:: | ||
565 | Cmdline template. Below lines show its default value. Environment | ||
566 | variable is used to pass options. | ||
567 | "$CLANG_EXEC -D__KERNEL__ $CLANG_OPTIONS $KERNEL_INC_OPTIONS \ | ||
568 | -Wno-unused-value -Wno-pointer-sign -working-directory \ | ||
569 | $WORKING_DIR -c $CLANG_SOURCE -target bpf -O2 -o -" | ||
570 | |||
571 | llvm.clang-opt:: | ||
572 | Options passed to clang. | ||
573 | |||
574 | llvm.kbuild-dir:: | ||
575 | kbuild directory. If not set, use /lib/modules/`uname -r`/build. | ||
576 | If set to "" deliberately, skip kernel header auto-detector. | ||
577 | |||
578 | llvm.kbuild-opts:: | ||
579 | Options passed to 'make' when detecting kernel header options. | ||
580 | |||
581 | llvm.dump-obj:: | ||
582 | Enable perf dump BPF object files compiled by LLVM. | ||
583 | |||
584 | llvm.opts:: | ||
585 | Options passed to llc. | ||
586 | |||
556 | SEE ALSO | 587 | SEE ALSO |
557 | -------- | 588 | -------- |
558 | linkperf:perf[1] | 589 | linkperf:perf[1] |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index d232b13ea713..02b4aa2621e7 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -88,6 +88,20 @@ OPTIONS | |||
88 | If you want to profile write accesses in [0x1000~1008), just set | 88 | If you want to profile write accesses in [0x1000~1008), just set |
89 | 'mem:0x1000/8:w'. | 89 | 'mem:0x1000/8:w'. |
90 | 90 | ||
91 | - a BPF source file (ending in .c) or a precompiled object file (ending | ||
92 | in .o) selects one or more BPF events. | ||
93 | The BPF program can attach to various perf events based on the ELF section | ||
94 | names. | ||
95 | |||
96 | When processing a '.c' file, perf searches an installed LLVM to compile it | ||
97 | into an object file first. Optional clang options can be passed via the | ||
98 | '--clang-opt' command line option, e.g.: | ||
99 | |||
100 | perf record --clang-opt "-DLINUX_VERSION_CODE=0x50000" \ | ||
101 | -e tests/bpf-script-example.c | ||
102 | |||
103 | Note: '--clang-opt' must be placed before '--event/-e'. | ||
104 | |||
91 | - a group of events surrounded by a pair of brace ("{event1,event2,...}"). | 105 | - a group of events surrounded by a pair of brace ("{event1,event2,...}"). |
92 | Each event is separated by commas and the group should be quoted to | 106 | Each event is separated by commas and the group should be quoted to |
93 | prevent the shell interpretation. You also need to use --group on | 107 | prevent the shell interpretation. You also need to use --group on |