1 1.1 christos The following are examples of js_cpudist.d. 2 1.1 christos 3 1.1 christos This script traces the on-CPU time of JavaScript functions and prints a report 4 1.1 christos in the form of a histogram. Here it traces the example program, 5 1.1 christos Code/JavaScript/func_clock.html 6 1.1 christos 7 1.1 christos # js_cpudist.d 8 1.1 christos Tracing... Hit Ctrl-C to end. 9 1.1 christos ^C 10 1.1 christos 11 1.1 christos Elapsed times (us), 12 1.1 christos func_clock.html, obj-new, Date 13 1.1 christos value ------------- Distribution ------------- count 14 1.1 christos 2 | 0 15 1.1 christos 4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 16 1.1 christos 8 | 0 17 1.1 christos 18 1.1 christos 19 1.1 christos Exclusive function on-CPU times (us), 20 1.1 christos func_clock.html, func, setTimeout 21 1.1 christos value ------------- Distribution ------------- count 22 1.1 christos 16 | 0 23 1.1 christos 32 |@@@@@@@@@@@@@@@@@@@@ 2 24 1.1 christos 64 |@@@@@@@@@@@@@@@@@@@@ 2 25 1.1 christos 128 | 0 26 1.1 christos 27 1.1 christos func_clock.html, func, getElementById 28 1.1 christos value ------------- Distribution ------------- count 29 1.1 christos 4 | 0 30 1.1 christos 8 |@@@@@@@@@@ 4 31 1.1 christos 16 |@@@@@@@@@@ 4 32 1.1 christos 32 |@@@@@@@@@@@@@@@@@@@@ 8 33 1.1 christos 64 | 0 34 1.1 christos 35 1.1 christos func_clock.html, func, start 36 1.1 christos value ------------- Distribution ------------- count 37 1.1 christos 256 | 0 38 1.1 christos 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 39 1.1 christos 1024 | 0 40 1.1 christos 41 1.1 christos func_clock.html, func, func_a 42 1.1 christos value ------------- Distribution ------------- count 43 1.1 christos 8192 | 0 44 1.1 christos 16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 45 1.1 christos 32768 | 0 46 1.1 christos 47 1.1 christos func_clock.html, func, func_b 48 1.1 christos value ------------- Distribution ------------- count 49 1.1 christos 16384 | 0 50 1.1 christos 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 51 1.1 christos 65536 | 0 52 1.1 christos 53 1.1 christos func_clock.html, func, func_c 54 1.1 christos value ------------- Distribution ------------- count 55 1.1 christos 16384 | 0 56 1.1 christos 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 57 1.1 christos 65536 | 0 58 1.1 christos 59 1.1 christos 60 1.1 christos Inclusive function on-CPU times (us), 61 1.1 christos func_clock.html, func, setTimeout 62 1.1 christos value ------------- Distribution ------------- count 63 1.1 christos 16 | 0 64 1.1 christos 32 |@@@@@@@@@@@@@@@@@@@@ 2 65 1.1 christos 64 |@@@@@@@@@@@@@@@@@@@@ 2 66 1.1 christos 128 | 0 67 1.1 christos 68 1.1 christos func_clock.html, func, getElementById 69 1.1 christos value ------------- Distribution ------------- count 70 1.1 christos 4 | 0 71 1.1 christos 8 |@@@@@@@@@@ 4 72 1.1 christos 16 |@@@@@@@@@@ 4 73 1.1 christos 32 |@@@@@@@@@@@@@@@@@@@@ 8 74 1.1 christos 64 | 0 75 1.1 christos 76 1.1 christos func_clock.html, func, func_c 77 1.1 christos value ------------- Distribution ------------- count 78 1.1 christos 16384 | 0 79 1.1 christos 32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 80 1.1 christos 65536 | 0 81 1.1 christos 82 1.1 christos func_clock.html, func, func_a 83 1.1 christos value ------------- Distribution ------------- count 84 1.1 christos 32768 | 0 85 1.1 christos 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 86 1.1 christos 131072 | 0 87 1.1 christos 88 1.1 christos func_clock.html, func, func_b 89 1.1 christos value ------------- Distribution ------------- count 90 1.1 christos 32768 | 0 91 1.1 christos 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 92 1.1 christos 131072 | 0 93 1.1 christos 94 1.1 christos func_clock.html, func, start 95 1.1 christos value ------------- Distribution ------------- count 96 1.1 christos 32768 | 0 97 1.1 christos 65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 98 1.1 christos 131072 | 0 99 1.1 christos 100 1.1 christos The first section, Exclusive function on-CPU times, shows us the time spent 101 1.1 christos on-CPU by various functions, not including time spent in subroutines. You can 102 1.1 christos see here that func_a had four instances of being on-CPU between 16384 103 1.1 christos microseconds and 32767 microseconds. 104 1.1 christos 105 1.1 christos The second section, Inclusive function on-CPU times, shows us the time spent 106 1.1 christos on-CPU by various functions, including that time spent in subroutines called 107 1.1 christos by those functions. You can see that here func_a had four instances of being 108 1.1 christos on-CPU between 65536 microseconds and 131071 microseconds. 109 1.1 christos 110 1.1 christos It is important to pay close attention to the third column, "count" as this 111 1.1 christos will indicate if there were any instances in a particular timeframe, even if 112 1.1 christos the number is too small to show up on the histogram clearly. 113