1statsnoop(8) System Manager's Manual statsnoop(8)
2
3
4
6 statsnoop - Trace stat() syscalls. Uses Linux eBPF/bcc.
7
9 statsnoop [-h] [-t] [-x] [-p PID]
10
12 statsnoop traces the different stat() syscalls, showing which processes
13 are attempting to read information about which files. This can be use‐
14 ful for determining the location of config and log files, or for trou‐
15 bleshooting applications that are failing, especially on startup.
16
17 This works by tracing various kernel sys_stat() functions using dynamic
18 tracing, and will need updating to match any changes to these func‐
19 tions.
20
21 This makes use of a Linux 4.4 feature (bpf_perf_event_output()); for
22 kernels older than 4.4, see the version under tools/old, which uses an
23 older mechanism.
24
25 Since this uses BPF, only the root user can use this tool.
26
28 CONFIG_BPF and bcc.
29
31 -h Print usage message.
32
33 -t Include a timestamp column: in seconds since the first event,
34 with decimal places.
35
36 -x Only print failed stats.
37
38 -p PID Trace this process ID only (filtered in-kernel).
39
41 Trace all stat() syscalls:
42 # statsnoop
43
44 Trace all stat() syscalls, and include timestamps:
45 # statsnoop -t
46
47 Trace only stat() syscalls that failed:
48 # statsnoop -x
49
50 Trace PID 181 only:
51 # statsnoop -p 181
52
54 TIME(s)
55 Time of the call, in seconds.
56
57 PID Process ID
58
59 COMM Process name
60
61 FD File descriptor (if success), or -1 (if failed)
62
63 ERR Error number (see the system's errno.h)
64
65 PATH Open path
66
68 This traces the kernel stat function and prints output for each event.
69 As the rate of this is generally expected to be low (< 1000/s), the
70 overhead is also expected to be negligible. If you have an application
71 that is calling a high rate of stat()s, then test and understand over‐
72 head before use.
73
75 This is from bcc.
76
77 https://github.com/iovisor/bcc
78
79 Also look in the bcc distribution for a companion _examples.txt file
80 containing example usage, output, and commentary for this tool.
81
83 Linux
84
86 Unstable - in development.
87
89 Brendan Gregg
90
92 opensnoop(1)
93
94
95
96USER COMMANDS 2016-02-08 statsnoop(8)