http://bugs.winehq.com/show_bug.cgi?id=1667
------- Additional Comments From Andrew.Talbot@talbotville.com 2003-09-12 16:09 ------- Mike,
Under Windows 98SE, on my P3/450, I ran your test2.exe program twice, with a nominal twenty seconds between each run. Subtracting the two QPCs and dividing by the timing period gave (472313655 - 448390410) / 20 = 1196162 ticks per second. QPF was reported as 1193180: remarkably close. QPC, of course, represents the number of clock ticks since switch-on. Programs can measure time intervals by dividing differences in QPC by QPF, (i.e. tick-count-difference divided by ticks-per-second = seconds elapsed) so the scalings have to be consistent.
On my 'unscaled' version of Wine (SUSE 9.0), I also made two runs, this time roughly thirty seconds apart, and got (191677227390 - 178935563205) / 30 = 424722139.5 counts per second from the two QPCs, with QPF given as 451054000. Not bad for a crude, manual test.
It seems that versions of Windows <= Win98SE may have used the Programmable Interrupt Timer (8254) chip, with its 1.19 Mhz clock (even on PCs with RDTSC-capable processors). However, I suspect that other versions of Windows (i.e. the more 'corporate' varieties: NT, Win2k, XP) might actually use the RDTSC instruction, if available, thus providing the nanosecond-order resolution of which the CPU clocks of modern computers are capable. So, perhaps the clock that Wine uses for the High-Performance Timer functions (CPU vs. PIT) should depend not only on the availability of the RDTSC instruction, but also on which version of Windows that Wine is set to emulate.
I shall seek to run your program on at least one Win XP Pro machine to see which clock that uses and shall report back here.
-- Andy.