PDA

View Full Version : The timer is mysterious


prettyPixel
02-21-2005, 12:37 PM
I would like to determine the time elapsed when a function is running (I want to compare speed performance)
I have tried this, but that's not working.
The timer works only when the computer makes nothing!

Can anybody help me? I don't understand...
Thanks


utility testSpeed "test speed"
(
timer clock "timer" interval:100
button test_osd "test 1"
button test2_osd "test 2"

fn myfunction =
(
clearListener()
startTimer=clock.ticks
-- Time to measure
messageBox("timer is running .... press me to stop")
messageBox ("timer="+((clock.ticks-startTimer)/10.0) as string+" sec")
)--fn

fn myfunction2 =
(
clearListener()
startTimer=clock.ticks
-- Time to measure
for i=1 to 2000000 do (j=sqrt i)
messageBox ("timer="+((clock.ticks-startTimer)/10.0) as string+" sec")
)--fn

on test_osd pressed do myfunction()
on test2_osd pressed do myfunction2()
)
createDialog testSpeed

PEN
02-21-2005, 02:20 PM
Right from the help file, is this what you want?

start = timeStamp()
process_mesh() -- do some big job
end = timeStamp()
format "Processing took % seconds\n" ((end - start) / 1000.0)

prettyPixel
02-21-2005, 03:40 PM
Right from the help file, is this what you want?

start = timeStamp()
process_mesh() -- do some big job
end = timeStamp()
format "Processing took % seconds\n" ((end - start) / 1000.0)


thanks you very much PEN, it's exactly what I wished!
the function timestamp() work in all cases
I did not think of using the hour of the system :argh:

your help is precious, thanks you again :thumbsup:

CGTalk Moderation
02-21-2006, 04:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.