[SDL] framerate counter
slouken at devolution.com
Thu Apr 5 10:12:02 PDT 2001
> On Thursday 05 April 2001 15:27, Timo K Suoranta wrote:
> > timing information. Which is provided by performance counter (is it
> > available in linux in any form?).
> Sure (on x86 at least); it's a CPU core feature of the x86. It's a 64 bit
> counter that counts core clock cycles.
I actually used this in Tribes 2. In order for this to work properly you
need to precisely calculate the core clock cycle frequency. I worked out
a solution that gives very high accuracy, but it isn't perfect. (Essentially
the same method used by the Linux kernel on startup) This also has problems
on SMP machines, since the cycle counter can drift between CPU's, and you'll
I have the code to add to SDL_GetTicks(), and I'll add it experimentally in
-Sam Lantinga, Lead Programmer, Loki Entertainment Software
More information about the SDL