Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions utils/hwstats/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ func (c *CPUStats) monitorProcesses() {
}

for pid, stat := range procStats {
memory := stat.RSS * pageSize
stats.Memory[pid] += memory
stats.MemoryTotal += memory

// process usage as percent of total host cpu
procPercentUsage := float64(stat.UTime + stat.STime - prevStats[pid].UTime - prevStats[pid].STime)
if procPercentUsage == 0 {
Expand All @@ -219,10 +223,6 @@ func (c *CPUStats) monitorProcesses() {
cpu := hostCPU * procPercentUsage / 100 / (totalHostTime - prevTotalTime)
stats.Cpu[pid] += cpu
stats.CpuIdle -= cpu

memory := stat.RSS * pageSize
stats.Memory[pid] += memory
stats.MemoryTotal += memory
}

c.idleCPUs.Store(stats.CpuIdle)
Expand Down
Loading