Timing a function

Just starting out? Need help? Post your questions and find answers here.
alanuk
User
User
Posts: 68
Joined: Mon Oct 13, 2003 6:38 pm

Timing a function

Post 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
plouf
Enthusiast
Enthusiast
Posts: 250
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

i think someone has made a lib for that ( :?: )
but you can do it as such

time = GetTickCount_()
YourFunction()
debug GetTickCount_()-time
Christos
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Re: Timing a function

Post 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
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
alanuk
User
User
Posts: 68
Joined: Mon Oct 13, 2003 6:38 pm

Post 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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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.
alanuk
User
User
Posts: 68
Joined: Mon Oct 13, 2003 6:38 pm

Post by alanuk »

Thanks PB, your comments are appreciated. We learn a little bit each day.

Alan
Post Reply