Repository navigation
fix(percpu): report the guest nice CPU value - #3685
Merged
Merged
Conversation
Per-CPU stats checked for guest_nice but returned the steal field, so systems exposing both values reported incorrect guest_nice usage. Read the matching psutil field and cover the conversion with distinct fixture values.
Owner
|
Thanks for the PR @justadityaraj Damed... copy/paste issue :) Merged into develop. |
Contributor
Author
Welcome @nicolargo :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem / Context
CpuPercent._compute_percpu()checks whether psutil exposesguest_nice, but currently returns thestealvalue for that field. When the two counters differ, per-CPU consumers receive incorrect guest nice usage.Fix / Changes
Read
cpu_times.guest_nicefor the corresponding output field. Add a focused regression test with distinct steal and guest nice values so the mapping cannot silently regress.User impact
Linux hosts running niced guest workloads now report the correct per-CPU
guest_nicepercentage instead of repeating stolen CPU time.Verification
uv run python -m pytest tests/test_core.py tests/test_cpu_percent.py -q— 47 passed, 6 skippeduv run ruff check .— passeduv run ruff format --check .— 241 files already formatteduv run python -m pytest -q— 622 passed, 106 skipped; the remaining 58 failures and 15 errors were in Windows-sensitive shell, subprocess-server, web UI, memory, and performance tests. Neither the changed module nor the new regression test failed.Resume