diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-10-29 15:17:56 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-10-29 15:17:56 +0300 |
commit | 66a565c203bc31b76969711fbd92da11bee2f129 (patch) | |
tree | 1d5a60b14b9f808b3c0cece5761002ad32f0e274 /tools/perf/util/parse-events.y | |
parent | 6fc774ef4ceca99c35dd3fb230dab618f78c8d6f (diff) | |
parent | 4edf30e39e6cff32390eaff6a1508969b3cd967b (diff) | |
download | linux-66a565c203bc31b76969711fbd92da11bee2f129.tar.xz |
Merge tag 'perf-ebpf-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull basic perf/ebpf integration:
"Please see the changeset comments, but this is the very basic integration of
perf with libbpf that, given a .o file built for the 'bpf' target with clang,
will get it validated and loaded into the kernel via the sys_bpf syscall, which
can be seen using 'perf trace' to trace the whole thing looking just for the
bpf and perf_event_open syscalls:
# perf trace -e bpf,perf_event_open perf record -g --event /tmp/foo.o -a
362.779 ( 0.129 ms): perf/22408 bpf(cmd: 5, uattr: 0x7ffd4edb6db0, size: 48 ) = 3
384.192 ( 0.016 ms): perf/22408 perf_event_open(attr_uptr: 0x7ffd4edbace0, pid: -1, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 5
384.247 ( 0.038 ms): perf/22408 perf_event_open(attr_uptr: 0x37aedd8, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
384.261 ( 0.007 ms): perf/22408 perf_event_open(attr_uptr: 0x37aedd8, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
387.680 ( 3.413 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
387.688 ( 0.005 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 6
387.693 ( 0.004 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 7
387.698 ( 0.003 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 8
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.221 MB perf.data (2 samples) ]
# perf script
bash 18389 [002] 83446.412607: perf_bpf_probe:fork: (ffffffff8109be30)
29be31 _do_fork (/lib/modules/4.3.0-rc6+/build/vmlinux)
96d662 tracesys_phase2 (/lib/modules/4.3.0-rc6+/build/vmlinux)
bd56c __libc_fork (/usr/lib64/libc-2.17.so)
413b2 make_child (/usr/bin/bash)
bash 18389 [002] 83447.227255: perf_bpf_probe:fork: (ffffffff8109be30)
29be31 _do_fork (/lib/modules/4.3.0-rc6+/build/vmlinux)
96d662 tracesys_phase2 (/lib/modules/4.3.0-rc6+/build/vmlinux)
bd56c __libc_fork (/usr/lib64/libc-2.17.so)
413b2 make_child (/usr/bin/bash)
# perf evlist -v
perf_bpf_probe:fork: type: 2, size: 112, config: 0x6cf, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
#
More work is about to be reviewed, tested and merged that will allow the whole
process of going from a .c file to an .o file via clang, etc to be done
automagically. (Wang Nan)"
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/parse-events.y')
-rw-r--r-- | tools/perf/util/parse-events.y | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index ae6af269f9c9..497f19b20f0b 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -42,6 +42,7 @@ static inc_group_count(struct list_head *list, %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM %token PE_EVENT_NAME %token PE_NAME +%token PE_BPF_OBJECT %token PE_MODIFIER_EVENT PE_MODIFIER_BP %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP @@ -53,6 +54,7 @@ static inc_group_count(struct list_head *list, %type <num> PE_RAW %type <num> PE_TERM %type <str> PE_NAME +%type <str> PE_BPF_OBJECT %type <str> PE_NAME_CACHE_TYPE %type <str> PE_NAME_CACHE_OP_RESULT %type <str> PE_MODIFIER_EVENT @@ -70,6 +72,7 @@ static inc_group_count(struct list_head *list, %type <tracepoint_name> tracepoint_name %type <head> event_legacy_numeric %type <head> event_legacy_raw +%type <head> event_bpf_file %type <head> event_def %type <head> event_mod %type <head> event_name @@ -203,7 +206,8 @@ event_def: event_pmu | event_legacy_mem | event_legacy_tracepoint sep_dc | event_legacy_numeric sep_dc | - event_legacy_raw sep_dc + event_legacy_raw sep_dc | + event_bpf_file event_pmu: PE_NAME '/' event_config '/' @@ -449,6 +453,18 @@ PE_RAW $$ = list; } +event_bpf_file: +PE_BPF_OBJECT +{ + struct parse_events_evlist *data = _data; + struct parse_events_error *error = data->error; + struct list_head *list; + + ALLOC_LIST(list); + ABORT_ON(parse_events_load_bpf(data, list, $1)); + $$ = list; +} + start_terms: event_config { struct parse_events_terms *data = _data; |