Archived

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

bg3ntl

fps counter and timing with highperformancetimer

Recommended Posts

bg3ntl    122
ok, think ive been up too long cause i cant seem to get an answer from my app that resembles any sane form. so im using the high performance tick counter. i get the Frequency of the tick counter and store it in m_timerFrequency. now let me get this straight - the frequency of the tick counter represents how many ticks occur in 1 second ? i query the counter at the beginning of each rendering loop saving the value in a variable m_startTick. at the end of the loop i query it again saving the value in a variable m_currentTick; now to get fps i am doing: 1. get the difference between m_currentTick and m_startTick 2. divide the difference by m_timerFrequency 3. invert the answer ( or 1.0/ answer) so it looks like: 1.0f / ( (m_currentTick - m_startTick) / m_timerFrequency) am i forgetting something ? regards, bg3ntl '' That''s a nice little nothing you are almost wearing. ''

Share this post


Link to post
Share on other sites
Infinisearch    2971
freq=1/period
period=1/freq

m_timerFrequency= frequency of tick counter
m_startTick=start of render
m_currentTick=end of render

m_currentTick - m_startTick = period for frame(in ticks)

ticks need to be time so:

m_timerFrequency/(m_currentTick - m_startTick) = time to render frame.

so fps= (m_currentTick - m_startTick)/m_timerFrequency

I think thats right.

Share this post


Link to post
Share on other sites