swapin.bt(8)

πŸ“¦
version 0.27.0 Β· 3 versions
  • 0.27.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.14.0 Β· ubuntu jammy
  • 0.20.2 Β· ubuntu noble
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 ✨