moby/api/types
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
..
backend record pid of exec'd process 2016-10-20 17:06:11 +02:00
blkiodev Add engine-api types to docker 2016-09-07 11:05:58 -07:00
container do not force target type for secret references 2016-11-21 14:45:39 -08:00
events Add engine-api types to docker 2016-09-07 11:05:58 -07:00
filters Fixes ImageList to be retro-compatible with older API 2016-11-29 14:10:44 -08:00
mount Move ConvertVolumes to composetransform package. 2017-01-25 15:42:06 -05:00
network Show peer nodes in network inspect for swarm overlay networks 2016-11-09 13:58:04 -08:00
reference Add engine-api types to docker 2016-09-07 11:05:58 -07:00
registry generate AuthResponse type from swagger spec. 2016-10-31 11:16:03 -04:00
strslice Add engine-api types to docker 2016-09-07 11:05:58 -07:00
swarm Handle logging in compose to swarm 2016-12-07 16:14:20 -08:00
time Add engine-api types to docker 2016-09-07 11:05:58 -07:00
versions api: types: keep info.SecurityOptions a string slice 2016-11-21 14:45:05 -08:00
volume Return warnings from service create and service update when digest pinning fails 2016-11-18 13:57:11 -08:00
auth.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
client.go Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
configs.go Enforce zero plugin refcount during disable. 2016-12-27 13:19:25 -08:00
error_response.go Update to inline comments. 2016-10-31 11:13:41 -04:00
id_response.go Add an IDResponse type 2016-10-31 11:16:02 -04:00
image_summary.go Generate api/types:Image from the swagger spec 2016-10-20 13:24:23 -07:00
plugin.go Add docker plugin upgrade 2017-02-03 19:14:56 -05:00
plugin_device.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_env.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_interface_type.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_mount.go Generate plugin types from the swagger spec. 2016-10-20 13:24:23 -07:00
plugin_responses.go Rename Remote API to Engine API 2016-11-22 16:49:58 -08:00
port.go Generate api/types:Port from swagger spec. 2016-10-20 13:24:23 -07:00
seccomp.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
service_update_response.go Return warnings from service create and service update when digest pinning fails 2016-11-18 13:57:11 -08:00
stats.go Correct CPU usage calculation in presence of offline CPUs and newer Linux 2017-03-13 16:16:05 -07:00
types.go Convert DanglingOnly to Filters for docker image prune 2016-12-07 16:08:18 -08:00
volume.go Return warnings from service create and service update when digest pinning fails 2016-11-18 13:57:11 -08:00