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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
The following are examples of sh_calldist.d.
This script traces the elapsed time of Bourne shell functions and
prints a report containing distribution plots per function. Here it
traces the example program, Code/Shell/func_abc.sh.
# sh_calldist.d
Tracing... Hit Ctrl-C to end.
^C
Elapsed times (us),
func_abc.sh, builtin, echo
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@@@@@@ 1
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
64 | 0
func_abc.sh, cmd, sleep
value ------------- Distribution ------------- count
262144 | 0
524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
1048576 | 0
Exclusive function elapsed times (us),
func_abc.sh, func, func_a
value ------------- Distribution ------------- count
1024 | 0
2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4096 | 0
func_abc.sh, func, func_b
value ------------- Distribution ------------- count
1024 | 0
2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4096 | 0
func_abc.sh, func, func_c
value ------------- Distribution ------------- count
1024 | 0
2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4096 | 0
Inclusive function elapsed times (us),
func_abc.sh, func, func_c
value ------------- Distribution ------------- count
262144 | 0
524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
1048576 | 0
func_abc.sh, func, func_b
value ------------- Distribution ------------- count
524288 | 0
1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
2097152 | 0
func_abc.sh, func, func_a
value ------------- Distribution ------------- count
1048576 | 0
2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4194304 | 0
The elapsed times show that the echo builtin takes between 16 and 64 us
to execute.
The exclusive function elapsed times show that each function spent
between 2 and 4 ms. This exclusive time excludes the time spent in
other functions.
The inclusive function elapsed times show that func_c() took between 0.5 and
1.0 seconds, func_b() took between 1.0 and 2.1 seconds, and func_a() took
between 2.1 and 4.2 seconds to execute. This inclusive time includes the
time spent in other functions and commands called, and since func_a()
calls func_b() which calls func_c(), and, each function is calling "sleep 1",
these times make sense.
These elapsed times are the absolute time from when the function began to
when it completed - which includes off-CPU time due to other system events
such as I/O, scheduling, interrupts, etc.
Elapsed times are useful for identifying where latencies are.
See Notes/ALLelapsed_notes.txt for more details. Also see
Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
detailed explanation of exclusive vs inclusive function time.
The following traces the firefox startup script.
# sh_calldist.d
Tracing... Hit Ctrl-C to end.
^C
Elapsed times (us),
run-mozilla.sh, builtin, return
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
2 | 0
run-mozilla.sh, builtin, shift
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
2 | 0
run-mozilla.sh, builtin, break
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
4 | 0
firefox, builtin, break
value ------------- Distribution ------------- count
2 | 0
4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
8 | 0
run-mozilla.sh, builtin, export
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@@@@@@ 1
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
4 | 0
firefox, builtin, export
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
4 |@@@@@@@@@@@@@ 1
8 | 0
firefox, builtin, :
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
2 | 0
4 |@@@@@@@ 1
8 | 0
firefox, builtin, pwd
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
64 | 0
firefox, builtin, test
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
64 | 0
firefox, builtin, cd
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@ 1
16 |@@@@@@@@@@@@@ 1
32 |@@@@@@@@@@@@@ 1
64 | 0
firefox, builtin, [
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@ 3
2 |@@ 1
4 |@@ 1
8 |@@@@@@@ 3
16 |@@@@@@@@@@@ 5
32 |@@@@@@@ 3
64 |@@@@ 2
128 | 0
run-mozilla.sh, builtin, type
value ------------- Distribution ------------- count
256 | 0
512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
1024 | 0
run-mozilla.sh, builtin, [
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@ 4
2 |@@@@@@@@@@ 5
4 |@@@@ 2
8 |@@@@@@ 3
16 |@@@@@@@@@@ 5
32 | 0
64 | 0
128 | 0
256 | 0
512 | 0
1024 | 0
2048 |@@ 1
4096 | 0
firefox, builtin, echo
value ------------- Distribution ------------- count
64 | 0
128 |@@@@@@@@@@@@@@@@@@@@ 1
256 | 0
512 | 0
1024 | 0
2048 |@@@@@@@@@@@@@@@@@@@@ 1
4096 | 0
firefox, cmd, /usr/lib/firefox/run-mozilla.sh
value ------------- Distribution ------------- count
2097152 | 0
4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
8388608 | 0
run-mozilla.sh, cmd, /usr/lib/firefox/firefox-bin
value ------------- Distribution ------------- count
2097152 | 0
4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
8388608 | 0
Exclusive function elapsed times (us),
run-mozilla.sh, func, moz_test_binary
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
64 | 0
firefox, func, moz_spc_verbose_echo
value ------------- Distribution ------------- count
2 | 0
4 |@@@@@@@@@@@@@ 2
8 |@@@@@@@@@@@@@ 2
16 |@@@@@@@@@@@@@ 2
32 | 0
firefox, func, moz_pis_startstop_scripts
value ------------- Distribution ------------- count
128 | 0
256 |@@@@@@@@@@@@@@@@@@@@ 1
512 | 0
1024 | 0
2048 | 0
4096 | 0
8192 | 0
16384 | 0
32768 |@@@@@@@@@@@@@@@@@@@@ 1
65536 | 0
run-mozilla.sh, func, moz_run_program
value ------------- Distribution ------------- count
65536 | 0
131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
262144 | 0
Inclusive function elapsed times (us),
firefox, func, moz_spc_verbose_echo
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
16 |@@@@@@@@@@@@@ 2
32 | 0
run-mozilla.sh, func, moz_test_binary
value ------------- Distribution ------------- count
32 | 0
64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
128 | 0
firefox, func, moz_pis_startstop_scripts
value ------------- Distribution ------------- count
128 | 0
256 |@@@@@@@@@@@@@@@@@@@@ 1
512 | 0
1024 | 0
2048 | 0
4096 | 0
8192 | 0
16384 | 0
32768 |@@@@@@@@@@@@@@@@@@@@ 1
65536 | 0
run-mozilla.sh, func, moz_run_program
value ------------- Distribution ------------- count
2097152 | 0
4194304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
8388608 | 0
As an example of interpreting the output: the inclusive elapsed time for
the "[" (test) builtin,
firefox, builtin, [
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@ 3
2 |@@ 1
4 |@@ 1
8 |@@@@@@@ 3
16 |@@@@@@@@@@@ 5
32 |@@@@@@@ 3
64 |@@@@ 2
128 | 0
shows that it was called 17 times (after adding up the counts), 5 of which
took between 16 and 31 microseconds.
|