Created
August 30, 2012 17:01
-
-
Save jamerfort/3533352 to your computer and use it in GitHub Desktop.
Create procs to time sections of TCL code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if { ![info exists ::__times] } { | |
proc __time_start {name} { | |
lappend ::__times(${name}::start) [clock clicks] | |
} | |
proc __time_end {name} { | |
set queue $::__times(${name}::start) | |
set start [lindex $queue end] | |
set queue [lrange $queue 0 end-1] | |
set ::__times(${name}::start) $queue | |
puts stderr "##### [format "%08d" [expr {[clock clicks] - $start}]] ==> $name" | |
} | |
array set ::__times {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment