Analysis of the BCC perf_poll API.
The goal is to stress the CPU by triggering the BPF program (kprobe) attached in the tcp connect (tcpconnect-test
) or hook (hook
) functions.
Term1:
taskset --cpu-list <cpu-id> ./build/hook <cpu-id> <frequency>
Term2:
sudo ./hook_uprobe -s /usr/lib/libreadline.so --pid $(pgrep hook) --exepath /work/mantisnet/bcc-perf-buffer-poll-benchmark/build/hook
Make sure you have followed the BCC installation guide.
Run the nginx:
docker run -d nginx
And just run the benchmark:
./run.sh 10 10
arg1: the total of iterations. Each iteraction executes 500 curl. arg2: upper bound of wakeup_event. Starts with 1 and increase 10 for each interaction.
In the end, the program generates a report for each execution. The report will be located in the reports folder.
You can also execute manually the test with you want to have more control.
Term1:
sudo ./tcpconnect-test -w 1
w
: wakeup_events of theperf_event_attr
API - https://man7.org/linux/man-pages/man2/perf_event_open.2.html.
Term2:
htop
Term3:
./test.sh 1 100
In this case, arg1 is the target cpu and 100 is the total of iterations. Each iteraction execute 500 curl. This
test.sh
is based on weaveworks/scope#2650 (comment)
After the execution, press Ctrl + C