Re: Trying to do a simple time command for procs...can't get output into console...
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: 28 Apr 2007 12:13:33 -0700
On Apr 28, 12:10 am, daneyul <dani...@xxxxxxxxxxxxxxxxxxxxx> wrote:
Inserting a puts command before the time command in the new proc2
procedure gets me into quoting hell. No method seems to work here for
actually getting the output into the console.
Any help would be appreciated!
Do you realize that when you instrument a proc, you have to preserve
its return value (and potentially exceptions it raises) ?
The [time] function returns a string like "xxx microseconds by
iteration". So at the very least to preserve the return value you must
do something like:
proc instrumented_f args {
puts stderr "TIME(f): [time {set _res [eval f $args]}]"
return $_res
}
Of course this is not really transparent since it introduces an extra
call frame. A better approach would directly call the body of f
instead of calling f. But this is not trivial (implies [catch] to
handle various [return]'s from the middle of thebody, and exceptions).
Your best bet would be to follow Cameron's advice rather than reinvent
a somewhat complicated wheel.
-Alex
.
- Follow-Ups:
- References:
- Prev by Date: Re: vwait doesn't return after setting TCL_SetVar from a thread
- Next by Date: Re: Does tclkit support Tclx package
- Previous by thread: Re: Trying to do a simple time command for procs...can't get output into console...
- Next by thread: Re: Trying to do a simple time command for procs...can't get output into console...
- Index(es):
Relevant Pages
|