Skip to content

Instantly share code, notes, and snippets.

@akeeton
Created May 31, 2018 15:18
Show Gist options
  • Save akeeton/dc9b49ef40d70b9d8d30f4b0679c4ccb to your computer and use it in GitHub Desktop.
Save akeeton/dc9b49ef40d70b9d8d30f4b0679c4ccb to your computer and use it in GitHub Desktop.
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