use linux perf tool for amd power usage,

add support for intel DC ssds
This commit is contained in:
alu
2026-08-18 10:16:06 -07:00
parent a474ff2511
commit b66b7cad59
4 changed files with 152 additions and 7 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ import (
"time"
)
const milliJoulePerJoule = float64(1000000)
const microJoulePerJoule = float64(1000000)
type EnergyState struct {
lastEnergy uint64
@@ -36,7 +36,7 @@ func (r *RaplDriver) Render(term common.Terminal) error {
}
power := p.([]PowerSensor)
term.Subheader("Power /sys/class/powercap/intel-rapl")
term.Subheader("Power (rapl)")
for _, sensor := range power {
// \033[K clears from cursor to end of line (prevents lingering chars)
@@ -127,7 +127,7 @@ func (r *RaplDriver) calculateEnergyDelta(inputs []string, out *[]PowerSensor) {
// the value will be off for that one measurement, then become correct again
energyDiff := float64(microJoules - prevState.lastEnergy)
watts := (energyDiff / milliJoulePerJoule) / timeDiff
watts := (energyDiff / microJoulePerJoule) / timeDiff
r.energyState[path] = EnergyState{
lastEnergy: microJoules,