Skip to content

Instantly share code, notes, and snippets.

@jamerfort
Created August 30, 2012 17:01
Show Gist options
  • Save jamerfort/3533352 to your computer and use it in GitHub Desktop.
Save jamerfort/3533352 to your computer and use it in GitHub Desktop.
Create procs to time sections of TCL code.
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