swapin.bt(8)
β¨ swapin.bt(8) β System Manager's Manual β¨
π NAME
swapin.bt β okay so this one counts swapins per process π₯. Powered by bpftrace/eBPF, obviously.
π SYNOPSIS
swapin
π¦ DESCRIPTION
okay so this tool counts swapins by process π, which shows you which process is getting hit by swapping (if you've got swap devices in use). ngl this can explain a seriously big chunk of app latency, especially if something started swapping because the system is under memory pressure π.
It works by tracing the swap_readpage() kernel function using dynamic instrumentation π§. Heads up bestie: this tool might need maintenance to keep working if that function changes in later kernels β οΈ.
Since this uses BPF, only the root user can use this tool π.
πΈ REQUIREMENTS
You'll need CONFIG_BPF and bpftrace π
.
β EXAMPLES
Count swapins by process, showing per-second summaries π.
# swapin.bt
π 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 (bounded by swapin device IOPS), so the overhead of this tool is expected to be negligible π₯°. Literally no drama.
π SOURCE
This tool originated from the book "BPF Performance Tools", published by Addison Wesley (2019) π:
http://www.brendangregg.com/bpf-performance-tools-book.html
See the book for more documentation on this tool π€.
This version is in the bpftrace repository:
https://github.com/bpftrace/bpftrace
Also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool π§ .
π OS
Linux π§.
π STABILITY
Unstable - in development π§. Be gentle with it, it's still growing up π₯Ί.
π AUTHOR
Brendan Gregg π.
π₯ SEE ALSO
swapon(8) β the swap-enabling partner you'll want to check out π«.
USER COMMANDS Β· swapin.bt(8) Β· bpftrace's swapin tool, dated 2019-07-05 π stay iconic, bestie β¨
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- debian trixie: bpftrace 0.23.2-1 Β· Apache-2.0
- fedora 43: bpftrace 0.24.0-1.fc43 Β· Apache-2.0
- fedora 43: bpftrace 0.24.2-1.fc43 Β· Apache-2.0
- fedora 44: bpftrace 0.24.2-3.fc44 Β· Apache-2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- opensuse-leap 16.0: bpftrace-tools 0.23.5-160000.1.2 Β· Apache-2.0
- ubuntu questing: bpftrace 0.23.5-1ubuntu1 Β· Apache-2.0
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms