summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsb-gpu8
1 files changed, 5 insertions, 3 deletions
diff --git a/sb-gpu b/sb-gpu
index dfd24d7..a43bd3b 100755
--- a/sb-gpu
+++ b/sb-gpu
@@ -1,13 +1,15 @@
#!/bin/sh
lspci -k | grep -q "VGA compatible controller: NVIDIA" && NVIDIACard=1
getGPUClock() {
- sed -n "s/[0-9]: //g;/*/ {s/\s.*//; p}" /sys/class/drm/card1/device/pp_dpm_sclk
+# sed -n "s/[0-9]: //g;/*/ {s/\s.*//; p}" /sys/class/drm/card1/device/pp_dpm_sclk
+ GPUClock=$(cat /sys/class/drm/card1/device/hwmon/hwmon*/freq1_input)
+ numfmt --to=iec $GPUClock --format %1.1f
}
getGPUBusy() {
cat /sys/class/drm/card1/device/gpu_busy_percent
}
getGPUTemperature() {
- sed "s/000//" /sys/class/drm/card1/device/hwmon/hwmon1/temp1_input
+ sed "s/000//" /sys/class/drm/card1/device/hwmon/hwmon*/temp1_input
}
getGPUVRAM() {
usedRAM=$(cat /sys/class/drm/card1/device/mem_info_vram_used)
@@ -29,5 +31,5 @@ if [ "$NVIDIACard" ]
then
printf "%s\n" "$(getNVIDIA)"
else
-printf "%s %s %s%% 🌡️%s°\n" "$(getGPUClock)" "$(getGPUVRAM)" "$(getGPUBusy)" "$(getGPUTemperature)"
+printf "%s %s %s%% 🌡️%s°\n" "$(getGPUClock)Hz" "$(getGPUVRAM)" "$(getGPUBusy)" "$(getGPUTemperature)"
fi