TCL - how to know how much time a function has worked?

Narek picture Narek · Mar 9, 2011 · Viewed 18.4k times · Source

Say I have a proc and the proc consists of several statements and function calls. How I can know how much time the function has taken so far?

Answer

TrojanName picture TrojanName · Mar 9, 2011

a very crude example would be something like:

set TIME_start [clock clicks -milliseconds]
...do something...
set TIME_taken [expr [clock clicks -milliseconds] - $TIME_start]

Using the time proc, you can do the following:

% set tt [time {set x [expr 23 * 34]}]
38 microseconds per iteration