1 The following are examples of js_cputime.d.
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
7 Tracing... Hit Ctrl-C to end.
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
24 func_clock.html obj-new Date 37
26 Exclusive function on-CPU times (us),
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
36 Inclusive function on-CPU times (us),
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
45 You can see the results are printed in four sections.
47 The first section reports how many times each subroutine was called, and it's
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.
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
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
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.
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.