swapin(8)
π«§ NAME π«§
okay so the manual name is swapin, and it's a BCC/eBPF tool that counts swapins by process β¨ swapin is the whole vibe.
Quick heads up, this page lives in the System Manager's Manual section 8 (swapin(8)) π
β¨ SYNOPSIS β¨
swapin
-h,--helpβ show the help message and bounce π-T,--notimeβ skip the timestamp column (HH:MM:SS) π
π DESCRIPTION π
okay so bestie, this tool counts swapins by process, so you can see exactly which process is getting hit by swapping (if you've got swap devices in use) π₯Ί this can explain a seriously big chunk of app latency, especially if something started swapping because the system is under memory pressure. main character energy for debugging π
how it works: it traces the swap_readpage() kernel function using dynamic instrumentation π¦
β οΈ hot take, but this tool might need maintenance to keep working if that function changes in later kernels. so don't be shocked if it breaks someday π
and since it uses BPF, only the root user can run it. sorry not sorry π
π REQUIREMENTS π
you'll need CONFIG_BPF and BCC β¨
πΈ EXAMPLES πΈ
Count swapins by process, with per-second summaries:
# swapin
π§ FIELDS π§
- 1st β the process name π·οΈ
- 2nd β the process ID π’
- 3rd β the count of swapins during that interval π
π₯ OVERHEAD π₯
the rate of swapins should be low (it's bounded by swap device IOPS), so the overhead of this tool is expected to be negligible. basically zero drama π
π SOURCE π
okay this one's a good story π₯Ή it originated as a bpftrace tool from the book "BPF Performance Tools", published by Addison Wesley (2019):
http://www.brendangregg.com/bpf-performance-tools-book.html
go read the book for more docs on this tool, it's iconic π
the version you're looking at is in the BCC repository:
https://github.com/iovisor/bcc
also, peek in the bcc distribution for a companion _examples.txt file. it has example usage, output, and commentary for this tool, so iykyk π«Ά
π OS π
Linux only π§
π« STABILITY π«
Unstable - in development. so it's still cooking π³
π AUTHOR π
Brendan Gregg is the queen behind this one πΈ
π¦ SEE ALSO π¦
swapon(8) π
and that's a wrap, bestie π this was the USER COMMANDS manual page, last updated 2019-07-05, for swapin(8) πβ¨
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms