Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a process started between two Update(), count the usage between process creation and the first Update() which see it.
This is especially useful for short-lived processes & not too fast gathering (like process lifetime of 1 minutes and metric gathering every 10 seconds), where I had about 15% error in my case:
I'm measuring CPU usage of a PostgreSQL server behind a pgbouncer configured to keep connection 60 seconds (which means that every 60 seconds, the connection is closed & re-opened, which on Postgres means a process is terminated and a new one is re-created).
The real CPU usage is measured using ps --cumulative on parent process (which is a good approximation on long term, and a correct minimal value. Using this does not account CPU usage of currently running child but do count exactly CPU usage of all terminated children).
Without this PR, I have the following delta (over 1h30):
Without this PR, I have the following delta (over 30 minutes):