cpu: Steal, Guest, and GuestNice are not divided by CPU_TICK.

This commit is contained in:
Shirou WAKAYAMA 2015-07-17 22:11:30 +09:00
parent 4bc631921f
commit 5854011870
1 changed files with 3 additions and 3 deletions

View File

@ -180,21 +180,21 @@ func parseStatLine(line string) (*CPUTimesStat, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
ct.Steal = float64(steal) ct.Steal = float64(steal) / cpu_tick
} }
if len(fields) > 9 { // Linux >= 2.6.24 if len(fields) > 9 { // Linux >= 2.6.24
guest, err := strconv.ParseFloat(fields[9], 64) guest, err := strconv.ParseFloat(fields[9], 64)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ct.Guest = float64(guest) ct.Guest = float64(guest) / cpu_tick
} }
if len(fields) > 10 { // Linux >= 3.2.0 if len(fields) > 10 { // Linux >= 3.2.0
guestNice, err := strconv.ParseFloat(fields[10], 64) guestNice, err := strconv.ParseFloat(fields[10], 64)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ct.GuestNice = float64(guestNice) ct.GuestNice = float64(guestNice) / cpu_tick
} }
return ct, nil return ct, nil