Page 1 of 1

Timing a function

Posted: Mon Nov 03, 2003 10:56 am
by alanuk
I want to find out how long it takes for a function to run...

timer on
CallFunction(blah,blah etc etc)
timer off
get time in millisecs

Any ideas please?

Alan

Posted: Mon Nov 03, 2003 11:01 am
by plouf
i think someone has made a lib for that ( :?: )
but you can do it as such

time = GetTickCount_()
YourFunction()
debug GetTickCount_()-time

Re: Timing a function

Posted: Mon Nov 03, 2003 1:31 pm
by Tomio
alanuk wrote:I want to find out how long it takes for a function to run...

timer on
CallFunction(blah,blah etc etc)
timer off
get time in millisecs

Any ideas please?

Alan
This is in millisec:

t1=timeGetTime_()
allFunction(blah,blah etc etc)
t2=timeGetTime_()-t1

../tomio

Posted: Mon Nov 03, 2003 5:49 pm
by Karbon

Posted: Mon Nov 03, 2003 7:30 pm
by alanuk
Thanks guys. Those tips were a great help, and worked fine. If it was in my help file (3.8) I wouldn't have had to ask. But who cares, with a helpful forum such as this, I can live without it's completeness !!

regards Alan

Posted: Tue Nov 04, 2003 3:31 am
by PB
> If it was in my help file (3.8) I wouldn't have had to ask.

It's not in the help file because GetTickCount is an API command (as are
all commands ending with an underscore). All such commands are part
of another huge set of docs for Windows programmers, and as such are
not included with PureBasic because they are not PureBasic-specific.
See the FAQ in the Beginners forum for more details.

Posted: Tue Nov 04, 2003 7:12 pm
by alanuk
Thanks PB, your comments are appreciated. We learn a little bit each day.

Alan