Skip to content

Commit bf349ae

Browse files
authored
Merge pull request #431 from mtrmac/cgroup-usage
Fix parsing of cgroupv2 cpu.stat
2 parents 4074f8d + 88e2cc6 commit bf349ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common/pkg/cgroups/cpu_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ func (c *linuxCPUHandler) Stat(ctr *CgroupControl, m *cgroups.Stats) error {
4040
if err != nil {
4141
return err
4242
}
43-
cpu.CpuUsage.UsageInKernelmode *= 1000
43+
cpu.CpuUsage.TotalUsage *= 1000
4444
}
4545
if val, found := values["system_usec"]; found {
4646
cpu.CpuUsage.UsageInKernelmode, err = strconv.ParseUint(cleanString(val[0]), 10, 64)
4747
if err != nil {
4848
return err
4949
}
50-
cpu.CpuUsage.TotalUsage *= 1000
50+
cpu.CpuUsage.UsageInKernelmode *= 1000
5151
}
5252
m.CpuStats = cpu
5353
return nil

0 commit comments

Comments
 (0)