1 The following are examples of pl_cpudist.d.
3 This script traces the on-CPU time of Perl subroutines (functions) and
4 prints a report containing distribution plots per subroutine. Here it
5 traces the example program, Code/Perl/func_slow.pl.
8 Tracing... Hit Ctrl-C to end.
11 Exclusive subroutine on-CPU times (us),
12 func_slow.pl, sub, func_a
13 value ------------- Distribution ------------- count
15 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
18 func_slow.pl, sub, func_b
19 value ------------- Distribution ------------- count
21 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
24 func_slow.pl, sub, func_c
25 value ------------- Distribution ------------- count
27 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
31 Inclusive subroutine on-CPU times (us),
32 func_slow.pl, sub, func_c
33 value ------------- Distribution ------------- count
35 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
38 func_slow.pl, sub, func_a
39 value ------------- Distribution ------------- count
41 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
44 func_slow.pl, sub, func_b
45 value ------------- Distribution ------------- count
47 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
50 The exclusive subroutine on-CPU times show that func_a() spent between
51 262 ms and 524 ms on-CPU, while func_b() and func_c() both spent between
52 524 ms and 1048 ms on-CPU.
54 The inclusive subroutine on-CPU times show that func_c() spent between 0.5 and
55 1.0 seconds, and both func_b() and func_a() spent between 1.0 and 2.1 seconds
56 of CPU time. This inclusive time includes the time spent in other subroutines
57 called, and since func_a() called func_b() which called func_c(), these times
60 These on-CPU times are the time the thread spent running on a CPU, from when
61 the subroutine began to when it completed. This does not include time
62 spent off-CPU time such as sleeping for I/O or waiting for scheduling.
64 On-CPU times are useful for showing who is causing the CPUs to be busy.
65 See Notes/ALLoncpu_notes.txt for more details. Also see
66 Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
67 detailed explanation of exclusive vs inclusive subroutine time.
70 The following traces a Perl network interface statistics tool, "nicstat"
74 Tracing... Hit Ctrl-C to end.
77 Exclusive subroutine on-CPU times (us),
78 Config.pm, sub, TIEHASH
79 value ------------- Distribution ------------- count
81 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
84 DynaLoader.pm, sub, dl_load_flags
85 value ------------- Distribution ------------- count
87 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
91 value ------------- Distribution ------------- count
93 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
96 Config.pm, sub, DESTROY
97 value ------------- Distribution ------------- count
99 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
102 register.pm, sub, mkMask
103 value ------------- Distribution ------------- count
105 2 |@@@@@@@@@@@@@@@@@@@@ 1
106 4 |@@@@@@@@@@@@@@@@@@@@ 1
109 Config.pm, sub, import
110 value ------------- Distribution ------------- count
112 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
115 Config.pm, sub, FETCH
116 value ------------- Distribution ------------- count
118 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
122 strict.pm, sub, unimport
123 value ------------- Distribution ------------- count
125 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
130 value ------------- Distribution ------------- count
132 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
135 register.pm, sub, import
136 value ------------- Distribution ------------- count
138 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
141 strict.pm, sub, import
142 value ------------- Distribution ------------- count
144 2 |@@@@@@@@@@@@@@@@ 2
151 value ------------- Distribution ------------- count
153 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
158 AutoLoader.pm, sub, BEGIN
159 value ------------- Distribution ------------- count
170 value ------------- Distribution ------------- count
172 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
175 Exporter.pm, sub, import
176 value ------------- Distribution ------------- count
178 16 |@@@@@@@@@@@@@@@@@@@@ 1
180 64 |@@@@@@@@@@@@@@@@@@@@ 1
183 nicstat, sub, print_neat
184 value ------------- Distribution ------------- count
186 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16
191 DynaLoader.pm, sub, bootstrap
192 value ------------- Distribution ------------- count
194 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
197 warnings.pm, sub, BEGIN
198 value ------------- Distribution ------------- count
200 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
203 DynaLoader.pm, sub, BEGIN
204 value ------------- Distribution ------------- count
206 256 |@@@@@@@@@@@@@@@@@@@@ 1
207 512 |@@@@@@@@@@@@@@@@@@@@ 1
211 value ------------- Distribution ------------- count
224 2048 |@@@@@@@@@@@@@ 1
228 value ------------- Distribution ------------- count
230 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
240 2048 |@@@@@@@@@@@@@ 1
244 value ------------- Distribution ------------- count
246 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
249 2048 |@@@@@@@@@@@@@ 1
252 nicstat, sub, fetch_net_data
253 value ------------- Distribution ------------- count
255 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
258 nicstat, sub, find_nets
259 value ------------- Distribution ------------- count
261 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
265 Inclusive subroutine on-CPU times (us),
266 Config.pm, sub, TIEHASH
267 value ------------- Distribution ------------- count
269 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
272 DynaLoader.pm, sub, dl_load_flags
273 value ------------- Distribution ------------- count
275 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
278 Config.pm, sub, DESTROY
279 value ------------- Distribution ------------- count
281 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
284 register.pm, sub, mkMask
285 value ------------- Distribution ------------- count
287 2 |@@@@@@@@@@@@@@@@@@@@ 1
288 4 |@@@@@@@@@@@@@@@@@@@@ 1
291 Config.pm, sub, import
292 value ------------- Distribution ------------- count
294 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
297 Config.pm, sub, FETCH
298 value ------------- Distribution ------------- count
300 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
304 Config.pm, sub, BEGIN
305 value ------------- Distribution ------------- count
307 4 |@@@@@@@@@@@@@@@@@@@@ 1
309 16 |@@@@@@@@@@@@@@@@@@@@ 1
312 strict.pm, sub, unimport
313 value ------------- Distribution ------------- count
315 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
318 strict.pm, sub, import
319 value ------------- Distribution ------------- count
321 2 |@@@@@@@@@@@@@@@@ 2
323 8 |@@@@@@@@@@@@@@@@ 2
328 value ------------- Distribution ------------- count
330 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
336 value ------------- Distribution ------------- count
338 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
341 register.pm, sub, import
342 value ------------- Distribution ------------- count
344 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
348 value ------------- Distribution ------------- count
350 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
353 AutoLoader.pm, sub, BEGIN
354 value ------------- Distribution ------------- count
364 Exporter.pm, sub, import
365 value ------------- Distribution ------------- count
367 16 |@@@@@@@@@@@@@@@@@@@@ 1
369 64 |@@@@@@@@@@@@@@@@@@@@ 1
372 nicstat, sub, print_neat
373 value ------------- Distribution ------------- count
375 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16
380 DynaLoader.pm, sub, bootstrap
381 value ------------- Distribution ------------- count
383 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
386 warnings.pm, sub, BEGIN
387 value ------------- Distribution ------------- count
389 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
393 value ------------- Distribution ------------- count
406 2048 |@@@@@@@@@@@@@ 1
409 DynaLoader.pm, sub, BEGIN
410 value ------------- Distribution ------------- count
412 512 |@@@@@@@@@@@@@@@@@@@@ 1
414 2048 |@@@@@@@@@@@@@@@@@@@@ 1
418 value ------------- Distribution ------------- count
430 4096 |@@@@@@@@@@@@@ 1
434 value ------------- Distribution ------------- count
439 2048 |@@@@@@@@@@@@@ 1
441 8192 |@@@@@@@@@@@@@ 1
444 nicstat, sub, fetch_net_data
445 value ------------- Distribution ------------- count
447 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
450 nicstat, sub, find_nets
451 value ------------- Distribution ------------- count
453 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
456 As an example of interpreting the output: the inclusive on-CPU time for
457 the "print_neat" subroutine in "nicstat",
459 nicstat, sub, print_neat
460 value ------------- Distribution ------------- count
462 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16
467 shows that "print_neat" was called 18 times, 16 of which spent between 16
468 and 31 microseconds on-CPU, once between 32 and 63 microseconds, and once
469 between 64 and 127 microseconds.