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

This commit is contained in:
Shirou WAKAYAMA 2016-03-09 10:09:27 +09:00
parent 715c421b57
commit 627d2a9871
1 changed files with 1 additions and 0 deletions

View File

@ -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
}