xref: /linux/tools/testing/selftests/bpf/benchs/run_bench_ringbufs.sh (revision 8632987380765dee716d460640aa58d58d52998e)
1#!/bin/bash
2
3source ./benchs/run_common.sh
4
5set -eufo pipefail
6
7header "Single-producer, parallel producer"
8for b in rb-libbpf rb-custom pb-libbpf pb-custom; do
9	summarize $b "$($RUN_BENCH $b)"
10done
11
12header "Single-producer, parallel producer, sampled notification"
13for b in rb-libbpf rb-custom pb-libbpf pb-custom; do
14	summarize $b "$($RUN_BENCH --rb-sampled $b)"
15done
16
17header "Single-producer, back-to-back mode"
18for b in rb-libbpf rb-custom pb-libbpf pb-custom; do
19	summarize $b "$($RUN_BENCH --rb-b2b $b)"
20	summarize $b-sampled "$($RUN_BENCH --rb-sampled --rb-b2b $b)"
21done
22
23header "Ringbuf back-to-back, effect of sample rate"
24for b in 1 5 10 25 50 100 250 500 1000 2000 3000; do
25	summarize "rb-sampled-$b" "$($RUN_BENCH --rb-b2b --rb-batch-cnt $b --rb-sampled --rb-sample-rate $b rb-custom)"
26done
27header "Perfbuf back-to-back, effect of sample rate"
28for b in 1 5 10 25 50 100 250 500 1000 2000 3000; do
29	summarize "pb-sampled-$b" "$($RUN_BENCH --rb-b2b --rb-batch-cnt $b --rb-sampled --rb-sample-rate $b pb-custom)"
30done
31
32header "Ringbuf back-to-back, reserve+commit vs output"
33summarize "reserve" "$($RUN_BENCH --rb-b2b                 rb-custom)"
34summarize "output"  "$($RUN_BENCH --rb-b2b --rb-use-output rb-custom)"
35
36header "Ringbuf sampled, reserve+commit vs output"
37summarize "reserve-sampled" "$($RUN_BENCH --rb-sampled                 rb-custom)"
38summarize "output-sampled"  "$($RUN_BENCH --rb-sampled --rb-use-output rb-custom)"
39
40header "Single-producer, consumer/producer competing on the same CPU, low batch count"
41for b in rb-libbpf rb-custom pb-libbpf pb-custom; do
42	summarize $b "$($RUN_BENCH --rb-batch-cnt 1 --rb-sample-rate 1 --prod-affinity 0 --cons-affinity 0 $b)"
43done
44
45header "Ringbuf, multi-producer contention"
46for b in 1 2 3 4 8 12 16 20 24 28 32 36 40 44 48 52; do
47	summarize "rb-libbpf nr_prod $b" "$($RUN_BENCH -p$b --rb-batch-cnt 50 rb-libbpf)"
48done
49
50