]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Examples/php_cputime_example.txt
MFC r368207,368607:
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Examples / php_cputime_example.txt
1 The following are examples of php_cputime.d.
2
3 This script traces the on-CPU time of PHP functions and prints a report. 
4 Here it traces the example program, Code/Php/func_abc.php.
5
6 # php_cputime.d
7 Tracing... Hit Ctrl-C to end.
8 ^C
9
10 Count,
11    FILE                 TYPE       NAME                                COUNT
12    func_abc.php         func       func_a                                  1
13    func_abc.php         func       func_b                                  1
14    func_abc.php         func       func_c                                  1
15    func_abc.php         func       sleep                                   3
16    -                    total      -                                       6
17
18 Exclusive function on-CPU times (us),
19    FILE                 TYPE       NAME                                TOTAL
20    func_abc.php         func       func_c                                 17
21    func_abc.php         func       func_b                                 25
22    func_abc.php         func       func_a                                 74
23    func_abc.php         func       sleep                                  93
24    -                    total      -                                     210
25
26 Inclusive function on-CPU times (us),
27    FILE                 TYPE       NAME                                TOTAL
28    func_abc.php         func       func_c                                 39
29    func_abc.php         func       func_b                                 87
30    func_abc.php         func       sleep                                  93
31    func_abc.php         func       func_a                                210
32
33 In total, six functions were called; sleep was called three times and there
34 was one call each of func_a(), func_b() and func_c().
35
36 The exclusive subroutine on-CPU times show that func_a() spent around 74
37 microseconds on-CPU, func_b() spent 25 microseconds on-CPU, and func_c() spent 
38 17 microseconds on-CPU. This exclusive times excludes time spent in other 
39 subroutines.
40
41 The inclusive subroutine on-CPU times show that func_c() spent around 39
42 microseconds on-CPU, func_b() spent around 87 microseconds on-CPU and 
43 func_a() spent around 210 microseconds. This inclusive time includes the time 
44 spent in other functions called (including sleep),  and since func_a() called 
45 func_b() which called func_c(), these times make perfect sense.
46
47 These on-CPU times are the time the program spent running on a CPU, from when
48 the function began to when it completed. This does not include time
49 spent off-CPU time such as sleeping for I/O or waiting for scheduling.
50
51 On-CPU times are useful for showing who is causing the CPUs to be busy.
52 See Notes/ALLoncpu_notes.txt for more details. Also see
53 Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
54 detailed explanation of exclusive vs inclusive subroutine time.
55
56 If you study the func_abc.php program alongside the above output, the numbers
57 should make sense.
58