summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-23 20:37:25 +0100
committerGitHub <noreply@github.com>2022-03-23 20:37:25 +0100
commit73713062806aa4c2db25dc62e2fff47406085dc8 (patch)
tree218b63ae146c34a784e238c43c18a33eca971d85 /pkg/domain/infra/abi/containers.go
parent109224717354b1d32d1be854a019fe9d4a55cfa6 (diff)
parent130bcc3a93d82674eaaf2a62f854983db263a940 (diff)
downloadpodman-73713062806aa4c2db25dc62e2fff47406085dc8.tar.gz
podman-73713062806aa4c2db25dc62e2fff47406085dc8.tar.bz2
podman-73713062806aa4c2db25dc62e2fff47406085dc8.zip
Merge pull request #13597 from Luap99/stats
podman stats: calc CPU percentage correctly
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index e6feb7c82..1986228a6 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -1431,12 +1431,7 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri
reportStats := []define.ContainerStats{}
for _, ctr := range containers {
- prev, ok := containerStats[ctr.ID()]
- if !ok {
- prev = &define.ContainerStats{}
- }
-
- stats, err := ctr.GetContainerStats(prev)
+ stats, err := ctr.GetContainerStats(containerStats[ctr.ID()])
if err != nil {
cause := errors.Cause(err)
if queryAll && (cause == define.ErrCtrRemoved || cause == define.ErrNoSuchCtr || cause == define.ErrCtrStateInvalid) {