core/subsystem/usage.go in perfmonger-0.8.2 vs core/subsystem/usage.go in perfmonger-0.9.0
- old
+ new
@@ -94,10 +94,22 @@
func GetCpuCoreUsage(c1 *CpuCoreStat, c2 *CpuCoreStat) (*CpuCoreUsage, error) {
usage := new(CpuCoreUsage)
itv := c2.Uptime() - c1.Uptime()
if itv == 0 {
- return nil, errors.New("uptime difference is zero")
+ // return nil, errors.New("uptime difference is zero")
+ usage.User = 0
+ usage.Nice = 0
+ usage.Sys = 0
+ usage.Idle = 0
+ usage.Iowait = 0
+ usage.Hardirq = 0
+ usage.Softirq = 0
+ usage.Steal = 0
+ usage.Guest = 0
+ usage.GuestNice = 0
+
+ return usage, nil
} else if itv < 0 {
return nil, errors.New("uptime difference is negative")
}
user := usageItem(c1.User-c1.Guest, c2.User-c2.Guest, itv)