Skip to content

Commit 0d39448

Browse files
author
Anup Chenthamarakshan
committed
Print Cgroup stats. Useful to find out if a test is getting CPU throttled.
Summary: Appears in log file like: ``` 2015/10/21 01:18:05 [lxc] Cgroup stats: [nr_periods 189 nr_throttled 47 throttled_time 4185982625] ``` - nr_periods is the number of times CPU limit was checked (since period is 100ms, this is usually total wall clock time * 10) - nr_throttled is number of periods where throttling was applied (this should ideally be 0, or a very small fraction of nr_periods). Large percentage of nr_period (> ~25%) means heavy throttling. We should consider alerting on this. - throttled_time is amount of time in nanoseconds which the process could have used had throttling not been in place. Don't read much into this. Test Plan: Unit tests passed Reviewers: kylec Reviewed By: kylec Subscribers: changesbot, mkedia, nate Differential Revision: https://tails.corp.dropbox.com/D147274
1 parent de55939 commit 0d39448

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adapter/lxc/container.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,11 @@ func (c *Container) logResourceUsageStats(log *client.Log) {
458458
} else {
459459
log.Printf("[lxc] Total CPU time: %s", total)
460460
}
461+
if cgroupStats := c.lxc.CgroupItem("cpu.stat"); cgroupStats == nil {
462+
log.Printf("[lxc] Failed to get Cgroup stats")
463+
} else {
464+
log.Printf("[lxc] Cgroup stats: %v", cgroupStats)
465+
}
461466

462467
times, e := c.lxc.CPUTimePerCPU()
463468
if e != nil {

0 commit comments

Comments
 (0)