spiegel_podman/pkg
Paul Holzinger 0edb3ddd39
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>
2022-03-22 17:43:49 +01:00
..
annotations Spelling 2020-12-22 13:34:31 -05:00
api podman stats: calc CPU percentage correctly 2022-03-22 17:43:49 +01:00
auth Run codespell on code 2022-01-21 09:52:12 -05:00
autoupdate bump go module to version 4 2022-01-18 12:47:07 +01:00
bindings podman rmi --ignore 2022-03-19 10:05:43 +01:00
channel channel: simplify implementation 2021-05-06 11:51:15 +02:00
checkpoint Fix checkpoint/restore pod tests 2022-02-11 15:11:48 +00:00
copy bump go module to version 4 2022-01-18 12:47:07 +01:00
criu go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
ctime go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
domain podman stats: calc CPU percentage correctly 2022-03-22 17:43:49 +01:00
env go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
errorhandling Handle HTTP 409 error messages properly for Pod actions 2021-11-02 12:28:52 +01:00
hooks bump go module to version 4 2022-01-18 12:47:07 +01:00
inspect bump go module to version 4 2022-01-18 12:47:07 +01:00
k8s.io go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
kubeutils remove unneeded k8s code 2022-03-15 14:48:08 +01:00
lookup Enable whitespace linter 2021-02-11 23:01:56 +01:00
machine bump golangci-lint to v1.45.0 2022-03-21 10:42:53 +01:00
namespaces [NO TESTS NEEDED] Shrink the size of podman-remote 2021-03-29 09:49:45 -04:00
parallel bump go module to version 4 2022-01-18 12:47:07 +01:00
ps bump go module to version 4 2022-01-18 12:47:07 +01:00
resolvconf Revert "Move each search dns to its own line" 2022-02-02 19:33:21 +01:00
rootless go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
rootlessport go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
seccomp Spelling 2020-12-22 13:34:31 -05:00
selinux Fix SELinux functions names to not be repetitive 2020-04-23 15:57:34 -04:00
servicereaper go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
signal go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
specgen go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
specgenutil Add support for --chrootdirs 2022-03-14 10:31:58 +02:00
systemd Separator is no longer prepended when prefix is empty on podman generate systemd 2022-03-16 20:26:59 -04:00
terminal go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
timetype make lint: enable gocritic 2020-01-13 14:27:02 +01:00
trust Cleanup display of trust with transports 2022-02-22 15:08:58 -05:00
util go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00