]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Examples/js_cputime_example.txt
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Examples / js_cputime_example.txt
1 The following are examples of js_cputime.d.
2
3 This script traces the on-CPU time of JavaScript functions and prints a report. 
4 Here it traces the example program, Code/JavaScript/func_clock.html
5
6 # js_cputime.d
7 Tracing... Hit Ctrl-C to end.
8 ^C
9
10 Count,
11    FILE                 TYPE       NAME                                COUNT
12    func_clock.html      func       func_a                                  5
13    func_clock.html      func       func_b                                  5
14    func_clock.html      func       func_c                                  5
15    func_clock.html      func       setTimeout                              5
16    func_clock.html      func       start                                   5
17    func_clock.html      obj-new    Date                                    5
18    func_clock.html      func       getElementById                         20
19    -                    total      -                                      50
20
21 Elapsed times (us),
22    FILE                 TYPE       NAME                                TOTAL
23    -                    total      -                                      37
24    func_clock.html      obj-new    Date                                   37
25
26 Exclusive function on-CPU times (us),
27    FILE                 TYPE       NAME                                TOTAL
28    func_clock.html      func       setTimeout                            316
29    func_clock.html      func       getElementById                        588
30    func_clock.html      func       start                                4734
31    func_clock.html      func       func_a                              83465
32    func_clock.html      func       func_b                             166613
33    func_clock.html      func       func_c                             247683
34    -                    total      -                                  503402
35
36 Inclusive function on-CPU times (us),
37    FILE                 TYPE       NAME                                TOTAL
38    func_clock.html      func       setTimeout                            316
39    func_clock.html      func       getElementById                        588
40    func_clock.html      func       func_c                             247872
41    func_clock.html      func       func_b                             414601
42    func_clock.html      func       func_a                             498142
43    func_clock.html      func       start                              503439
44
45 You can see the results are printed in four sections.
46
47 The first section reports how many times each subroutine was called, and it's
48 type.
49
50 The second section reports on the on-CPU time of anything that was not of type
51 "func", in this case the only elements reported here are Date obj-new.
52
53 The exclusive subroutine on-CPU times shows, amongst other results, that func_a 
54 spent around 83,000 microseconds on-CPU.  This time excludes time spent in 
55 other subroutines.
56
57 The inclusive subroutine on-CPU times show that func_a spent around 0.5
58 seconds on-CPU.  This includes the time spent in other subroutines
59 called.
60
61 These on-CPU times are the time the thread spent running on a CPU, from when
62 the subroutine began to when it completed. This does not include time
63 spent off-CPU time such as sleeping for I/O or waiting for scheduling.
64
65 On-CPU times are useful for showing who is causing the CPUs to be busy.
66 See Notes/ALLoncpu_notes.txt for more details. Also see
67 Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
68 detailed explanation of exclusive vs inclusive subroutine time.
69