add steal, guest, guest_nice to cpu_times in linux.

pull/4/head
Shirou WAKAYAMA 11 years ago
parent 4c6a276474
commit 3b296e2ab2

@ -42,6 +42,18 @@ func Cpu_times() ([]CPU_TimesStat, error) {
Softirq: softirq, Softirq: softirq,
Stolen: stolen, Stolen: stolen,
} }
if len(fields) > 9 { // Linux >= 2.6.11
steal, _ := strconv.ParseUint(fields[9], 10, 64)
ct.Steal = steal
}
if len(fields) > 10 { // Linux >= 2.6.24
guest, _ := strconv.ParseUint(fields[10], 10, 64)
ct.Guest = guest
}
if len(fields) > 11 { // Linux >= 3.2.0
guest_nice, _ := strconv.ParseUint(fields[11], 10, 64)
ct.Guest_nice = guest_nice
}
ret = append(ret, ct) ret = append(ret, ct)
} }

Loading…
Cancel
Save