Repository navigation
fix(processlist): show Windows priority classes as labels in the NI column (#3672) - #3673
Merged
nicolargo merged 1 commit intoAug 26, 2026
Merged
Conversation
…olumn psutil reports the Win32 priority *class* for `nice` on Windows, not a nice value. Those numbers are neither ordered nor small — 32 is normal while 32768 is *above* normal — so the NI column showed a five-digit number that is meaningless as a nice value and does not fit its 3-character width. Render the six classes as the short labels Windows itself uses, in the TUI and the WebUI alike: 256 RT 128 Hi 32768 AN 32 No 16384 BN 64 Lo Only the rendering changes. The API keeps the raw value, so sorting and any consumer of `/api/*/processlist` are untouched, and `get_nice_alert()` still receives the number: the `nice_*` limits in glances.conf are POSIX nice values, and matching a label against them would silence them. An unmapped class falls through to its number rather than disappearing, so a class Windows adds later stays visible. ProgramlistPlugin inherits `_get_process_curses_nice`, so the program view is covered by the same change. Closes nicolargo#3672.
Owner
|
Thanks for the PR @ntdatt812 ! Merged into develop. |
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.
Closes #3672.
What was wrong
On Windows
psutilreports the Win32 priority class innice, not a nice value. The class values are neither ordered nor small —32is normal while32768is above normal — so the NI column showed a five-digit number that means nothing as a nice value and overflows a column formatted{:>3}.What this does
Renders the six classes as the short labels Windows itself uses, in the TUI and the WebUI alike, exactly as the issue specifies:
RTREALTIME_PRIORITY_CLASSHiHIGH_PRIORITY_CLASSANABOVE_NORMAL_PRIORITY_CLASSNoNORMAL_PRIORITY_CLASSBNBELOW_NORMAL_PRIORITY_CLASSLoIDLE_PRIORITY_CLASSI checked those six values against
psutilon the machine rather than copying them, and the test asserts the map against the constants themselves when it runs on Windows — so a psutil change fails the test instead of quietly rendering a raw number again.Three things it deliberately does not change:
nicestays the raw value, so sorting, exports and any consumer of/api/*/processlistare untouched. Only the two display layers translate.get_nice_alert()still receives the number. Thenice_*limits inglances.confare POSIX nice values, so matching a label against them would silence them — there is a test pinning that.ProgramlistPlugininherits_get_process_curses_nice, so the program view is covered by the same change.Verification
Windows 11, Python 3.14, psutil 7.2.2.
The new
test_010b_processes_nice_windows_labelspatchesWINDOWSboth ways, so both branches run on every OS rather than only on a Windows runner.Mutation-checked, after confirming each edit actually applied:
The third one exists because the "alert keeps the raw value" claim above is a comment, and a comment nothing tests is just a hope.
About the rebuilt bundle
public/glances.jsis regenerated, since every.vuecommit in the history ships it.Worth flagging how it was produced, because my first attempt was wrong. Building on a Windows checkout injected CRLF into the HTML-comment string literals webpack inlines, which changed the bundle in places unrelated to this fix. I set
core.autocrlf=false, re-checked out the tree, and confirmed that an unmodified build then reproduces the committedpublic/glances.jsbyte for byte before rebuilding with the change. So the bundle delta here is only this change, andbrowser.jsis untouched.WebUI
eslinton the changed component reports 0 net new issues — 5 errors / 75 warnings before and after, all pre-existing in that file.