Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
Counter=20
DisplayHeader="Date Time GPU-C GPU-F CPU-C CPU-F CPU Core Vcore"
while true ; do
let ++Counter
if [ ${Counter} -eq 21 ]; then
echo -e "${DisplayHeader}"
Counter=0
fi
Clockspeed=$(vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
Corespeed=$(vcgencmd measure_clock core | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
CoreVolt=$(vcgencmd measure_volts | cut -f2 -d= | sed 's/000//')
gpu=$(//usr/bin/vcgencmd measure_temp | awk -F "[=']" '{print $2}')
# gpu=3
cpu=$(</sys/class/thermal/thermal_zone0/temp)
cpu=$(echo "$cpu / 100 * 0.1" | bc)
cpuf=$(echo "(1.8 * $cpu) + 32" |bc)
gpuf=$(echo "(1.8 * $gpu) + 32" |bc)
echo -e "$(date '+%b %d %H:%M') ${gpu}'C ${gpuf}'F ${cpu}'C ${cpuf}'F $(printf '%4s' ${Clockspeed})MHz $(printf '%4s' ${Corespeed})MHz ${CoreVolt}"
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment