1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/cli/command/container
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
..
attach.go context.Context should be the first parameter of a function 2016-11-22 18:43:29 -08:00
cmd.go refactor help func in CLI 2016-11-18 13:30:44 -08:00
commit.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
cp.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
create.go Support for docker content trust for plugins 2016-12-27 14:27:28 -08:00
diff.go Merge pull request #29603 from mstanleyjones/docker_diff_improvements 2017-02-22 00:46:02 +01:00
exec.go fix incorrect ErrConnectFailed comparison 2016-11-22 11:23:49 -08:00
exec_test.go Remove redundant parameter and fix typos 2016-11-10 11:05:31 +08:00
export.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
hijack.go Move image trust related cli methods into the image package. 2016-09-09 10:50:16 -04:00
inspect.go Fix typs from go to Go 2016-10-18 19:40:16 +08:00
kill.go Support parallel kill 2016-09-28 12:03:19 +08:00
list.go Fix failure in docker ps --format when .Label has args 2017-01-24 17:45:05 -08:00
logs.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
pause.go Add parallel operation support for pause/unpause 2016-09-13 11:01:28 +08:00
port.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
prune.go Convert DanglingOnly to Filters for docker image prune 2016-12-07 16:08:18 -08:00
ps_test.go Use map[string]bool for preProcessor to ignore unknwon field 2016-11-18 13:42:21 -08:00
rename.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
restart.go Update docker stop and docker restart to allow not specifying timeout and use the one specified at container creation time. 2016-10-17 12:53:35 -07:00
rm.go Support parallel rm 2016-09-28 12:07:18 +08:00
run.go [17.03.x] fix autoremove on pre 1.25 API 2017-03-09 11:59:11 +01:00
start.go context.Context should be the first parameter of a function 2016-11-22 18:43:29 -08:00
stats.go context.Context should be the first parameter of a function 2016-11-22 18:43:29 -08:00
stats_helpers.go Correct CPU usage calculation in presence of offline CPUs and newer Linux 2017-03-13 16:16:05 -07:00
stats_unit_test.go Update function name for TestCalculBlockIO 2016-11-09 17:43:10 +08:00
stop.go Update docker stop and docker restart to allow not specifying timeout and use the one specified at container creation time. 2016-10-17 12:53:35 -07:00
top.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00
tty.go Windows: OCI process struct convergence 2016-09-19 10:34:31 -07:00
unpause.go Add parallel operation support for pause/unpause 2016-09-13 11:01:28 +08:00
update.go Fixes #27798 : Update help for --blkio-weight parameter 2016-11-03 06:42:15 +00:00
utils.go context.Context should be the first parameter of a function 2016-11-22 18:43:29 -08:00
wait.go Move api/client -> cli/command 2016-09-08 15:46:29 -04:00