fix CPUTimes type change problem on other packages.

pull/43/merge
Shirou WAKAYAMA 10 years ago
parent 753ea1bb48
commit 4ead971d70

@ -83,15 +83,15 @@ func CgroupCPU(containerid string, base string) (*cpu.CPUTimesStat, error) {
for _, line := range lines {
fields := strings.Split(line, " ")
if fields[0] == "user" {
user, err := strconv.ParseFloat(fields[1], 32)
user, err := strconv.ParseFloat(fields[1], 64)
if err == nil {
ret.User = float32(user)
ret.User = float64(user)
}
}
if fields[0] == "system" {
system, err := strconv.ParseFloat(fields[1], 32)
system, err := strconv.ParseFloat(fields[1], 64)
if err == nil {
ret.System = float32(system)
ret.System = float64(system)
}
}
}

@ -552,8 +552,8 @@ func (p *Process) fillFromStat() (string, int32, *cpu.CPUTimesStat, int64, int32
cpuTimes := &cpu.CPUTimesStat{
CPU: "cpu",
User: float32(utime * (1000 / ClockTicks)),
System: float32(stime * (1000 / ClockTicks)),
User: float64(utime * (1000 / ClockTicks)),
System: float64(stime * (1000 / ClockTicks)),
}
bootTime, _ := host.BootTime()

Loading…
Cancel
Save