xref: /aosp_15_r20/external/bcc/tools/swapin_example.txt (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1Demonstrations of swapin, the Linux BCC/eBPF version.
2
3
4This tool counts swapins by process, to show which process is affected by
5swapping. For example:
6
7# swapin.py
8Counting swap ins. Ctrl-C to end.
913:36:58
10COMM             PID    COUNT
11
1213:36:59
13COMM             PID    COUNT
14gnome-shell      2239   12410
15
1613:37:00
17COMM             PID    COUNT
18chrome           4536   14635
19
2013:37:01
21COMM             PID    COUNT
22gnome-shell      2239   14
23cron             1180   23
24
2513:37:02
26COMM             PID    COUNT
27gnome-shell      2239   2496
28[...]
29
30While tracing, this showed that PID 2239 (gnome-shell) and PID 4536 (chrome)
31suffered over ten thousand swapins.
32
33#swapin.py -T
34Counting swap ins. Ctrl-C to end.
35COMM             PID    COUNT
36b'firefox'       60965  4
37
38COMM             PID    COUNT
39b'IndexedDB #1'  60965  1
40b'firefox'       60965  2
41
42COMM             PID    COUNT
43b'StreamTrans #9' 60965  1
44b'firefox'       60965  3
45
46COMM             PID    COUNT
47
48COMM             PID    COUNT
49b'sssd_kcm'      3605   384
50[--]
51
52While tracing along with -T flag, it does not show timestamp.
53
54
55
56USAGE:
57
58# swapin.py -h
59usage: swapin.py [-h] [-T] [interval] [count]
60
61Count swapin events by process.
62
63positional arguments:
64  interval      output interval, in seconds
65  count         number of outputs
66
67optional arguments:
68  -h, --help    show this help message and exit
69  -T, --notime  do not show the timestamp (HH:MM:SS)
70