mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
cgroups: fix times conversion
convert the time we read in microseconds to nanoseconds. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -30,7 +30,7 @@ type CgroupControl struct {
|
||||
additionalControllers []controller
|
||||
}
|
||||
|
||||
// CPUUsage keeps stats for the CPU usage
|
||||
// CPUUsage keeps stats for the CPU usage (unit: nanoseconds)
|
||||
type CPUUsage struct {
|
||||
Kernel uint64
|
||||
Total uint64
|
||||
|
@ -85,12 +85,14 @@ func (c *cpuHandler) Stat(ctr *CgroupControl, m *Metrics) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
usage.Kernel *= 1000
|
||||
}
|
||||
if val, found := values["system_usec"]; found {
|
||||
usage.Total, err = strconv.ParseUint(cleanString(val[0]), 10, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
usage.Total *= 1000
|
||||
}
|
||||
// FIXME: How to read usage.PerCPU?
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user