Files
docker-cli/components/engine/daemon
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-02-07 11:08:37 -08:00
2016-11-14 15:15:09 -05:00
2017-02-22 09:48:18 +08:00
2016-09-07 11:05:58 -07:00
2016-10-28 11:06:54 -07:00
2016-12-21 22:42:47 +01:00
2016-10-25 06:43:54 +00:00
2017-02-07 11:08:37 -08:00
2016-11-16 13:38:45 -08:00
2017-02-15 21:57:27 +08:00
2016-11-03 10:05:11 -07:00
2016-11-03 10:05:11 -07:00
2016-11-03 10:05:11 -07:00
2016-11-17 13:10:48 -05:00
2017-02-07 11:08:37 -08:00
2016-09-07 11:05:58 -07:00
2016-11-08 17:41:56 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2017-02-07 11:08:37 -08:00
2016-12-27 23:30:50 +08:00
2016-12-01 09:38:08 -08:00
2016-10-06 22:48:53 -03:00
2016-09-07 11:05:58 -07:00
2016-10-27 10:34:38 -07:00
2016-09-13 09:55:35 -04:00
2017-02-02 11:25:07 -08:00
2017-02-15 21:57:27 +08:00
2017-01-11 21:35:59 +08:00
2016-12-27 21:46:52 +08:00
2016-09-07 11:05:58 -07:00
2017-02-01 14:43:58 -05:00
2016-09-21 12:36:52 +02:00
2016-09-16 11:56:15 -07:00
2016-12-27 23:30:50 +08:00
2016-09-07 11:05:58 -07:00
2016-11-21 19:56:01 +08:00