moby/docs/api
Ian Campbell 9b001c4f5f 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>
(cherry picked from commit 115f91d757)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-03-13 16:16:05 -07:00
..
v1.18.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.19.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.20.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.21.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.22.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.23.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
v1.24.md Merge pull request #30898 from allencloud/add-link-query-in-container-rm-api-doc 2017-02-22 00:48:39 +01:00
version-history.md Correct CPU usage calculation in presence of offline CPUs and newer Linux 2017-03-13 16:16:05 -07:00