https://bugs.winehq.org/show_bug.cgi?id=47261
Bug ID: 47261 Summary: Sysinternals ClockRes returns wrong values Product: Wine Version: 4.9 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: kolan_n@mail.ru Distribution: ---
Shows resolution, but the wrong one. In process Wine complains about stubs.
32-bit version shows numbers looking plausible (~300 ms), but they seem to be wrong, since native Linux functions return 1ms .
64-bit version shows enormous numbers.
https://bugs.winehq.org/show_bug.cgi?id=47261
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Component|kernel32 |ntdll CC| |damjan.jov@gmail.com Status|UNCONFIRMED |NEW
--- Comment #1 from Damjan Jovanovic damjan.jov@gmail.com --- Confirming in 4.12.1.
NtQueryTimerResolution/NtSetTimerResolution are unimplemented stubs.
Documentation: http://mirrors.arcadecontrols.com/www.sysinternals.com/Information/HighResol...
Windows's implementation allegedly maintains a stackable list of resolution requests per process, and maintains the system-wide timer precision at the finest requested granularity (which would involve wineserver, if we do the same) .
https://bugs.winehq.org/show_bug.cgi?id=47261
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Sysinternals ClockRes |Sysinternals ClockRes |returns wrong values |returns wrong values | |(NtQueryTimerResolution/NtS | |etTimerResolution)
https://bugs.winehq.org/show_bug.cgi?id=47261
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download CC| |focht@gmx.net URL| |https://web.archive.org/web | |/20190220013707/https://dow | |nload.sysinternals.com/file | |s/ClockRes.zip
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
--- snip --- $ wine ./Clockres.exe
Clockres v2.1 - Clock resolution display utility Copyright (C) 2016 Mark Russinovich Sysinternals
0009:fixme:sync:NtQueryTimerResolution (0x34fee4,0x34fee0,0x34fedc), stub! Maximum timer interval: 420.694 ms Minimum timer interval: 347.314 ms Current timer interval: 0.000 ms --- snip ---
--- snip --- $ wine ./Clockres64.exe
Clockres v2.1 - Clock resolution display utility Copyright (C) 2016 Mark Russinovich Sysinternals
002c:fixme:sync:NtQueryTimerResolution (0x24fd90,0x24fd98,0x24fd60), stub! Maximum timer interval: 207238.451 ms Minimum timer interval: 207238.451 ms Current timer interval: 207238.451 ms --- snip ---
$ sha1sum ClockRes.zip a955582911793123bb08af49e19215d748019b1e ClockRes.zip
$ du -sh ClockRes.zip 144K ClockRes.zip
$ wine --version wine-4.12.1
Regards
https://bugs.winehq.org/show_bug.cgi?id=47261
John Alway jwalway@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jwalway@hotmail.com
--- Comment #3 from John Alway jwalway@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.
https://bugs.winehq.org/show_bug.cgi?id=47261
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|wine-bugs@winehq.org |fgouget@codeweavers.com CC| |fgouget@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=47261
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |d84e84c12650ce7c6d22ba3105f | |57b0115030e55
--- Comment #4 from François Gouget fgouget@codeweavers.com --- I think this is fixed:
$ ./wine Clockres.exe INTEL-MESA: warning: Haswell Vulkan support is incomplete
Clockres v2.1 - Clock resolution display utility Copyright (C) 2016 Mark Russinovich Sysinternals
Maximum timer interval: 15.625 ms Minimum timer interval: 1.000 ms Current timer interval: 1.000 ms
The minimum timer interval is 1 ms instead of 0.5 ms on Windows but since these values depend on the hardware support I think that's okay. Also the current timer is 1 ms instead of Windows' usual 15.625 ms but that can also happen on Windows if another process requests a 1 ms timer resolution (in Wine let's say that other application is Wine itself). So all in all I'd say this matches Windows' behavior.
https://bugs.winehq.org/show_bug.cgi?id=47261
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.15.