From 9b5445e7f3f68dd6fe57de3d3d6026fa4bf05d05 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Mon, 28 Jul 2014 22:16:49 +0000 Subject: [PATCH] Fix cpu gauge to show percent of machine cpu capacity being used by the container. For a container using one full core out on a 4-core machine, the gauge will show up as 25%. Docker-DCO-1.1-Signed-off-by: Rohit Jnagal (github: rjnagal) --- pages/static/containers_js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/static/containers_js.go b/pages/static/containers_js.go index 188e7f3d..0858d5e1 100644 --- a/pages/static/containers_js.go +++ b/pages/static/containers_js.go @@ -168,7 +168,7 @@ function drawOverallUsage(elementId, machineInfo, containerInfo) { var rawUsage = cur.cpu.usage.total - prev.cpu.usage.total; // Convert to millicores and take the percentage - cpuUsage = Math.round(((rawUsage / 1000000) / containerInfo.spec.cpu.limit) * 100); + cpuUsage = Math.round(((rawUsage / 1000000) / (machineInfo.num_cores * 1000)) * 100); if (cpuUsage > 100) { cpuUsage = 100; }