Re: [GD-Windows] More timer fun!
Brought to you by:
vexxed72
From: Pierre T. <p.t...@wa...> - 2002-08-30 14:55:10
|
Somebody should write a definitive Gem about this (say in GPG 4 ?). Or maybe someone already has and I don't know about it ? Is there a place explaining the issues and, hopefully, giving canonical source code to solve them once and for all ? Pierre ----- Original Message ----- From: Jon Watte <hp...@mi...> To: <bri...@py...>; <gam...@li...> Sent: Friday, August 30, 2002 6:51 AM Subject: RE: [GD-Windows] More timer fun! > > timGetTime() / GetTickCount() only return 32 bit values, AFAIK. > > There are some problems with keeping time on PC hardware. timeGetTime() > will lag behind wallclock time when there is lots of bus traffic (== > graphics-heavy application running). QueryPerformanceCounter() will > somtimes jump ahead by 1.3 or 4.1 seconds when there is lots of bus > traffic, in a quantum leap. RDTSC ticks once per cycle, but mobile > CPUs will adjust their CPU frequency quite often, so you can't get a > good bead on that, either. > > Also, QPC and TGT/GTC each take a bus transaction to execute, and thus > run in 1-2 microseconds, which is an eternity if you need to call them > more than once or twice per frame rendered. > > I ended up with an unholy concoction of all three methods, which ends > up getting good overall relation to wallclock time, cheap calls, but > some local mis-match where my clock will lag behind wall-clock "locally" > but get adjusted "globally" when the CPU goes into powersave mode. > > Yuck. > > Cheers, > > / h+ |