linux-stable/tools/testing/selftests/bpf/benchs
Joanne Koong ec151037af selftest/bpf/benchs: Add bpf_loop benchmark
Add benchmark to measure the throughput and latency of the bpf_loop
call.

Testing this on my dev machine on 1 thread, the data is as follows:

        nr_loops: 10
bpf_loop - throughput: 198.519 ± 0.155 M ops/s, latency: 5.037 ns/op

        nr_loops: 100
bpf_loop - throughput: 247.448 ± 0.305 M ops/s, latency: 4.041 ns/op

        nr_loops: 500
bpf_loop - throughput: 260.839 ± 0.380 M ops/s, latency: 3.834 ns/op

        nr_loops: 1000
bpf_loop - throughput: 262.806 ± 0.629 M ops/s, latency: 3.805 ns/op

        nr_loops: 5000
bpf_loop - throughput: 264.211 ± 1.508 M ops/s, latency: 3.785 ns/op

        nr_loops: 10000
bpf_loop - throughput: 265.366 ± 3.054 M ops/s, latency: 3.768 ns/op

        nr_loops: 50000
bpf_loop - throughput: 235.986 ± 20.205 M ops/s, latency: 4.238 ns/op

        nr_loops: 100000
bpf_loop - throughput: 264.482 ± 0.279 M ops/s, latency: 3.781 ns/op

        nr_loops: 500000
bpf_loop - throughput: 309.773 ± 87.713 M ops/s, latency: 3.228 ns/op

        nr_loops: 1000000
bpf_loop - throughput: 262.818 ± 4.143 M ops/s, latency: 3.805 ns/op

>From this data, we can see that the latency per loop decreases as the
number of loops increases. On this particular machine, each loop had an
overhead of about ~4 ns, and we were able to run ~250 million loops
per second.

Signed-off-by: Joanne Koong <joannekoong@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211130030622.4131246-5-joannekoong@fb.com
2021-11-30 10:56:28 -08:00
..
bench_bloom_filter_map.c selftests/bpf: Fix a tautological-constant-out-of-range-compare compiler warning 2021-11-12 14:11:46 -08:00
bench_bpf_loop.c selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00
bench_count.c
bench_rename.c selftests/bpf: Turn on libbpf 1.0 mode and fix all IS_ERR checks 2021-05-25 17:32:35 -07:00
bench_ringbufs.c selftests/bpf: Migrate all deprecated perf_buffer uses 2021-11-11 16:54:05 -08:00
bench_trigger.c selftests/bpf: Add uprobe triggering overhead benchmarks 2021-11-16 14:46:49 +01:00
run_bench_bloom_filter_map.sh bpf/benchs: Add benchmarks for comparing hashmap lookups w/ vs. w/out bloom filter 2021-10-28 13:22:49 -07:00
run_bench_bpf_loop.sh selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00
run_bench_rename.sh
run_bench_ringbufs.sh bpf/benchs: Add benchmark tests for bloom filter throughput + false positive 2021-10-28 13:22:49 -07:00
run_bench_trigger.sh selftest/bpf: Add BPF triggering benchmark 2020-05-13 12:19:38 -07:00
run_common.sh selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00