refactor powertest

This commit is contained in:
Christian Rotzoll 2019-04-10 00:56:48 +01:00
parent d11b2c9194
commit 1afaf89668
2 changed files with 12 additions and 10 deletions

View file

@ -252,6 +252,9 @@ sudo apt-get install -y autossh
# see https://github.com/rootzoll/raspiblitz/pull/334
sudo apt-get install -y fbi
# prepare for powertest
sudo apt install -y sysbench
# prepare dor display service
# see https://github.com/rootzoll/raspiblitz/issues/88#issuecomment-471342311
sudo apt-get install -y redis-server

View file

@ -3,21 +3,20 @@
# 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
clear
echo ""
echo "***"
echo "RaspiBlitz powertest v0.1"
echo "Starting sysbench to run for 60 seconds (--max-time=60 --cpu-max-prime=10000)"
echo "***"
echo ""
# 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
sysbench --max-time=60 --test=cpu --cpu-max-prime=10000 --num-threads=4 run & # > /dev/null 2>&1 &
# 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); }' </sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) -15 ))
for (( n=0; n<15; ++n )); do
Temp=$(sudo vcgencmd measure_temp | cut -f2 -d=)
@ -25,9 +24,9 @@ for (( n=0; n<15; ++n )); do
SysFSClockspeed=$(awk '{printf ("%0.0f",$1/1000); }' </sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
CoreVoltage=$(sudo vcgencmd measure_volts | cut -f2 -d= | sed 's/000//')
if [ ${RealClockspeed} -ge ${Maxfreq} ]; then
echo -e "${Temp}$(printf "%5s" ${SysFSClockspeed}) MHz ${CoreVoltage}"
echo -e "${Temp}$(printf "%5s" ${SysFSClockspeed}) MHz ${CoreVoltage}" >&2
else
echo -e "${Temp}$(printf "%5s" ${RealClockspeed})/$(printf "%4s" ${SysFSClockspeed}) MHz ${CoreVoltage}"
echo -e "${Temp}$(printf "%5s" ${RealClockspeed})/$(printf "%4s" ${SysFSClockspeed}) MHz ${CoreVoltage}" >&2
fi
sleep 5
done