Skip to content

Instantly share code, notes, and snippets.

@shikanime
Created February 23, 2024 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shikanime/0667482a5cbb8325be95e5831dce48a3 to your computer and use it in GitHub Desktop.
Save shikanime/0667482a5cbb8325be95e5831dce48a3 to your computer and use it in GitHub Desktop.
Raspberry PI power report
#!/usr/bin/env bash
SCRIPT=$(basename "$0")
# fetch status
STATUS=$(vcgencmd get_throttled | cut -d "=" -f 2)
# decode - https://www.raspberrypi.com/documentation/computers/os.html#get_throttled
echo "vcgencmd get_throttled ($STATUS)"
IFS=","
for BITMAP in \
00,"currently under-voltage" \
01,"ARM frequency currently capped" \
02,"currently throttled" \
03,"soft temperature limit reached" \
16,"under-voltage has occurred since last reboot" \
17,"ARM frequency capping has occurred since last reboot" \
18,"throttling has occurred since last reboot" \
19,"soft temperature reached since last reboot"
do set -- $BITMAP
if [ $(($STATUS & 1 << $1)) -ne 0 ] ; then echo " $2" ; fi
done
echo "vcgencmd measure_volts:"
for S in core sdram_c sdram_i sdram_p ; do printf '%9s %s\n' "$S" "$(vcgencmd measure_volts $S)" ; done
echo "Temperature: $(vcgencmd measure_temp)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment