#!/bin/bash # Based on https://github.com/bamarni/pi64/issues/4#issuecomment-292707581 # sysbench manual: http://imysql.com/wp-content/uploads/2014/10/sysbench-manual.pdf # check if bechmarking tool is installed sysbenchInstalled=$(sysbench --version 2>/dev/null | grep -c 'sysbench 0.') if [ ${sysbenchInstalled} -eq 0 ];then sudo apt install -y sysbench fi # do debug outputs to the STDERR - so that the STDOUT is just the results in the end echo "RaspiBlitz powertest v0.1" >&2 echo "Starting sysbench to run for 60 seconds (--max-time=60 --cpu-max-prime=10000)" >&2 # starting bench mark sysbench --max-time=60 --test=cpu --cpu-max-prime=10000 --num-threads=4 run 1>/dev/null 2>&1 & # keep monitoring in the background Maxfreq=$(( $(awk '{printf ("%0.0f",$1/1000); }' &2 else echo -e "${Temp}$(printf "%5s" ${RealClockspeed})/$(printf "%4s" ${SysFSClockspeed}) MHz ${CoreVoltage}" >&2 fi # analyse Voltage voltFloat=$(echo "${CoreVoltage/V/}*10000" | bc) voltInt=${voltFloat/.*} echo "V -> ${voltFloat}/${voltInt}" if [ ${voltInt} -lt 1.2500 ]; then echo "Voltage too low" else echo "Voltage OK" fi # analyse Temp echo "T -> ${Temp}" sleep 5 done