xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Examples/seeksize_example.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1The following are examples of seeksize.d.
2
3seeksize.d records disk head seek size for each operation by process.
4This allows up to identify processes that are causing "random" disk
5access and those causing "sequential" disk access.
6
7It is desirable for processes to be accesing the disks in large
8sequential operations. By using seeksize.d and bitesize.d we can
9identify this behaviour.
10
11
12
13In this example we read through a large file by copying it to a
14remote server. Most of the seek sizes are zero, indicating sequential
15access - and we would expect good performance from the disks
16under these conditions,
17
18# ./seeksize.d
19Tracing... Hit Ctrl-C to end.
20^C
21
22   22349  scp /dl/sol-10-b63-x86-v1.iso mars:\0
23
24           value  ------------- Distribution ------------- count
25              -1 |                                         0
26               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   726
27               1 |                                         0
28               2 |                                         0
29               4 |                                         0
30               8 |@                                        13
31              16 |                                         4
32              32 |                                         0
33              64 |                                         0
34             128 |                                         2
35             256 |                                         3
36             512 |                                         4
37            1024 |                                         4
38            2048 |                                         3
39            4096 |                                         0
40            8192 |                                         3
41           16384 |                                         0
42           32768 |                                         1
43           65536 |                                         0
44
45
46
47In this example we run find. The disk operations are fairly scattered,
48as illustrated below by the volume of non sequential reads,
49
50# ./seeksize.d
51Tracing... Hit Ctrl-C to end.
52^C
53
54   22399  find /var/sadm/pkg/\0
55
56           value  ------------- Distribution ------------- count
57              -1 |                                         0
58               0 |@@@@@@@@@@@@@                            1475
59               1 |                                         0
60               2 |                                         44
61               4 |@                                        77
62               8 |@@@                                      286
63              16 |@@                                       191
64              32 |@                                        154
65              64 |@@                                       173
66             128 |@@                                       179
67             256 |@@                                       201
68             512 |@@                                       186
69            1024 |@@                                       236
70            2048 |@@                                       201
71            4096 |@@                                       274
72            8192 |@@                                       243
73           16384 |@                                        154
74           32768 |@                                        113
75           65536 |@@                                       182
76          131072 |@                                        81
77          262144 |                                         0
78
79
80
81
82I found the following interesting. This time I gzipp'd the large file.
83While zipping, the process is reading from one location and writing
84to another. One might expect that as the program toggles between
85reading from one location and writing to another, that often the
86distance would be the same (depending on where UFS puts the new file),
87
88# ./seeksize.d
89Tracing... Hit Ctrl-C to end.
90^C
91
92   22368  gzip sol-10-b63-x86-v1.iso\0
93
94           value  ------------- Distribution ------------- count
95              -1 |                                         0
96               0 |@@@@@@@@@@@@                             353
97               1 |                                         0
98               2 |                                         0
99               4 |                                         0
100               8 |                                         7
101              16 |                                         4
102              32 |                                         2
103              64 |                                         4
104             128 |                                         14
105             256 |                                         3
106             512 |                                         3
107            1024 |                                         5
108            2048 |                                         1
109            4096 |                                         0
110            8192 |                                         3
111           16384 |                                         1
112           32768 |                                         1
113           65536 |                                         1
114          131072 |                                         1
115          262144 |@@@@@@@@                                 249
116          524288 |                                         1
117         1048576 |                                         2
118         2097152 |                                         1
119         4194304 |                                         2
120         8388608 |@@@@@@@@@@@@@@@@@@                       536
121        16777216 |                                         0
122
123
124
125
126The following example compares the operation of "find" with "tar".
127Both are reading from the same location, and we would expect that
128both programs would generally need to do the same number of seeks
129to navigate the direttory tree (depending on caching); and tar
130causing extra operations as it reads the file contents as well,
131
132# ./seeksize.d
133Tracing... Hit Ctrl-C to end.
134^C
135
136     PID  CMD
137   22278  find /etc\0
138
139           value  ------------- Distribution ------------- count
140              -1 |                                         0
141               0 |@@@@@@@@@@@@@@@@@@@@                     251
142               1 |                                         0
143               2 |@                                        8
144               4 |                                         5
145               8 |@                                        10
146              16 |@                                        10
147              32 |@                                        10
148              64 |@                                        9
149             128 |@                                        11
150             256 |@                                        14
151             512 |@@                                       20
152            1024 |@                                        10
153            2048 |                                         6
154            4096 |@                                        7
155            8192 |@                                        10
156           16384 |@                                        16
157           32768 |@@                                       21
158           65536 |@@                                       28
159          131072 |@                                        7
160          262144 |@                                        14
161          524288 |                                         6
162         1048576 |@                                        15
163         2097152 |@                                        7
164         4194304 |                                         0
165
166
167   22282  tar cf /dev/null /etc\0
168
169           value  ------------- Distribution ------------- count
170              -1 |                                         0
171               0 |@@@@@@@@@@                               397
172               1 |                                         0
173               2 |                                         8
174               4 |                                         14
175               8 |                                         16
176              16 |@                                        24
177              32 |@                                        29
178              64 |@@                                       99
179             128 |@@                                       73
180             256 |@@                                       78
181             512 |@@@                                      109
182            1024 |@@                                       62
183            2048 |@@                                       69
184            4096 |@@                                       73
185            8192 |@@@                                      113
186           16384 |@@                                       81
187           32768 |@@@                                      111
188           65536 |@@@                                      108
189          131072 |@                                        49
190          262144 |@                                        33
191          524288 |                                         20
192         1048576 |                                         13
193         2097152 |                                         7
194         4194304 |                                         5
195         8388608 |@                                        30
196        16777216 |                                         0
197
198