aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/llvm.c
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-11-17 08:32:47 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-18 17:51:05 -0300
commitd35b32891a61f1d3909bdc5280badf309adc4693 (patch)
treec4699ee47b2b829d7d3d4669480c1ab4c55053c1 /tools/perf/tests/llvm.c
parentperf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux (diff)
downloadlinux-dev-d35b32891a61f1d3909bdc5280badf309adc4693.tar.xz
linux-dev-d35b32891a61f1d3909bdc5280badf309adc4693.zip
perf bpf: Use same BPF program if arguments are identical
This patch allows creating only one BPF program for different 'probe_trace_event'(tev) entries generated by one 'perf_probe_event'(pev) if their prologues are identical. This is done by comparing the argument list of different tev instances, and the maps type of prologue and tev using a mapping array. This patch utilizes qsort to sort the tevs. After sorting, tevs with identical argument lists will be grouped together. Test result: Sample BPF program: #define SEC(NAME) __attribute__((section(NAME), used)) SEC("inlines=no;" "func=SyS_dup? oldfd") int func(void *ctx) { return 1; } It would probe at SyS_dup2 and SyS_dup3, obtaining oldfd as its argument. The following cmdline shows a BPF program being loaded into the kernel by perf: # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog Before this patch: # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog [1] 24858 lrwx------ 1 root root 64 Nov 14 04:09 3 -> anon_inode:bpf-prog lrwx------ 1 root root 64 Nov 14 04:09 4 -> anon_inode:bpf-prog ... After this patch: # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog [1] 25699 lrwx------ 1 root root 64 Nov 14 04:10 3 -> anon_inode:bpf-prog ... Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1447749170-175898-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/llvm.c')
0 files changed, 0 insertions, 0 deletions