Skip to content

Instantly share code, notes, and snippets.

@johnnybui
Last active March 14, 2020 01:07
Show Gist options
  • Save johnnybui/555560d23d5be9e89ff2930f5013048b to your computer and use it in GitHub Desktop.
Save johnnybui/555560d23d5be9e89ff2930f5013048b to your computer and use it in GitHub Desktop.
Raspberry Pi Raspbian System Monitor Shell Script
#!/bin/bash
cpu=$(vcgencmd measure_clock arm)
core=$(vcgencmd measure_clock core)
h264=$(vcgencmd measure_clock h264)
isp=$(vcgencmd measure_clock isp)
v3d=$(vcgencmd measure_clock v3d)
temp=$(vcgencmd measure_temp)
volt=$(vcgencmd measure_volts core)
ram_free=$(awk '/^Mem/ {print $7}' <(free -h))
ram_total=$(awk '/^Mem/ {print $2}' <(free -h))
throttled=$(vcgencmd get_throttled)
cpu_value=${cpu/frequency(48)=/}
cpu_fvalue=$(numfmt --to=si --suffix=hz --round=nearest $cpu_value)
core_value=${core/frequency(1)=/}
core_fvalue=$(numfmt --to=si --suffix=hz --round=nearest $core_value)
h264_value=${h264/frequency(28)=/}
h264_fvalue=$(numfmt --to=si --suffix=hz --round=nearest $h264_value)
isp_value=${isp/frequency(45)=/}
isp_fvalue=$(numfmt --to=si --suffix=hz --round=nearest $isp_value)
v3d_value=${v3d/frequency(46)=/}
v3d_fvalue=$(numfmt --to=si --suffix=hz --round=nearest $v3d_value)
temp_value=${temp/temp=/}
volt_value=${volt/volt=/}
throttled_value=${throttled/throttled=/}
echo "temp $temp_value"
echo "cpu_clock $cpu_fvalue"
echo "gpu_core_clock $core_fvalue"
echo "h264_clock $h264_fvalue"
echo "isp_clock $isp_fvalue"
echo "v3d_clock $v3d_fvalue"
echo "core_volt $volt_value"
echo "free_ram $ram_free/$ram_total"
echo "throttled $throttled_value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment