Use PSU SDR sum for system power chart when available
DCMI reports only the managed power domain (~CPU+MB), missing GPU draw. PSU AC input sensors cover full wall power. When samplePSUPower returns data, sum the slots for PowerW; fall back to DCMI otherwise. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,12 +64,20 @@ func SampleLiveMetrics() LiveMetricSample {
|
||||
}
|
||||
}
|
||||
|
||||
// System power — returns 0 if unavailable
|
||||
s.PowerW = sampleSystemPower()
|
||||
|
||||
// Per-PSU power — populated when IPMI SDR has Power Supply entities with Watt readings
|
||||
s.PSUs = samplePSUPower()
|
||||
|
||||
// System power: prefer sum of PSU AC inputs (full wall draw); fall back to DCMI.
|
||||
if len(s.PSUs) > 0 {
|
||||
var total float64
|
||||
for _, p := range s.PSUs {
|
||||
total += p.PowerW
|
||||
}
|
||||
s.PowerW = total
|
||||
} else {
|
||||
s.PowerW = sampleSystemPower()
|
||||
}
|
||||
|
||||
// CPU load — from /proc/stat
|
||||
s.CPULoadPct = sampleCPULoadPct()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user