1 The following are examples of php_cputime.d.
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.
7 Tracing... Hit Ctrl-C to end.
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
18 Exclusive function on-CPU times (us),
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
26 Inclusive function on-CPU times (us),
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
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().
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
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.
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.
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.
56 If you study the func_abc.php program alongside the above output, the numbers