Mail Archives: djgpp/1997/04/23/15:18:16
Christoph Kukulies wrote:
>
> [ - ]
> >
> > Wow.. I was just experimenting with that last night. I needed
> > to measure the number of milliseconds per frame of my game, so
> > I made a 1KHz timer. It wasn't quite enough, so I tried making a
> > 10KHz timer. (Both of these incremented a global 32 bit value.)
> > The 1KHz timer had no apparent effect on the game, but the 10KHz
> > timer knocked the framerate down from around 72Hz to about 68-69Hz.
>
> Just curious: How did you know it *was* 72Hz? :-)
Ok, I have a system of measuring the frame rate in my game that I
think is pretty foolproof. I have a variable called frame_count that
is incremented at the end of every frame. I then have an ISR which
is called once per second. In this ISR, I copy frame_count into
a variable called fps, then I set frame_count back to 0.
So, the frame_count is always counting up until a second has passed,
then it gets reset and the measured fps variable is updated. I
think this system seems completely accurate.. It is literally
counting the frames that were drawn during each second. :)
The only disadvantage to this is that the known frame rate is only
updated once a second, but that is no longer a problem for me.
Tom Grandgent
tgrand AT canvaslink DOT com
Canvas Link, Inc.
- Raw text -