Jump to content
  • Advertisement

Archived

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

kingy

FPS counter - proper way to use QueryPerformanceCounter?

This topic is 6350 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

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;

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!