[PATCH 0/4] perf bpf: Add __bpf_stdout__ support

From: Wang Nan
Date: Fri Apr 08 2016 - 11:07:49 EST


Hi Arnaldo,

Following your suggestion, patch 3-4 in this patch set add __bpf_stdout__
support. If a map is called __bpf_stdout__, perf will create a bpf-output
event and attach to it automatically. Don't need to setup bpf output event
in cmdline explicitly.

# perf record -e ./test_bpf_trace.c usleep 100000
# ~/perf script
usleep 25656 [003] 264724.900051: 0 __bpf_stdout__: ffffffff810eb9a1 sys_nanosleep (/lib/modules
BPF output: 0000: 52 61 69 73 65 20 61 20 Raise a
0008: 42 50 46 20 65 76 65 6e BPF even
0010: 74 21 00 00 t!..
BPF string: "Raise a BPF event!"

usleep 25656 [003] 264725.000112: 0 __bpf_stdout__: ffffffff8105d609 kretprobe_trampoline_holder
BPF output: 0000: 52 61 69 73 65 20 61 20 Raise a
0008: 42 50 46 20 65 76 65 6e BPF even
0010: 74 21 00 00 t!..
BPF string: "Raise a BPF event!"

Wang Nan (4):
perf trace: Improve error message when receive non-tracepoint events
perf trace: Print content of bpf-output event
perf bpf: Clone bpf stdout events in multiple bpf scripts
perf bpf: Automatically create bpf-output event __bpf_stdout__

tools/perf/builtin-record.c | 8 +++
tools/perf/builtin-trace.c | 33 +++++++++-
tools/perf/util/bpf-loader.c | 143 +++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/bpf-loader.h | 19 ++++++
4 files changed, 202 insertions(+), 1 deletion(-)

--
1.8.3.4