Skip to content

feature: add process swap column for Linux - #2224

Merged
ClementTsang merged 22 commits into
ClementTsang:mainfrom
abuhurayraniloy:feat/process-swap-column
Sep 21, 2026
Merged

ClementTsang merged 22 commits into
ClementTsang:mainfrom
abuhurayraniloy:feat/process-swap-column

Conversation

@abuhurayraniloy

@abuhurayraniloy abuhurayraniloy commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

User attachment

Adds the initial cross-platform support for an optional Swap column in the process widget.

On Linux, Bottom reads each process's swap usage from the VmSwap field in /proc/<PID>/status. The other platform collectors currently return no swap value, so the widget displays N/A on those platforms. The Swap column can be sorted like the other process columns.

This also updates the nightly schema, process-widget documentation, configuration documentation, and embedded/default configuration comments.

No dependencies were added or changed.

Issue

This PR addresses the Linux-first implementation discussed in #2001. It does not fully close the issue because native per-process swap collection for the other supported platforms remains future work.

Related to: #2001

Testing

Ran:

  • ./scripts/schema/nightly.sh
  • cargo fmt --check
  • cargo clippy --all -- -D warnings
  • cargo test

Manual testing:

  • Ran Bottom on <Linux distribution/version>.
  • Enabled the Swap column in the process configuration.
  • Confirmed that Linux displays per-process swap usage.
  • Confirmed that the column can be sorted.
  • Confirmed that platforms without a swap value display N/A where tested.

Platforms tested:

  • Windows
  • macOS (specify version below)
  • _Linux
    Ubuntu 26.04 LTS
  • Other (specify below)

Checklist

  • If this pull request adds or changes a dependency, please justify this in the description
  • If this is a code change, areas your change affects have been linted using (cargo fmt)
  • 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
  • If this is a code change, your changes pass cargo test
  • The change has been verified to work (see the Testing section) and doesn't unexpectedly break anything else
  • Documentation has been updated if needed (README.md, help menu, docs, configs, etc.)
  • There are no merge conflicts
  • You have personally reviewed your changes already before creating the PR
  • The pull request passes the provided CI pipeline
  • If the changes were generated with AI tools, ensure it follows the AI policy. Specify how it was used in the "Other" section, and that you as a human have personally reviewed the change

Other

AI assistance was used to help understand the existing Bottom codebase and draft documentation/configuration text. I personally reviewed the final changes and am responsible for the implementation and testing.

@abuhurayraniloy
abuhurayraniloy force-pushed the feat/process-swap-column branch from 4fbc947 to 664f193 Compare August 28, 2026 20:42
@ClementTsang ClementTsang self-assigned this Aug 29, 2026
@ClementTsang

Copy link
Copy Markdown
Owner

Thanks for the PR! I'll take a look in the next few days.

@codecov

codecov Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.95489% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.05%. Comparing base (8ddd0aa) to head (41b8018).

Files with missing lines Patch % Lines
src/widgets/process_table/process_data.rs 71.42% 10 Missing ⚠️
src/widgets/process_table.rs 66.66% 7 Missing ⚠️
src/collection/processes/linux/process.rs 89.36% 5 Missing ⚠️
src/collection/processes/linux/mod.rs 90.90% 1 Missing ⚠️
src/widgets/process_table/process_columns.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2224      +/-   ##
==========================================
- Coverage   63.63%   63.05%   -0.58%     
==========================================
  Files         136      136              
  Lines       19859    19986     +127     
==========================================
- Hits        12637    12602      -35     
- Misses       7222     7384     +162     
Flag Coverage Δ
macos-14 52.03% <68.49%> (+0.31%) ⬆️
ubuntu-24.04 62.10% <81.53%> (-0.61%) ⬇️
windows-2022 51.75% <68.49%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ClementTsang ClementTsang left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tentative comments, as well as noting this isn't supported for querying at the moment.

Comment thread docs/content/configuration/config-file/processes.md Outdated
Comment thread docs/content/usage/widgets/process.md Outdated
Comment thread src/collection/processes/linux/process.rs Outdated
Comment thread src/collection/processes/linux/process.rs Outdated
Comment thread src/widgets/process_table/process_data.rs Outdated
Comment thread src/collection/processes/linux/process.rs Outdated
Comment thread docs/content/configuration/config-file/processes.md Outdated
@abuhurayraniloy
abuhurayraniloy force-pushed the feat/process-swap-column branch from 9080c94 to e1dfb01 Compare September 1, 2026 09:49
@abuhurayraniloy
abuhurayraniloy force-pushed the feat/process-swap-column branch from e1dfb01 to b5440eb Compare September 1, 2026 09:52
@abuhurayraniloy

Copy link
Copy Markdown
Contributor Author

@ClementTsang, Let me know what you think of the updates.

@ClementTsang

Copy link
Copy Markdown
Owner

yep, will take a look!

@ClementTsang ClementTsang changed the title feature: add process swap column feature: add process swap column for Linux Sep 5, 2026
@ClementTsang

Copy link
Copy Markdown
Owner

Apologies for the delay, will try to get to in the next few days.

Comment thread sample_configs/default_config.toml Outdated
Comment thread src/widgets/process_table/process_data.rs Outdated
Comment thread src/widgets/process_table.rs Outdated
Comment thread src/widgets/process_table.rs Outdated
Comment thread sample_configs/default_config.toml Outdated
Comment thread src/constants.rs Outdated
Comment thread src/collection/processes/linux/process.rs
Comment thread src/collection/processes/linux/mod.rs Outdated
Comment thread src/collection/processes/linux/mod.rs
Comment thread src/collection/processes/linux/mod.rs
abuhurayraniloy and others added 6 commits September 11, 2026 16:11
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
@ClementTsang

Copy link
Copy Markdown
Owner

Will take a look in a bit, thanks!

@ClementTsang ClementTsang left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found two more things while looking around and verifying things, otherwise seems fine.

Comment thread src/collection/processes/linux/process.rs Outdated
Comment thread src/collection/processes/linux/process.rs Outdated

@ClementTsang ClementTsang left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I think this looks fine. Thanks for your patience and sorry it took so long to review!

I'll merge once CI goes through.


Notes to things to follow up on after:

  • Searching
  • Swap%?
  • Support on macOS/Windows/other platforms
  • Cleaning up some of the code around process code

@ClementTsang

Copy link
Copy Markdown
Owner

@all-contributors please add @abuhurayraniloy for code

@allcontributors

Copy link
Copy Markdown
Contributor

@ClementTsang

I've put up a pull request to add @abuhurayraniloy! 🎉

@ClementTsang
ClementTsang merged commit 4136d20 into ClementTsang:main Sep 21, 2026
40 checks passed
@abuhurayraniloy
abuhurayraniloy deleted the feat/process-swap-column branch September 22, 2026 11:34
@abuhurayraniloy

Copy link
Copy Markdown
Contributor Author

Thank you @ClementTsang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants