The Docker CLI
Go to file
Ian Campbell 54a5077ca5 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>
2017-03-10 10:24:33 +00:00
command Correct CPU usage calculation in presence of offline CPUs and newer Linux 2017-03-10 10:24:33 +00:00
compose Merge pull request #31088 from xulike666/make-code-readable-again 2017-02-16 22:04:27 -05:00
config Merge pull request #28213 from yongtang/11062016-service-ps-format 2017-02-17 10:23:18 -08:00
debug Move debug functions to cli/debug package 2016-12-12 09:33:58 +01:00
flags fix the type 2017-02-14 09:54:27 +08:00
internal/test Add unit tests to cli/command/volume package 2017-02-27 18:39:35 +01:00
trust Use distribution reference 2017-02-07 11:08:37 -08:00
cobra.go Wrap output of docker cli --help 2017-02-03 11:05:49 +00:00
error.go Remove old cli framework. 2016-08-25 13:09:04 -04:00
required.go fix typos 2016-07-05 20:42:17 +08:00