summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-02-11 19:48:23 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-02-11 22:24:14 +0100
commit6215e1bb218a86c217a66e34f2abd043feca8582 (patch)
tree9212cebe74e4385685ea2d496a73b11418102205 /pkg/api/handlers
parent4bdfeed5bf9c467c8ab53b392747ec722505b179 (diff)
downloadpodman-6215e1bb218a86c217a66e34f2abd043feca8582.tar.gz
podman-6215e1bb218a86c217a66e34f2abd043feca8582.tar.bz2
podman-6215e1bb218a86c217a66e34f2abd043feca8582.zip
api: fix the CPU stats reported
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/generic/containers_stats.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/api/handlers/generic/containers_stats.go b/pkg/api/handlers/generic/containers_stats.go
index f8804b5c0..cfc14786f 100644
--- a/pkg/api/handlers/generic/containers_stats.go
+++ b/pkg/api/handlers/generic/containers_stats.go
@@ -67,9 +67,9 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
preCPUStats = docker.CPUStats{
CPUUsage: docker.CPUUsage{
TotalUsage: stats.CPUNano,
- PercpuUsage: []uint64{uint64(stats.CPU)},
- UsageInKernelmode: 0,
- UsageInUsermode: 0,
+ PercpuUsage: stats.PerCPU,
+ UsageInKernelmode: stats.CPUSystemNano,
+ UsageInUsermode: stats.CPUNano - stats.CPUSystemNano,
},
SystemUsage: 0,
OnlineCPUs: 0,
@@ -146,7 +146,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
CPUStats: docker.CPUStats{
CPUUsage: docker.CPUUsage{
TotalUsage: cgroupStat.CPU.Usage.Total,
- PercpuUsage: []uint64{uint64(stats.CPU)},
+ PercpuUsage: cgroupStat.CPU.Usage.PerCPU,
UsageInKernelmode: cgroupStat.CPU.Usage.Kernel,
UsageInUsermode: cgroupStat.CPU.Usage.Total - cgroupStat.CPU.Usage.Kernel,
},