From b8f51de8f62c2aadd8814a9358bf21a831444226 Mon Sep 17 00:00:00 2001 From: alialaee Date: Tue, 15 Oct 2019 19:19:12 +0330 Subject: [PATCH] Fix #777 cpu.Total should not add Guest and GuestNice --- cpu/cpu.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/cpu.go b/cpu/cpu.go index ec0a85c..2372ce3 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -87,8 +87,8 @@ func (c TimesStat) String() string { // Total returns the total number of seconds in a CPUTimesStat func (c TimesStat) Total() float64 { - total := c.User + c.System + c.Nice + c.Iowait + c.Irq + c.Softirq + c.Steal + - c.Guest + c.GuestNice + c.Idle + total := c.User + c.System + c.Nice + c.Iowait + c.Irq + c.Softirq + + c.Steal + c.Idle return total } @@ -99,7 +99,7 @@ func (c InfoStat) String() string { func getAllBusy(t TimesStat) (float64, float64) { busy := t.User + t.System + t.Nice + t.Iowait + t.Irq + - t.Softirq + t.Steal + t.Guest + t.GuestNice + t.Softirq + t.Steal return busy + t.Idle, busy }