diff options
author | Ondrej Čerman | 2018-11-10 23:28:24 +0100 |
---|---|---|
committer | Ondrej Čerman | 2018-11-10 23:28:24 +0100 |
commit | a262d8a902c6e3ddf5bf389a037b096de0de8024 (patch) | |
tree | fcb253d21ef1f3efd6db055f770c83fa7ba1c097 |
Initial commit
-rwxr-xr-x | zenmonitor | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/zenmonitor b/zenmonitor new file mode 100755 index 0000000..4f31716 --- /dev/null +++ b/zenmonitor @@ -0,0 +1,44 @@ +#!/bin/bash + +hwmon="/sys/class/hwmon" +mdevs=`ls $hwmon` +zenmon="" + +echo -n "Looking for zenpower ..." + +for dev in $mdevs; do + path="$hwmon/$dev" + devname=`cat $path/name` + if [ "$devname" == "zenpower" ]; then + zenmon="$path" + fi +done + +if [ -z "$zenmon" ]; then + echo "NOT FOUND" + exit +else + echo "Found" +fi + +echo Starting Monitor... +echo Press Q to exit. +echo + +while true; do + core=(`cat $zenmon/in1_input $zenmon/curr1_input $zenmon/power1_input`) + soc=(`cat $zenmon/in2_input $zenmon/curr2_input $zenmon/power2_input`) + temps=(`cat $zenmon/temp1_input $zenmon/temp2_input`) + + echo "${core[0]} ${core[1]} ${core[2]}" | awk '{ printf " Core: %7.3fV %7.3fA %7.3fW\n", $1 / 1000, $2 / 1000, $3 / 1000000 }' + echo "${soc[0]} ${soc[1]} ${soc[2]}" | awk '{ printf " SoC: %7.3fV %7.3fA %7.3fW\n", $1 / 1000, $2 / 1000, $3 / 1000000 }' + echo "${temps[0]} ${temps[1]}" | awk '{ printf " tDie: %6.2f°C\ntCtrl: %6.2f°C\n", $1 / 1000, $2 / 1000 }' + + read -t 0.2 -N 1 input + if [[ $input = "q" ]] || [[ $input = "Q" ]]; then + echo + break + fi + + echo -en "\e[4A" +done |