FPS counter - proper way to use QueryPerformanceCounter?
Is this a good way to track how many frames per second have occured, assuming that frame is being incremented at each buffer flip and frame and starttime are set reset every second?
/////////////////////////////////////////////////////////////////
iTemp=QueryPerformanceCounter(&iGetTickCount);
sec=iGetTickCount.LowPart-starttime.LowPart;
iTemp=QueryPerformanceFrequency(&lTemp);
iFrameRate=(frame*lTemp.LowPart)/sec;
“If you try and please everyone, you won’t please anyone.”
well, QPC return a thousandth of a millisecond. so to get the milliseconds you want to do QueryPerformanceCount*1000. or better yet query the time resolution, then call QueryPerformanceCounter*Resolution. then you need to convert that to a second by multiplying it by 1000.
HHSDrum@yahoo.com
Polarisoft Home Page
HHSDrum@yahoo.com
Polarisoft Home Page
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Be careful. Even though the most common frequency of the performance counter is 1,193,182 Hz, this is not guaranteed. I have seen posts claiming it is 100''s of times faster on some systems. It''s safer to do the math out the long way.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement