Archived

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

MattS423

Timing functions

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.


--Vic--

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