CPUTimes percpu for Linux

pull/25/head
KenjiTakahashi 11 years ago
parent 58537fc519
commit 1739d4640a

@ -10,7 +10,13 @@ import (
func CPUTimes(percpu bool) ([]CPUTimesStat, error) {
filename := "/proc/stat"
lines, _ := readLines(filename)
var lines []string
if percpu {
ncpu, _ := CPUCounts(true)
lines, _ = readLinesOffsetN(filename, 1, ncpu)
} else {
lines, _ = readLinesOffsetN(filename, 0, 1)
}
ret := make([]CPUTimesStat, 0, len(lines))

Loading…
Cancel
Save