1 The following are examples of sh_cpudist.d.
3 This script traces the on-CPU time of Bourne shell functions and
4 prints a report containing distribution plots per function. Here it
5 traces the example program, Code/Shell/func_slow.sh.
8 Tracing... Hit Ctrl-C to end.
13 func_slow.sh, builtin, echo
14 value ------------- Distribution ------------- count
17 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
20 func_slow.sh, builtin, [
21 value ------------- Distribution ------------- count
26 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 575
32 Exclusive function on-CPU times (us),
34 func_slow.sh, func, func_a
35 value ------------- Distribution ------------- count
37 131072 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
40 func_slow.sh, func, func_b
41 value ------------- Distribution ------------- count
43 524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
46 func_slow.sh, func, func_c
47 value ------------- Distribution ------------- count
49 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
52 Inclusive function on-CPU times (us),
54 func_slow.sh, func, func_b
55 value ------------- Distribution ------------- count
57 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
60 func_slow.sh, func, func_c
61 value ------------- Distribution ------------- count
63 1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
66 func_slow.sh, func, func_a
67 value ------------- Distribution ------------- count
69 2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
72 The on-CPU times should that the "[" builtin (test) usually took between
73 8 and 15 microseconds to execute, and was called over 500 times.
75 The exclusive function on-CPU times show that func_a() spent between
76 131 ms and 262 ms on-CPU.
78 The inclusive function on-CPU times show that both func_b() and func_c()
79 spent between 1.0 and 2.1 seconds on-CPU, and func_a() spent between 2.1
80 and 4.2 seconds on-CPU. This inclusive time includes the time spent in other
81 functions called, and since func_a() called func_b() which called func_c(),
82 these times make sense.
84 These on-CPU times are the time the thread spent running on a CPU, from when
85 the function began to when it completed. This does not include time
86 spent off-CPU time such as sleeping for I/O or waiting for scheduling.
88 On-CPU times are useful for showing who is causing the CPUs to be busy.
89 See Notes/ALLoncpu_notes.txt for more details. Also see
90 Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
91 detailed explanation of exclusive vs inclusive function time.