-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 11 reduce the performance when run without vs debugger #10326
Comments
I would say this issue is not really related to WPF, but generally to Windows development. Pretty much every timer is affected by this: Task.Delay, Thread.Sleep, ManualResetEvent.Wait, etc. The resolution of timers is limited to reduce energy consumption. You can manually enable high precision timers with (undocumented) [DllImport("ntdll.dll")]
private static extern int NtSetTimerResolution(int DesiredResolution, bool SetResolution, out int CurrentResolution);
NtSetTimerResolution(10000, true, out _); There also seems to be the option in Windows 10 and above to explicitly create a high precision timer if needed using |
It is actually because of backcompat, it's been 15.625 ms since first the Windows NT where it wasn't reasonable to have a better resolution, previously on 16bit Windows it used to be 55 ms; strictly due to interrupts needed back in the dark days. These days (on NT) it is exposed via KUSER_SHARED_DATA which is where GetTickCount and friends get it. Visual Studio does indeed call
You should also note that this is a system-wide setting. You may use Signature for completion (they should be public static extern NTSTATUS NtQueryTimerResolution(out uint MinimumResolution, out uint MaximumResolution, out uint CurrentResolution); Do note that |
I created a WPF Application (.net 8) with a TextBlock to show the FPS of the application.
I used two tasks to calculate the FPS and update the TextBlock.
The problem is that when run the application on windows 11, something strange happens.
Expand on the problem:
Not only WPF application but also other types of appliation.
I can't understand why the FPS is different on Windows 11 when run with or without the vs debugger. some one can help me?
The text was updated successfully, but these errors were encountered: