xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Docs/Examples/php_cpudist_example.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1The following are examples of php_cpudist.d.
2
3This script traces the on-CPU time of PHP functions and prints a report
4containing distribution plots per subroutine. Here it traces the example
5program Code/Php/func_abc.php.
6
7# php_cpudist.d
8Tracing... Hit Ctrl-C to end.
9^C
10
11Exclusive function on-CPU times (us),
12   func_abc.php, func, func_a
13           value  ------------- Distribution ------------- count
14               8 |                                         0
15              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
16              32 |                                         0
17
18   func_abc.php, func, func_b
19           value  ------------- Distribution ------------- count
20               8 |                                         0
21              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
22              32 |                                         0
23
24   func_abc.php, func, func_c
25           value  ------------- Distribution ------------- count
26               8 |                                         0
27              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
28              32 |                                         0
29
30   func_abc.php, func, sleep
31           value  ------------- Distribution ------------- count
32               8 |                                         0
33              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
34              32 |                                         0
35
36
37Inclusive function on-CPU times (us),
38   func_abc.php, func, func_c
39           value  ------------- Distribution ------------- count
40              16 |                                         0
41              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
42              64 |                                         0
43
44   func_abc.php, func, sleep
45           value  ------------- Distribution ------------- count
46               8 |                                         0
47              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
48              32 |                                         0
49
50   func_abc.php, func, func_b
51           value  ------------- Distribution ------------- count
52              32 |                                         0
53              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
54             128 |                                         0
55
56   func_abc.php, func, func_a
57           value  ------------- Distribution ------------- count
58              64 |                                         0
59             128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
60             256 |                                         0
61
62In total, 3 subroutines were called, one each of func_a(), func_b() and
63func_c(), and sleep was called 3 times.  You can see this reflected in the
64"count" column on the right.
65
66The exclusive subroutine elapsed times show that each subroutine spent
67between 16 and 31 microseconds on CPU. This time excludes the time spent in
68other subroutines.
69
70The inclusive subroutine elapsed times show that func_c() took between 32
71microseconds and 63 microseconds on CPU; sleep ran three times and each time
72took between 16 and 31 microseconds on CPU; func_b() took between 64 and 127
73microseconds on CPU; and func_a() took between 128 and 255 microseconds on
74CPU.  This time includes the time spent in other subroutines called, and since
75func_a() called func_b() which called func_c(), these times make sense.
76
77These elapsed times are the on CPU time from when the subroutine began to
78when it completed.
79
80On-CPU times are useful for showing who is causing the CPUs to be busy.
81See Notes/ALLelapsed_notes.txt for more details. Also see
82Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
83detailed explanation of exclusive vs inclusive subroutine time.
84
85