PerformanceCounterFrequency fix.

Lionel Ulmer lionel.ulmer at free.fr
Sun Jan 23 07:29:02 CST 2005


> --- 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' ?

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) ?

         Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/



More information about the wine-devel mailing list