File: swapin_example.py

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (48 lines) | stat: -rw-r--r-- 991 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Demonstrations of swapin, the Linux BCC/eBPF version.


This tool counts swapins by process, to show which process is affected by
swapping. For example:

# swapin.py 
Counting swap ins. Ctrl-C to end.
13:36:58
COMM             PID    COUNT

13:36:59
COMM             PID    COUNT
gnome-shell      2239   12410

13:37:00
COMM             PID    COUNT
chrome           4536   14635

13:37:01
COMM             PID    COUNT
gnome-shell      2239   14
cron             1180   23

13:37:02
COMM             PID    COUNT
gnome-shell      2239   2496
[...]

While tracing, this showed that PID 2239 (gnome-shell) and PID 4536 (chrome)
suffered over ten thousand swapins.



USAGE:

# swapin.py -h
usage: swapin.py [-h] [-T] [interval] [count]

Count swapin events by process.

positional arguments:
  interval      output interval, in seconds
  count         number of outputs

optional arguments:
  -h, --help    show this help message and exit
  -T, --notime  do not show the timestamp (HH:MM:SS)