feat: log cpu utilization in state network report #1549
Merged
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.
What was wrong?
Related to #1545 -- to start we at least want to measure CPU usage. However we decide to respond to it, it is a thing we will want to respond to. So this is an experiment to see how well the library works at observing usage, to lay the groundwork for later steps.
How was it fixed?
Add
cpu_time
to track the amount of cpu usage that trin has. It's a bit hacky to put it in thetrin-state
report, because it's just measuring everything happening in the process. But since state is not stabilizing (and seems to be the culprit for high usage currently), it seems like a good place to add the log.It's already been a convenient way to watch my machine react as I experiment with the CPU effect of various changes.
Example log: