Skip to content

Divide stats CPU usage by the measured sample interval - #2337

Open
deadcaf3 wants to merge 1 commit into
apple:mainfrom
deadcaf3:fix/2284-stats-cpu-interval
Open

deadcaf3 wants to merge 1 commit into
apple:mainfrom
deadcaf3:fix/2284-stats-cpu-interval

Conversation

@deadcaf3

@deadcaf3 deadcaf3 commented Oct 3, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix

Motivation and Context

Fixes #2284.

container stats divides the CPU delta by a fixed 2 s instead of the real time between its two samples, so a late second sample inflates the result. Each snapshot now records the measured gap, and the table divides by that.

Overlaps #2146. Happy to rebase.

Testing

  • Tested locally
  • Added/updated tests

One busy loop with stats suspended between samples for a 6 s gap: 1.5.0 reads 300.79%, this branch reads 99.99%.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: container stats reports inflated CPU % on a loaded host

1 participant