samples/bpf: add tracepoint vs kprobe performance tests
authorAlexei Starovoitov <ast@fb.com>
Thu, 7 Apr 2016 01:43:31 +0000 (18:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Apr 2016 01:04:27 +0000 (21:04 -0400)
commite3edfdec04d43aa6276db639d3721e073161d2c2
treec7516296b2081373659aa0dfe39e61fe7598b56e
parent3c9b16448cf6924c203e3c01696c87fcbfb71fc6
samples/bpf: add tracepoint vs kprobe performance tests

the first microbenchmark does
fd=open("/proc/self/comm");
for() {
  write(fd, "test");
}
and on 4 cpus in parallel:
                                      writes per sec
base (no tracepoints, no kprobes)         930k
with kprobe at __set_task_comm()          420k
with tracepoint at task:task_rename       730k

For kprobe + full bpf program manully fetches oldcomm, newcomm via bpf_probe_read.
For tracepint bpf program does nothing, since arguments are copied by tracepoint.

2nd microbenchmark does:
fd=open("/dev/urandom");
for() {
  read(fd, buf);
}
and on 4 cpus in parallel:
                                       reads per sec
base (no tracepoints, no kprobes)         300k
with kprobe at urandom_read()             279k
with tracepoint at random:urandom_read    290k

bpf progs attached to kprobe and tracepoint are noop.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/Makefile
samples/bpf/test_overhead_kprobe_kern.c [new file with mode: 0644]
samples/bpf/test_overhead_tp_kern.c [new file with mode: 0644]
samples/bpf/test_overhead_user.c [new file with mode: 0644]
This page took 0.029238 seconds and 5 git commands to generate.