.TH swapin 8  "2019-07-05" "USER COMMANDS"
.SH NAME
swapin \- Count swapins by process. Uses bpftrace/eBPF.
.SH SYNOPSIS
.B swapin
.SH DESCRIPTION
This tool counts swapins by process, to show which process is affected by
swapping (if swap devices are in use). This can explain a significant source
of application latency, if it has began swapping due to memory pressure on
the system.

This works by tracing the swap_readpage() kernel function
using dynamic instrumentation. This tool may need maintenance to keep working
if that function changes in later kernels.

Since this uses BPF, only the root user can use this tool.
.SH REQUIREMENTS
CONFIG_BPF and bpftrace.
.SH EXAMPLES
.TP
Count swapins by process, showing per-second summaries.
#
.B swapin.bt
.SH FIELDS
.TP
1st
The process name.
.TP
2nd
The process ID.
.TP
3rd
The count of swapins during that interval.
.SH OVERHEAD
The rate of swapins should be low (bounded by swapin device IOPS), such that
the overhead of this tool is expected to be negligible.
.SH SOURCE
This tool originated from the book "BPF Performance Tools", published by
Addison Wesley (2019):
.IP
http://www.brendangregg.com/bpf-performance-tools-book.html
.PP
See the book for more documentation on this tool.
.PP
This version is in the bpftrace repository:
.IP
https://github.com/iovisor/bpftrace
.PP
Also look in the bpftrace distribution for a companion _examples.txt file
containing example usage, output, and commentary for this tool.
.SH OS
Linux
.SH STABILITY
Unstable - in development.
.SH AUTHOR
Brendan Gregg
.SH SEE ALSO
swapon(8)
