Created
August 2, 2024 21:31
-
-
Save rootfs/ae1e50cc69bd5d07dc2e0f5df3ea3869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
podman ps | |
podman inspect $(podman ps -q) |grep EXPERIMENTAL_BPF_SAMPLE_RATE | |
cpu_intensive_task() { | |
local n=3000 | |
local a=101 | |
local b=303 | |
local product=0 | |
for (( k=0; k<n; k++ )) | |
do | |
product=$((a * b)) | |
a=$b | |
b=$product | |
done | |
} | |
sysctl -w kernel.bpf_stats_enabled=0 | |
sysctl -w kernel.bpf_stats_enabled=1 | |
total=0 | |
count=0 | |
for (( i=1; i<=10; i++ )) | |
do | |
echo "Iteration $i" | |
for (( j=1; j<=100; j++ )) | |
do | |
( | |
cpu_intensive_task | |
) & | |
done | |
wait | |
latency=$(bpftool prog show |grep -w -E "kepler_sched_switch_trace|kprobe__finish_task_switch" | awk '{print $(NF-2)/$NF}') | |
total=$(echo $total + $latency | bc) | |
count=$(echo $count + 1 | bc) | |
done | |
echo "Completed" $count "iterations. Average Latency is" $(echo $total / $count | bc) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment