bottom icon indicating copy to clipboard operation
bottom copied to clipboard

feat: Added priority and nice as columns in process view

Open Saphereye opened this issue 2 months ago • 5 comments

Description

This PR adds the Priority and Nice columns to the process table. Both columns for linux and macos, and only priority for windows Screenshot_20251117_205708

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?

Saphereye avatar Nov 17 '25 15:11 Saphereye

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).

Files with missing lines Patch % Lines
src/widgets/process_table/process_columns.rs 15.38% 22 Missing :warning:
src/widgets/process_table/query.rs 0.00% 15 Missing :warning:
src/widgets/process_table/process_data.rs 28.57% 5 Missing :warning:
src/widgets/process_table.rs 81.81% 2 Missing :warning:
src/collection/processes/unix/process_ext.rs 91.66% 1 Missing :warning:
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.

codecov[bot] avatar Nov 19 '25 13:11 codecov[bot]

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.

ClementTsang avatar Nov 22 '25 17:11 ClementTsang

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: image

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?

Saphereye avatar Nov 22 '25 18:11 Saphereye

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.

ClementTsang avatar Nov 23 '25 04:11 ClementTsang

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.

Saphereye avatar Nov 30 '25 09:11 Saphereye