aboutsummaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-03-22 17:10:43 +0100
committerMatthew Heon <mheon@redhat.com>2022-03-30 15:36:05 -0400
commit1266f7342057cf2161122f52e48ce80b80f233a4 (patch)
treeef6e4badff06768604b627aa92ba24bb587ddf8c /.pre-commit-config.yaml
parent9510238ff9692a2145be8dc2c712db208cdfd02b (diff)
downloadpodman-1266f7342057cf2161122f52e48ce80b80f233a4.tar.gz
podman-1266f7342057cf2161122f52e48ce80b80f233a4.tar.bz2
podman-1266f7342057cf2161122f52e48ce80b80f233a4.zip
podman stats: calc CPU percentage correctly
When you run podman stats, the first interval always shows the wrong cpu usage. To calculate cpu percentage we get the cpu time from the cgroup and compare this against the system time between two stats. Since the first time we do not have a previous stats an empty struct is used instead. Thus we do not use the actual running time of the container but the current unix timestamp (time since Jan 1 1970). To fix this we make sure that the previous stats time is set to the container start time, when it is empty. [NO NEW TESTS NEEDED] No idea how I could create a test which would have a predictable cpu usage. See the linked bugzilla for a reproducer. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2066145 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to '.pre-commit-config.yaml')
0 files changed, 0 insertions, 0 deletions