1 1.1 christos The following are examples of tcl_calltime.d. 2 1.1 christos 3 1.1 christos This script traces the total elapsed time of different Tcl commands and 4 1.1 christos procedures and prints a report. Here it traces the example program, 5 1.1 christos Code/Tcl/func_abc.tcl 6 1.1 christos 7 1.1 christos # tcl_calltime.d 8 1.1 christos Tracing... Hit Ctrl-C to end. 9 1.1 christos ^C 10 1.1 christos 11 1.1 christos Top 10 counts, 12 1.1 christos PID TYPE NAME COUNT 13 1.1 christos 16028 cmd after 3 14 1.1 christos 16028 cmd namespace 3 15 1.1 christos 16028 cmd puts 3 16 1.1 christos 16028 cmd lappend 4 17 1.1 christos 16028 cmd lsearch 4 18 1.1 christos 16028 cmd if 8 19 1.1 christos 16028 cmd info 11 20 1.1 christos 16028 cmd file 12 21 1.1 christos 16028 cmd proc 12 22 1.1 christos 0 total - 85 23 1.1 christos 24 1.1 christos Top 10 exclusive elapsed times (us), 25 1.1 christos PID TYPE NAME TOTAL 26 1.1 christos 16028 cmd tclInit 253 27 1.1 christos 16028 cmd namespace 272 28 1.1 christos 16028 proc func_c 330 29 1.1 christos 16028 proc func_b 357 30 1.1 christos 16028 proc func_a 363 31 1.1 christos 16028 cmd file 416 32 1.1 christos 16028 cmd if 852 33 1.1 christos 16028 cmd source 929 34 1.1 christos 16028 cmd after 3025152 35 1.1 christos 0 total - 3030001 36 1.1 christos 37 1.1 christos Top 10 inclusive elapsed times (us), 38 1.1 christos PID TYPE NAME TOTAL 39 1.1 christos 16028 cmd uplevel 1849 40 1.1 christos 16028 proc tclInit 2519 41 1.1 christos 16028 cmd tclInit 2772 42 1.1 christos 16028 proc func_c 1010031 43 1.1 christos 16028 cmd func_c 1010088 44 1.1 christos 16028 proc func_b 2020059 45 1.1 christos 16028 cmd func_b 2020106 46 1.1 christos 16028 cmd after 3025152 47 1.1 christos 16028 proc func_a 3026545 48 1.1 christos 16028 cmd func_a 3026572 49 1.1 christos 50 1.1 christos The output is in three sections. The first shows the top ten most executed 51 1.1 christos commands while the script is tracing. 52 1.1 christos 53 1.1 christos The second (Top 10 exclusive elapsed times) shows us the top ten slowest 54 1.1 christos commands or procedures, this number excludes any subroutines called during 55 1.1 christos command execution. 56 1.1 christos 57 1.1 christos The third (Top 10 inclusive elapsed times) shows us the top ten slowest 58 1.1 christos commands or procedures including any time spent in subroutines. You can see 59 1.1 christos that func_a took the most amount of time all up. This makes sense if you 60 1.1 christos compare the code at Code/Tcl/func_abc.tcl with the results. 61 1.1 christos 62