[Bug 47261] Sysinternals ClockRes returns wrong values ( NtQueryTimerResolution/NtSetTimerResolution)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Sep 8 18:49:30 CDT 2019


https://bugs.winehq.org/show_bug.cgi?id=47261

John Alway <jwalway at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwalway at hotmail.com

--- Comment #3 from John Alway <jwalway at hotmail.com> ---
As noted above, NtQueryTimerResolution() is only implemented as a stub in Wine
code.  The same is true of it's complementary function NtSetTimerResolution(). 
These are undocumented Microsoft functions.

I ran the applications ClockRes.exe and ClockRes64.exe on Linux, Ubuntu 16.04,
and they failed to output legitimate values.  Wine version 4.12.1.   I also ran
them on my Windows 7 (and Windows 10) desktops, and they both output the same
max and min, and only slightly different current values:

Windows 10 machine: 
Maximum interval interval: 15.625 ms
Minimum timer interval: 0.5 ms
Current timer interval: 0.977 ms

Windows 7 machine:
Maximum interval interval: 15.625 ms
Minimum timer interval: 0.5 ms
Current timer interval: 1.0 ms

This is the range of resolutions for interruptible timers.  Clocks can run at
much higher rates.   The Windows function NtQueryPerformanceCounter() runs at
around 3.1 megahertz on my Windows 7 machine.  Interruptible timers are much
slower. They cause the CPU to consume more power when they are set faster.

I did the following on my Windows 7 Desktop in Visual Studio 2015:
In my research into NtQueryTimerResolution() and NtSetTimerResolution(), I
found some examples of them being used in Windows applications, but only by
people trying to figure out what they do, and never in conjunction with a
useful application or a timer.  No where could I find a timer that could run at
0.5 ms on Windows.  I was able to use both functions in Windows. I used
CreateWaitableTimer() and SetWaitableTimer() to create Windows timers, but they
weren't high res. I couldn't make them go very fast.  Apparently, the commonly
used function for finding timer resolution ranges is timeGetDevCaps() found in
the winmm.dll.  It only offers a maximum resolution of 1.0 ms for Multimedia
timers. 

It's interesting that NtQueryTimerResolution() gives a 0.5 ms max res and
timeGetDevCaps() a 1.0 ms max res on the same Windows machine.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list