[process]: fix CPU_Percent always 0 if duration > 0 (#172)

v1
Shirou WAKAYAMA 9 years ago
parent 715c421b57
commit 627d2a9871

@ -118,6 +118,7 @@ func (p *Process) CPUPercent(interval time.Duration) (float64, error) {
p.lastCPUTime = now
time.Sleep(interval)
cpuTimes, err = p.CPUTimes()
now = time.Now()
if err != nil {
return 0, err
}

Loading…
Cancel
Save