Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cpuvinf 1.2
# cpuvinf 1.3
CPUVInf - Raspberry Pi Diagnostics Tool<br /><br /><br />
<B>What is CPUVINF?</B><br /><br />
<B>What is CPUVInf?</B><br /><br />
CPUVInf is a tiny, simple and useful diagnostics tool for the Raspberry Pi minicomputer series written purely in shell scripting language. It is compatible with all Raspberry Pi 1 and all Raspberry Pi 2 minicomputers and therefore with all available Linux based operating systems for the Raspberry Pi series. It started off as a small script to read CPU temperature and voltage but has become much more than that.<br /><br /><br />
<B>Full list of compatible OS:</B>
<ul>
Expand All @@ -20,6 +20,11 @@ System Voltages<br />
CPUVInf is capable of reading various system voltages and converting the output into Volt values. Voltage types: core, SDRAM core, SDRAM I/O and SDRAM PHY voltages.<br /><br />
Memory Split<br />
CPUVInf can display the assigned RAM for the internal GPU and system RAM (usable RAM) in MB values.<br /><br /><br />
<B>Installation<B><br /><br />
1. Clone: <pre>git clone https://github.com/tnyim/cpuvinf.git</pre><br />
2. Make executable: <pre>cd cpuvinf && chmod +x ./cpuvinf</pre><br />
3. Move to system directory: <pre>sudo mv ./cpuvinf /usr/bin</pre><br />
<br /><br />
<B>Usage</B><br /><br />
CPU & GPU Temperature<br />
<pre>cpuvinf -t
Expand Down
38 changes: 23 additions & 15 deletions cpuvinf
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
#!/bin/bash
#!/bin/env bash

###################################################
# CPUVInf 1.2 - Raspberry Pi Diagnostics Tool #
# Copyright© 2014 - 2017 by Hidden-Refuge #
# CPUVInf 1.3 - Raspberry Pi Diagnostics Tool #
# Copyright© 2014 - 2023 by Hidden-Refuge #
# License: GNU GPL 3 #
# https://www.gnu.org/licenses/gpl.html #
###################################################
# A TNY Network driven project #
# Visit us at https://i.tny.im/ #
# Copyright© 2011 - 2017 by TNY Network #
# Copyright© 2011 - 2023 by TNY Network #
###################################################

# Test vcgencmd; depending on the configuraton, a 32-bit binary may be present
# in /opt/vc/bin on a 64-bit system. An appropriate one is probably in /usr/bin.
_vcgencmd=$( command -v vcgencmd )
if [ -z "$_vcgencmd" ] || ! $_vcgencmd commands >/dev/null 2>&1; then
echo -e "\x1b[31mcpuvinf: error: unable to execute vcgencmd; please check your configuration\x1b[0m"
exit 1
fi

# Current CPU/GPU temperatures in Celsius and Fa-
# renheit
temp () {
Expand All @@ -25,12 +33,12 @@ temp () {
}

# CPU/GPU frequencies in MHz and CPU governor
clock () {
clock () {
mintmp=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq )
maxtmp=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq )
curtmp=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq )
gov=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor )
gputmp=$( /opt/vc/bin/vcgencmd measure_clock core | sed -r 's/^.{13}//' )
gputmp=$( $_vcgencmd measure_clock core | sed -r 's/^.{13}//' )
minfreq=$( expr $mintmp / 1000 )
maxfreq=$( expr $maxtmp / 1000 )
curfreq=$( expr $curtmp / 1000 )
Expand All @@ -47,11 +55,11 @@ clock () {
}

# System voltages in Volt (Core, SDRAM, etc...)
volt () {
vcore=$( /opt/vc/bin/vcgencmd measure_volts core | sed 's/volt=//' )
vsdramcore=$( /opt/vc/bin/vcgencmd measure_volts sdram_c | sed 's/volt=//' )
vsdramio=$( /opt/vc/bin/vcgencmd measure_volts sdram_i | sed 's/volt=//' )
vsdramphy=$( /opt/vc/bin/vcgencmd measure_volts sdram_p | sed 's/volt=//' )
volt () {
vcore=$( $_vcgencmd measure_volts core | sed 's/volt=//' )
vsdramcore=$( $_vcgencmd measure_volts sdram_c | sed 's/volt=//' )
vsdramio=$( $_vcgencmd measure_volts sdram_i | sed 's/volt=//' )
vsdramphy=$( $_vcgencmd measure_volts sdram_p | sed 's/volt=//' )
echo ""
echo "System Voltages"
echo ""
Expand All @@ -65,8 +73,8 @@ volt () {
# Memorysplit for system usable RAM and GPU
# usable RAM
memorysplit () {
systemram=$( /opt/vc/bin/vcgencmd get_mem arm | sed -r 's/^.{4}//' )
gpuram=$( /opt/vc/bin/vcgencmd get_mem gpu | sed -r 's/^.{4}//')
systemram=$( $_vcgencmd get_mem arm | sed -r 's/^.{4}//' )
gpuram=$( $_vcgencmd get_mem gpu | sed -r 's/^.{4}//')
echo ""
echo "Memorysplit"
echo ""
Expand All @@ -78,9 +86,9 @@ memorysplit () {
# Help
help () {
echo ""
echo "cpuvinf 1.2 by Hidden Refuge <me at hiddenrefuge dot eu dot org>"
echo "cpuvinf 1.3 by Hidden Refuge <me at hiddenrefuge dot eu dot org>"
echo ""
echo "Usage: cpuvinf <option>"
echo "Usage: cpuvinf <option>"
echo ""
echo "Available options:"
echo "-t, --temperature Displays CPU/GPU temperature in °C/°F."
Expand Down