feat: Added priority and nice as columns in process view
Description
This PR adds the Priority and Nice columns to the process table. Both columns for linux and macos, and only priority for windows
Issue
Closes: #1813
Testing
- [ ] Windows
- [ ] macOS
- [X] Linux
- [ ] Other
It was tested on Arch Linux for kernel 6.17.8-arch1-1.
Checklist
- [X] If this is a code change, areas your change affects have been linted using (
cargo fmt) - [X] If this is a code change, your changes pass
cargo clippy --all -- -D warnings - [ ] If this is a code change, new tests were added if relevant
- [X] If this is a code change, your changes pass
cargo test - [ ] The change has been tested to work (see above) and doesn't appear to break other things
- [ ] Documentation has been updated if needed (
README.md, help menu, docs, configs, etc.) - [x] There are no merge conflicts
- [x] You have reviewed the changes first
- [x] The pull request passes the provided CI pipeline
Other
In the htop documentation I found
PRIORITY (PRI)
The kernel's internal priority for the process, usually just
its nice value plus twenty. Different for real-time
processes.
NICE (NI)
The nice value of a process, from 19 (low priority) to -20
(high priority). A high value means the process is being
nice, letting others have a higher relative priority. The
usual OS permission restrictions for adjusting priority
apply.
but I found in /proc/[pid]/stat for a ped pids this relation doesn't hold. Should I keep this or similar to htop for parity?
Codecov Report
:x: Patch coverage is 51.61290% with 45 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 45.44%. Comparing base (316a3c0) to head (2b32aea).
Additional details and impacted files
@@ Coverage Diff @@
## main #1881 +/- ##
==========================================
- Coverage 50.46% 45.44% -5.02%
==========================================
Files 115 115
Lines 16174 16241 +67
==========================================
- Hits 8162 7381 -781
- Misses 8012 8860 +848
| Flag | Coverage Δ | |
|---|---|---|
| macos-14 | 42.69% <37.83%> (+<0.01%) |
:arrow_up: |
| ubuntu-latest | 43.39% <41.89%> (-5.33%) |
:arrow_down: |
| windows-2022 | 42.11% <33.96%> (-0.01%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Currently taking a look - one thing as a note to myself (so not blocking this PR) - I should add support for searching for this later.
Currently taking a look - one thing as a note to myself (so not blocking this PR) - I should add support for searching for this later.
Search for the two columns is currently functional for me:
Should I add any other changes for this?
Also, while I have verified that there are no compile errors on non-Linux platforms (macOS, Windows, and FreeBSD), is there a recommended way to confirm that the feature actually works correctly on those platforms as well?
Search for the two columns is currently functional for me
Oh, nice!
Also to test, it's either testing it manually, or trying to run the code that gets data in a test and seeing if data can get pulled. I plan to add something like that in the future so it's fine for now, I can verify for at least macOS and Windows as part of the review.
Hi, I have fixed the compilation errors and made sure it's working on my end. I would require your help to confirm it once on Windows and Mac. Please let me know if I should make any other changes.