Files
docker-cli/components/engine/cli/command
Ian Campbell 6f5f3ec34f Correct CPU usage calculation in presence of offline CPUs and newer Linux
In https://github.com/torvalds/linux/commit/5ca3726 (released in v4.7-rc1) the
content of the `cpuacct.usage_percpu` file in sysfs was changed to include both
online and offline cpus. This broke the arithmetic in the stats helpers used by
`docker stats`, since it was using the length of the PerCPUUsage array as a
proxy for the number of online CPUs.

Add current number of online CPUs to types.StatsJSON and use it in the
calculation.

Keep a fallback to `len(v.CPUStats.CPUUsage.PercpuUsage)` so this code
continues to work when talking to an older daemon. An old client talking to a
new daemon will ignore the new field and behave as before.

Fixes #28941.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Upstream-commit: 115f91d7575d6de6c7781a96a082f144fd17e400
Component: engine
2017-03-10 10:24:33 +00:00
..
2017-03-03 16:33:34 -08:00
2016-11-08 16:17:15 -08:00
2017-02-20 17:32:28 -05:00
2016-12-12 09:34:03 +01:00
2017-02-07 11:08:37 -08:00
2016-12-20 21:05:19 +08:00
2017-02-10 16:53:04 -08:00
2016-09-19 10:34:31 -07:00