[process]: fix CPU_Percent always 0 if duration > 0 (#172)
This commit is contained in:
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…
Reference in New Issue