This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How can I check how long it takes to execute a proc?

Help for those learning Tcl or writing their own scripts.
Post Reply
D
Danko
Voice
Posts: 18
Joined: Thu Mar 09, 2006 1:07 pm

How can I check how long it takes to execute a proc?

Post by Danko »

How can I check how long it takes to execute a proc?

aka "Search took x.xxx ms" or something..
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
D
Danko
Voice
Posts: 18
Joined: Thu Mar 09, 2006 1:07 pm

Post by Danko »

hm.. could you also give a short example of how to use it in a proc, since I'm quite lost?

Code: Select all

proc myproc {nick host hand channel arg} {
  set temp [lindex [split $arg] 0]
  putquick "privmsg $channel :$temp [time?!]"
} 
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

[time] in eggdrop is different than Tcl's [time] command. You can do tests in tclsh, for example:
% proc bla str {
puts $str
}
% time {bla "hey hi!"}
hey hi!
78 microseconds per iteration
% time {bla "hey hi!"} 10
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
hey hi!
37.8 microseconds per iteration
%
Edit: It seems that the [time] command works normally on eggdrop1.6.18.
Post Reply