|
From: chedderslam on 20 Jun 2008 13:51 How would you calculate sections of code run times? For instance in ColdFusion, there is the function gettickcount(), and you would do something like this: set starttime = gettickcount() (code that you want to time) set endtime = gettickcount() set runtime = endtime - starttime How would I do the same thing in tcl? I would prefer it to be in milliseconds, if possible. I am planning on using the ActiveState Tcl Devkit debugger to get the values of the different time variables, rather than trying to write it to output. Is there functionality that already does what I'm trying to accomplish built in? Thanks.
From: Ron Fox on 20 Jun 2008 14:07 see the tcl time command chedderslam wrote: > How would you calculate sections of code run times? For instance in > ColdFusion, there is the function gettickcount(), and you would do > something like this: > > set starttime = gettickcount() > (code that you want to time) > set endtime = gettickcount() > set runtime = endtime - starttime > > How would I do the same thing in tcl? I would prefer it to be in > milliseconds, if possible. > > I am planning on using the ActiveState Tcl Devkit debugger to get the > values of the different time variables, rather than trying to write it > to output. Is there functionality that already does what I'm trying > to accomplish built in? > > Thanks. -- Ron Fox NSCL Michigan State University East Lansing, MI 48824-1321
From: chedderslam on 20 Jun 2008 15:43 I think I'm doing it wrong. I tried wrapping everything in a time command like this: proc ::requesthandler::/ { {xmlrequestdocument ""} } { set execution time{ (all the code) } return $execution But I'm just getting a blank return.
From: Gerald W. Lester on 20 Jun 2008 16:28 chedderslam wrote: > I think I'm doing it wrong. I tried wrapping everything in a time > command like this: > proc ::requesthandler::/ { {xmlrequestdocument ""} } { > set execution time{ > (all the code) > } > return $execution > > But I'm just getting a blank return. time is a command -- reread the syntax rules of Tcl if what you posted is what you are attempting (it should be throwing an error when you attempt to execute your requesthandler). -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
From: Gerald W. Lester on 20 Jun 2008 16:33 chedderslam wrote: > How would you calculate sections of code run times? For instance in > ColdFusion, there is the function gettickcount(), and you would do > something like this: > > set starttime = gettickcount() > (code that you want to time) > set endtime = gettickcount() > set runtime = endtime - starttime > > How would I do the same thing in tcl? I would prefer it to be in > milliseconds, if possible. > > I am planning on using the ActiveState Tcl Devkit debugger to get the > values of the different time variables, rather than trying to write it > to output. Is there functionality that already does what I'm trying > to accomplish built in? You can't get the run time, you can get the elapsed time (which may or may not be the same thing depending if there was a context switch during your execution). Ron already told you how to get the elapsed time. -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
|
Next
|
Last
Pages: 1 2 Prev: Expect : Interact returns to shell instead of script Next: Sacred EIAS |