Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Timing functions

This topic is 5553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, i''m trying to benchmark a float to int conversion. Right now i''m using GetTickCount()...is there a better method than this?

Share this post

Link to post
Share on other sites
Three things you can do:

1. Use timeGetTime.
2. Do the function an insane number of times, like 100,000 or more.
3. Repeat a few times.

This should give you a pretty good average time. Also, keep one thing in mind. Say you have a loop. If you put the coversion directly in the loop, your time will be VERY different from the time you''ll get if you put it in a function. Why? Function calls take time, in fact, I''m pretty sure a function call takes more time than the conversion. Keep that in mind.


The future of 2D game development:
Flat Red Ball

Share this post

Link to post
Share on other sites
Here is a table from that article:

Call cost of timing functions (as percentage of GetTickCount())
Call Cost 98 NT 4 2000 2000 NT 4 2000 XP
(% of GetTickCount()) (SMP) (SMP) (SMP)
GetTickCount 100 100 100 100 100 100 100
timeGetTime 6881 1333 1264 1241 1322 1239 397
GetSystemTimeAsFileTime 79151 195 145 138 194 139 53
QueryPerformanceCounter 4939 20707 12873 6675 6550 6578 8839
GetThreadTimes – 7961 8877 9159 8556 9089 2992
GetProcessTimes – 7858 8836 9134 8639 9239 2964

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!