xref: /aosp_15_r20/external/bcc/tools/nfsslower_example.txt (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard WorkerDemonstrations of nfsslower, the Linux eBPF/bcc version.
2*387f9dfdSAndroid Build Coastguard Worker
3*387f9dfdSAndroid Build Coastguard Workernfsslower show NFS reads, writes, opens and getattrs, slower than a
4*387f9dfdSAndroid Build Coastguard Workerthreshold. For example:
5*387f9dfdSAndroid Build Coastguard Worker
6*387f9dfdSAndroid Build Coastguard Worker./nfsslower.py
7*387f9dfdSAndroid Build Coastguard WorkerTracing NFS operations that are slower than 10 ms
8*387f9dfdSAndroid Build Coastguard WorkerTIME     COMM           PID    T BYTES   OFF_KB   LAT(ms) FILENAME
9*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 15360      14.84 1.test
10*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 16384      12.73 1.test
11*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 17408      24.27 1.test
12*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 18432      22.93 1.test
13*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 19456      14.65 1.test
14*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21295  W 1048576 20480      12.58 1.test
15*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21297  W 1048576 6144       10.50 1.test.w
16*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21297  W 1048576 7168       16.65 1.test.w
17*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21297  W 1048576 8192       13.01 1.test.w
18*387f9dfdSAndroid Build Coastguard Worker11:25:16 dd             21297  W 1048576 9216       14.06 1.test.w
19*387f9dfdSAndroid Build Coastguard Worker
20*387f9dfdSAndroid Build Coastguard WorkerThis shows NFS writes from dd each 1MB in size to 2 different files. The
21*387f9dfdSAndroid Build Coastguard Workerwrites all had latency higher than 10ms.
22*387f9dfdSAndroid Build Coastguard Worker
23*387f9dfdSAndroid Build Coastguard WorkerThis "latency" is measured from when the operation was issued from the VFS
24*387f9dfdSAndroid Build Coastguard Workerinterface to the file system, to when it completed. This spans everything:
25*387f9dfdSAndroid Build Coastguard WorkerRPC latency, network latency, file system CPU cycles, file system locks, run
26*387f9dfdSAndroid Build Coastguard Workerqueue latency, etc. This is a better measure of the latency suffered by
27*387f9dfdSAndroid Build Coastguard Workerapplications reading from a NFS share and can better expose problems
28*387f9dfdSAndroid Build Coastguard Workerexperienced by NFS clients.
29*387f9dfdSAndroid Build Coastguard Worker
30*387f9dfdSAndroid Build Coastguard WorkerNote that this only traces the common NFS operations (read,write,open and
31*387f9dfdSAndroid Build Coastguard Workergetattr). I chose to include getattr as a significant percentage of NFS
32*387f9dfdSAndroid Build Coastguard Workertraffic end up being getattr calls and are a good indicator of problems
33*387f9dfdSAndroid Build Coastguard Workerwith an NFS server.
34*387f9dfdSAndroid Build Coastguard Worker
35*387f9dfdSAndroid Build Coastguard WorkerThe threshold can be provided as an argument. E.g. I/O slower than 1 ms:
36*387f9dfdSAndroid Build Coastguard Worker
37*387f9dfdSAndroid Build Coastguard Worker./nfsslower.py 1
38*387f9dfdSAndroid Build Coastguard WorkerTracing NFS operations that are slower than 1 ms
39*387f9dfdSAndroid Build Coastguard WorkerTIME     COMM           PID    T BYTES   OFF_KB   LAT(ms) FILENAME
40*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  0           4.35 1.test
41*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  256         1.87 1.test
42*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  384         2.99 1.test
43*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  512         4.19 1.test
44*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  640         4.25 1.test
45*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  768         4.65 1.test
46*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  1280        1.08 1.test
47*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  1408        3.29 1.test
48*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  1792        3.12 1.test
49*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  3712        3.55 1.test
50*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  3840        1.12 1.test
51*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  4096        3.23 1.test
52*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  4224        2.73 1.test
53*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  4352        2.73 1.test
54*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  4480        6.09 1.test
55*387f9dfdSAndroid Build Coastguard Worker11:40:16 cp             21583  R 131072  5120        4.40 1.test
56*387f9dfdSAndroid Build Coastguard Worker[...]
57*387f9dfdSAndroid Build Coastguard Worker
58*387f9dfdSAndroid Build Coastguard WorkerThis shows all NFS_READS that were more than 1ms. Depending on your
59*387f9dfdSAndroid Build Coastguard Workerlatency to your fileserver, you might need to tweak this value to
60*387f9dfdSAndroid Build Coastguard Workerremove
61*387f9dfdSAndroid Build Coastguard Worker
62*387f9dfdSAndroid Build Coastguard WorkerA threshold of 0 will trace all operations. Warning: the output will be
63*387f9dfdSAndroid Build Coastguard Workerverbose, as it will include all file system cache hits.
64*387f9dfdSAndroid Build Coastguard Worker
65*387f9dfdSAndroid Build Coastguard Worker./nfsslower.py 0
66*387f9dfdSAndroid Build Coastguard WorkerTracing NFS operations
67*387f9dfdSAndroid Build Coastguard Worker11:56:50 dd             21852  W 1048576 0           0.42 1.test
68*387f9dfdSAndroid Build Coastguard Worker11:56:50 dd             21852  W 1048576 1024        0.46 1.test
69*387f9dfdSAndroid Build Coastguard Worker11:56:50 dd             21852  W 1048576 2048        0.36 1.test
70*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  G 0       0           0.35 1.test
71*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  O 0       0           0.33 1.test
72*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  G 0       0           0.00 1.test
73*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  0           0.07 1.test
74*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  128         0.02 1.test
75*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  256         0.02 1.test
76*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  384         0.02 1.test
77*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  512         0.02 1.test
78*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  640         0.02 1.test
79*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  768         0.02 1.test
80*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  896         0.02 1.test
81*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1024        0.02 1.test
82*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1152        0.02 1.test
83*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1280        0.02 1.test
84*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1408        0.02 1.test
85*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1536        0.02 1.test
86*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1664        0.02 1.test
87*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1792        0.02 1.test
88*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  1920        0.02 1.test
89*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2048        0.02 1.test
90*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2176        0.04 1.test
91*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2304        0.02 1.test
92*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2432        0.03 1.test
93*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2560        0.03 1.test
94*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2688        0.02 1.test
95*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2816        0.03 1.test
96*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 131072  2944        0.02 1.test
97*387f9dfdSAndroid Build Coastguard Worker11:56:50 cp             21854  R 0       3072        0.00 1.test
98*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21855  G 0       0           0.00 1.test
99*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.36 music
100*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 music
101*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 test
102*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 ff
103*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 34.log
104*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 vmlinuz-linux
105*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 2.test
106*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 rt.log
107*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 1.lod
108*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 COPYRIGHT.txt
109*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 gg
110*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 qw.log
111*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 README.md
112*387f9dfdSAndroid Build Coastguard Worker11:56:50 ls             21856  G 0       0           0.00 1.log
113*387f9dfdSAndroid Build Coastguard Worker
114*387f9dfdSAndroid Build Coastguard WorkerThe output now includes open operations ("O"), and reads ("R") wand getattrs ("G").
115*387f9dfdSAndroid Build Coastguard WorkerA cp operation
116*387f9dfdSAndroid Build Coastguard Worker
117*387f9dfdSAndroid Build Coastguard Worker
118*387f9dfdSAndroid Build Coastguard WorkerA -j option will print just the fields (parsable output, csv):
119*387f9dfdSAndroid Build Coastguard Worker
120*387f9dfdSAndroid Build Coastguard Worker./nfsslower.py -j 0
121*387f9dfdSAndroid Build Coastguard WorkerENDTIME_us,TASK,PID,TYPE,BYTES,OFFSET_b,LATENCY_us,FILE
122*387f9dfdSAndroid Build Coastguard Worker87054476520,dd,22754,W,1048576,0,425,1.test
123*387f9dfdSAndroid Build Coastguard Worker87054482916,dd,22754,W,1048576,1048576,320,1.test
124*387f9dfdSAndroid Build Coastguard Worker87054488179,dd,22754,W,1048576,2097152,389,1.test
125*387f9dfdSAndroid Build Coastguard Worker87054511340,cp,22756,G,0,0,371,1.test
126*387f9dfdSAndroid Build Coastguard Worker87054511685,cp,22756,O,0,0,306,1.test
127*387f9dfdSAndroid Build Coastguard Worker87054511700,cp,22756,G,0,0,2,1.test
128*387f9dfdSAndroid Build Coastguard Worker87054512325,cp,22756,R,131072,0,56,1.test
129*387f9dfdSAndroid Build Coastguard Worker87054512432,cp,22756,R,131072,131072,22,1.test
130*387f9dfdSAndroid Build Coastguard Worker87054512520,cp,22756,R,131072,262144,32,1.test
131*387f9dfdSAndroid Build Coastguard Worker87054512600,cp,22756,R,131072,393216,21,1.test
132*387f9dfdSAndroid Build Coastguard Worker87054512678,cp,22756,R,131072,524288,21,1.test
133*387f9dfdSAndroid Build Coastguard Worker87054512803,cp,22756,R,131072,655360,56,1.test
134*387f9dfdSAndroid Build Coastguard Worker
135*387f9dfdSAndroid Build Coastguard WorkerThis may be useful for visualizing with another tool, for example, for
136*387f9dfdSAndroid Build Coastguard Workerproducing a scatter plot of ENDTIME vs LATENCY, to look for time-based
137*387f9dfdSAndroid Build Coastguard Workerpatterns.
138*387f9dfdSAndroid Build Coastguard Worker
139*387f9dfdSAndroid Build Coastguard WorkerUSAGE message:
140*387f9dfdSAndroid Build Coastguard Worker
141*387f9dfdSAndroid Build Coastguard Workerusage: nfsslower.py [-h] [-j] [-p PID] [min_ms]
142*387f9dfdSAndroid Build Coastguard Worker
143*387f9dfdSAndroid Build Coastguard WorkerTrace READ, WRITE, OPEN and GETATTR NFS calls slower than a threshold,supports NFSv{3,4}
144*387f9dfdSAndroid Build Coastguard Worker
145*387f9dfdSAndroid Build Coastguard Workerpositional arguments:
146*387f9dfdSAndroid Build Coastguard Worker  min_ms             Minimum IO duration to trace in ms (default=10ms)
147*387f9dfdSAndroid Build Coastguard Worker
148*387f9dfdSAndroid Build Coastguard Workeroptional arguments:
149*387f9dfdSAndroid Build Coastguard Worker  -h, --help         show this help message and exit
150*387f9dfdSAndroid Build Coastguard Worker  -j, --csv          just print fields: comma-separated values
151*387f9dfdSAndroid Build Coastguard Worker  -p PID, --pid PID  Trace this pid only
152*387f9dfdSAndroid Build Coastguard Worker
153*387f9dfdSAndroid Build Coastguard Worker ./nfsslower         # trace operations slower than 10ms
154*387f9dfdSAndroid Build Coastguard Worker ./nfsslower 1       # trace operations slower than 1ms
155*387f9dfdSAndroid Build Coastguard Worker ./nfsslower -j 1    # ... 1 ms, parsable output (csv)
156*387f9dfdSAndroid Build Coastguard Worker ./nfsslower 0       # trace all nfs operations
157*387f9dfdSAndroid Build Coastguard Worker ./nfsslower -p 121  # trace pid 121 only
158*387f9dfdSAndroid Build Coastguard Worker
159