mirror of
https://github.com/containers/podman.git
synced 2026-10-30 05:40:32 -04:00
- Read system_cpu_usage from /proc/stat (first 7 CPU fields, including idle) instead of cgroups.SystemCPUUsage(), matching Docker semantics. - Use CPU values from GetContainerStats() instead of a second cgroup read to avoid a timing gap. - Populate precpu_stats on stream=false with a 100 ms sampling pauseso the Docker CPU% formula returns a directionally correc snapshot. This only affects the compat per-container endpoint; podman-remote stats uses a separate libpod handler. - Return cpu_stats.cpu as 0 for one-shot=true since the two samples are only milliseconds apart. - Replace direct precpu copy instead of JSON marshal/unmarshal round-trip. - Propagate errors via fmt.Errorf instead of logrus.Errorf, letting callers decide how to handle them. Parse errors in /proc/stat fields are hard errors instead of silently returning partial data. - Document that --no-stream CPU% is a coarse ~100 ms snapshot; streaming gives 5-second interval readings. Fixes: https://github.com/podman-container-tools/podman/issues/28761 Fixes: https://github.com/podman-container-tools/podman/issues/24730 Fixes: https://github.com/podman-container-tools/podman/issues/29912 Fixes: https://github.com/podman-container-tools/podman/issues/25709 Signed-off-by: Jan Rodák <hony.com@seznam.cz>