From befc11b8996b4d42a64690b786769e66eac140c1 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Thu, 24 Jul 2014 23:31:53 +0000 Subject: [PATCH] Fix cpu limit to report cpu shares. It is currently treating shares as millicores. Changed 'CPU Limit 1.024 cores' to 'CPU shares 1024 shares'. Docker-DCO-1.1-Signed-off-by: Rohit Jnagal (github: rjnagal) --- pages/containers.go | 5 +++++ pages/containers_html.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/containers.go b/pages/containers.go index 6d7b40c9..cc52a16f 100644 --- a/pages/containers.go +++ b/pages/containers.go @@ -36,6 +36,7 @@ var funcMap = template.FuncMap{ "containerLink": containerLink, "printMask": printMask, "printCores": printCores, + "printShares": printShares, "printMegabytes": printMegabytes, "getMemoryUsage": getMemoryUsage, "getMemoryUsagePercent": getMemoryUsagePercent, @@ -138,6 +139,10 @@ func printCores(millicores *uint64) string { return strconv.FormatFloat(cores, 'f', 3, 64) } +func printShares(shares *uint64) string { + return fmt.Sprintf("%d", *shares) +} + func toMegabytes(bytes uint64) float64 { return float64(bytes) / (1 << 20) } diff --git a/pages/containers_html.go b/pages/containers_html.go index 8cbaa3c3..5d311b7d 100644 --- a/pages/containers_html.go +++ b/pages/containers_html.go @@ -68,7 +68,7 @@ const containersHtmlTemplate = `