From 5854011870cbfbeb94e78c80546d7f5a55b6bf43 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Fri, 17 Jul 2015 22:11:30 +0900 Subject: [PATCH] cpu: Steal, Guest, and GuestNice are not divided by CPU_TICK. --- cpu/cpu_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go index 74054dd..942ef0c 100644 --- a/cpu/cpu_linux.go +++ b/cpu/cpu_linux.go @@ -180,21 +180,21 @@ func parseStatLine(line string) (*CPUTimesStat, error) { if err != nil { return nil, err } - ct.Steal = float64(steal) + ct.Steal = float64(steal) / cpu_tick } if len(fields) > 9 { // Linux >= 2.6.24 guest, err := strconv.ParseFloat(fields[9], 64) if err != nil { return nil, err } - ct.Guest = float64(guest) + ct.Guest = float64(guest) / cpu_tick } if len(fields) > 10 { // Linux >= 3.2.0 guestNice, err := strconv.ParseFloat(fields[10], 64) if err != nil { return nil, err } - ct.GuestNice = float64(guestNice) + ct.GuestNice = float64(guestNice) / cpu_tick } return ct, nil