fix: Stop counting iowait towards CPU utilization #3202
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 type of PR is this? (check all applicable)
Description
If the cpu is spending a lot of time in iowait, it is still idle but some process is waiting on io. The system itself is not under load.
This is especially annoying with ghostty, as it spends most time waiting on io_uring, which drives up the CPU usage reported by polybar to around 50% or more. Other system monitors, such as htop or btop, do not count iowait towards utilization and only report ~5% CPU utilization instead.
This is discussed in more detail at ghostty-org/ghostty#3224.
The kde system monitor was recently adjusted to behave similarly: https://invent.kde.org/plasma/ksystemstats/-/merge_requests/104/.
I also removed the accounting for
steal. I am not sure how to treat it, but it seems pretty specialized? I can re-add it though, if you prefer that.Related Issues & Documents
ghostty-org/ghostty#3224
https://invent.kde.org/plasma/ksystemstats/-/merge_requests/104/.
Documentation (check all applicable)
As far as I can tell the behaviour isn't actually documented anywhere, but maybe I missed it.