From a16c97394f51a215f56a915d71f8a80516be06b3 Mon Sep 17 00:00:00 2001 From: epipho Date: Sat, 16 Sep 2017 00:43:03 -0400 Subject: [PATCH] Fix incorrect docker stats --- client/driver/docker.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 38fcfb0ec..894cfafc3 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -1657,16 +1657,15 @@ func (h *DockerHandle) collectStats() { } // Calculate percentage - cores := len(s.CPUStats.CPUUsage.PercpuUsage) cs.Percent = calculatePercent( s.CPUStats.CPUUsage.TotalUsage, s.PreCPUStats.CPUUsage.TotalUsage, - s.CPUStats.SystemCPUUsage, s.PreCPUStats.SystemCPUUsage, cores) + s.CPUStats.SystemCPUUsage, s.PreCPUStats.SystemCPUUsage, numCores) cs.SystemMode = calculatePercent( s.CPUStats.CPUUsage.UsageInKernelmode, s.PreCPUStats.CPUUsage.UsageInKernelmode, - s.CPUStats.CPUUsage.TotalUsage, s.PreCPUStats.CPUUsage.TotalUsage, cores) + s.CPUStats.CPUUsage.TotalUsage, s.PreCPUStats.CPUUsage.TotalUsage, numCores) cs.UserMode = calculatePercent( s.CPUStats.CPUUsage.UsageInUsermode, s.PreCPUStats.CPUUsage.UsageInUsermode, - s.CPUStats.CPUUsage.TotalUsage, s.PreCPUStats.CPUUsage.TotalUsage, cores) + s.CPUStats.CPUUsage.TotalUsage, s.PreCPUStats.CPUUsage.TotalUsage, numCores) cs.TotalTicks = (cs.Percent / 100) * shelpers.TotalTicksAvailable() / float64(numCores) h.resourceUsageLock.Lock()