wijn at wanadoo.nl
Mon Jan 24 04:58:37 CST 2005
On Sun, 23 Jan 2005 14:29:02 +0100, you wrote:
> > --- wine/dlls/kernel/cpu.c 2004-12-29 12:09:47.000000000 +0100
> > +++ mywine/dlls/kernel/cpu.c 2005-01-19 12:39:15.000000000 +0100
> > @@ -188,7 +188,8 @@ BOOL WINAPI QueryPerformanceCounter(PLAR
> > /* i586 optimized version */
> > __asm__ __volatile__ ( "rdtsc"
> > : "=a" (counter->u.LowPart), "=d" (counter->u.HighPart) );
> > - counter->QuadPart = counter->QuadPart / 1000; /* see below */
> > + /* see below */
> > + counter->QuadPart = counter->QuadPart / ( cpuHz / 1193182 ) ;
> > return TRUE;
> > }
> > #endif
> Don't we loose some precision here or are we sure that all PC clocks are
> exact multiples of '1193182' ?
FYI, I traced this in windows (2K, XP), that gets the counter through
some inp's and outp's to 0x40/0x43. That is historically an 8253
programmable interval time, aka timer0. The function is in the hal.dll,
so it is possible that on some hardware this might be different.
> Moreover, anyone has any idea how to do this without using RDTSC (which is a
> bad idea on most laptops and may well be on modern CPUs too if any implement
> the laptop-like power saving features) ?
No idea what timer quality the typical application using this function
requires. Probably less then rdtsc, or it would have used it directly.
How bad is it to use the gettimeofday() method?
More information about the wine-devel