Archived

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

Jess

Best FPS Counter?

Recommended Posts

Jess    122
maybe this question be a bit stupid, but what is the best method to get the fps?, enough precise and fast, less cpu use, ... get the time every second or every 100ms and multiply it by 10?

Share this post


Link to post
Share on other sites
Cybertron    122
For each frame increment the number of frames. When one second has passed copy the number, set it to zero and reset the timer

So basically you are counting the number of frames per second

Whatever works for you, it is IMPOSSIBLE to mess up the performance doing somethig like this

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
It is NOT impossible to mess up the performance on something likes this. Your options from worst accuracy to slowest performance are:

(1) GetTickCount( ), Fastest yet I caution you that the "ticks" can vary from machine to machine

(2) timeGetTime(), coupled with timeBeginPeriod and timeEndPeriod for setting 1 ms resolution.

(3) QueryPerformanceCounter(), this most accurate but the most expensive function call as well.

Share this post


Link to post
Share on other sites
RhoneRanger    100
Set time get time to read in the milisecond.
game loop start

CurrentTime=timeGetTime();

elapsed = CurrentTime-LastTime;
LastTime=CurrentTime;
fps=1/Elasped;

gamd loop end

Share this post


Link to post
Share on other sites