Timing functions
Ok, i''m trying to benchmark a float to int conversion. Right now i''m using GetTickCount()...is there a better method than this?
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
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
Windows Developer Network has an article about Win32 Performance Measurement Options.
Update GameDev.net system time campaign - success at last
Update GameDev.net system time campaign - success at last
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 100timeGetTime 6881 1333 1264 1241 1322 1239 397GetSystemTimeAsFileTime 79151 195 145 138 194 139 53QueryPerformanceCounter 4939 20707 12873 6675 6550 6578 8839GetThreadTimes – 7961 8877 9159 8556 9089 2992GetProcessTimes – 7858 8836 9134 8639 9239 2964
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement