From ee3b563de7e96a89eb647f26fb00b4b2f51547ce Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Fri, 16 Apr 2021 11:30:12 +0200 Subject: [PATCH] Add cfs throttle stats to cgroup v2 Signed-off-by: Odin Ugedal --- libcontainer/cgroups/fs2/cpu.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libcontainer/cgroups/fs2/cpu.go b/libcontainer/cgroups/fs2/cpu.go index b7331338f..8ace0ce7b 100644 --- a/libcontainer/cgroups/fs2/cpu.go +++ b/libcontainer/cgroups/fs2/cpu.go @@ -70,6 +70,15 @@ func statCpu(dirPath string, stats *cgroups.Stats) error { case "system_usec": stats.CpuStats.CpuUsage.UsageInKernelmode = v * 1000 + + case "nr_periods": + stats.CpuStats.ThrottlingData.Periods = v + + case "nr_throttled": + stats.CpuStats.ThrottlingData.ThrottledPeriods = v + + case "throttled_usec": + stats.CpuStats.ThrottlingData.ThrottledTime = v * 1000 } } return nil