Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to run `sysbench` in a loop for benchmarking a Raspberry Pi and a DIY heatsink
#!/bin/bash
# Adapted from https://github.com/aikoncwd/rpi-benchmark
NUM_RUNS=20
[ "$(whoami)" == "root" ] || { echo "Must be run as sudo!"; exit 1; }
vcgencmd measure_temp
vcgencmd get_config int | grep arm_freq
vcgencmd get_config int | grep core_freq
vcgencmd get_config int | grep sdram_freq
vcgencmd get_config int | grep gpu_freq
printf "sd_clock="
grep "actual clock" /sys/kernel/debug/mmc0/ios 2>/dev/null | awk '{printf("%0.3f MHz", $3/1000000)}'
echo -e "\n"
for (( run=1; run<=$NUM_RUNS; run++ ))
do
echo -e "*********"
echo -e "Run $run"
echo -e "*********\n"
echo -e "Running CPU test...\n"
sysbench --num-threads=4 --validate=on --test=cpu --cpu-max-prime=10000 run | grep 'total time:\|min:\|avg:\|max:' | tr -s [:space:]
vcgencmd measure_temp
echo -e ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment