diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go index f9bea2f86..bf43266e4 100644 --- a/runsc/cgroup/cgroup.go +++ b/runsc/cgroup/cgroup.go @@ -643,7 +643,7 @@ func (c *cgroupV1) CPUQuota() (float64, error) { return float64(quota) / float64(period), nil } -// CPUUsage returns the total CPU usage of the cgroup. +// CPUUsage returns the total CPU usage of the cgroup in nanoseconds. func (c *cgroupV1) CPUUsage() (uint64, error) { path := c.MakePath("cpuacct") usage, err := getValue(path, "cpuacct.usage") diff --git a/runsc/cgroup/cgroup_v2.go b/runsc/cgroup/cgroup_v2.go index bfc20e468..f956165c8 100644 --- a/runsc/cgroup/cgroup_v2.go +++ b/runsc/cgroup/cgroup_v2.go @@ -286,7 +286,7 @@ func parseCPUQuota(cpuMax string) (float64, error) { } -// CPUUsage returns the total CPU usage of the cgroup. +// CPUUsage returns the total CPU usage of the cgroup in nanoseconds. func (c *cgroupV2) CPUUsage() (uint64, error) { cpuStat, err := getValue(c.MakePath(""), "cpu.stat") if err != nil { @@ -300,7 +300,7 @@ func (c *cgroupV2) CPUUsage() (uint64, error) { return 0, err } if key == "usage_usec" { - return value, nil + return value * 1000, nil } }