GPUs: fan speed in % per card (nvidia-smi fan.speed, hwmon pwm1); 0% shows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-11-14 17:09:10 -08:00
co-authored by Claude Opus 5.5
parent 95bb026b7f
commit afd4688358
5 changed files with 37 additions and 5 deletions
+14
View File
@@ -182,6 +182,20 @@ func TestParseNvidiaQuery(t *testing.T) {
if g.Temp != 57 || g.TempSrc != "gpu" || g.PowerW != 23.4 || g.PowerCapW != 0 {
t.Errorf("temp/power (cap must stay 0 for [N/A]): %+v", g)
}
if g.FanPct != nil {
t.Errorf("no fan field must leave the fan unset: %+v", g)
}
var fan, nofan GPU
parseNvidiaQuery(&fan, "99, 0, 0, 20000, 24576, 1695, 2100, 83, 403.99, 420.00, 34\n")
parseNvidiaQuery(&nofan, "5, 0, 0, 500, 2048, 300, 1097, 45, 8.0, [N/A], [N/A]\n")
if fan.FanPct == nil || *fan.FanPct != 34 || nofan.FanPct != nil {
t.Errorf("fan: %v, [N/A]: %v", fan.FanPct, nofan.FanPct)
}
var stopped GPU
parseNvidiaQuery(&stopped, "0, 0, 0, 500, 24576, 210, 2100, 35, 20.0, 420.00, 0\n")
if stopped.FanPct == nil || *stopped.FanPct != 0 {
t.Errorf("a stopped fan must read 0, not nothing: %v", stopped.FanPct)
}
var short GPU
parseNvidiaQuery(&short, "garbage")
if short.UsageSrc != "" {