30 March 2015, 18:30 | #1 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
WinUAE and Windows timer resolution
I read a blog post titled Windows Timer Resolution: Megawatts Wasted. The gist of it is that many programs increase the timer resolution used by Windows, thus increasing the frequency of timer interrupts. Which uses more power since the CPU can't enter the lowest-power states, and has a small but measurable performance impact on other programs. In some cases that's needed (for example a media player when playing), but in others it isn't (e.g. media player when paused).
I thought I'd see what WinUAE does to the timer interval on Windows Vista SP2. Before running WinUAE, clockres reported: Maximum timer interval: 15.600 ms Minimum timer interval: 0.500 ms Current timer interval: 15.600 ms After running WinUAE (settings window open, before starting emulation): Maximum timer interval: 15.600 ms Minimum timer interval: 0.500 ms Current timer interval: 1.000 ms The reported current timer interval stays at 1.000 ms regardless of whether emulation is running or paused. After exiting WinUAE the current interval returns to 15.600 ms. So, I'm just wondering: would it be feasible to have WinUAE only reduce the timer interval when emulation is actually running, not when paused or the settings window is opened? |
31 March 2015, 17:29 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
I thought it already did it. Not the first time it happened
Now done, only active when emulation is running. |
31 March 2015, 19:13 | #3 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
Thanks. Testing today's winuae.exe (16:27 time) the current timer interval stays at 15.6ms after launching WinUAE. However once I start emulation, the timer interval stays at 1ms even when paused or with settings window open.
|
01 April 2015, 16:29 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
What about now? (But pause should have already worked)
|
01 April 2015, 20:29 | #5 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
No change with today's winuae.exe (date 2015-04-01 15:25).
I wonder if there's something about my system or Vista that causes timer resolution to be increased, for example when you initialise/open DirectX perhaps some Windows component increases the resolution? |
01 April 2015, 20:38 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
I am not sure if the program works in Vista or later (at least in 8 and later when timer stuff changed). For example Windows 10 TP always shows 1.0ms.
I only made sure timeBeginPeriod() and timeEndPeriod() are called when needed. |
02 April 2015, 14:07 | #7 | |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
I might have figured out the cause of the problem.
When emulation is paused, do you always undo the effect of any previous DwmEnableMMCSS(), AvSetMmThreadPriority() and AvSetMmThreadCharacteristics() calls? From the MSDN Multimedia Class Scheduler Service page: Quote:
On a related note, how about adding an option to not call DwmEnableMMCSS(), AvSetMmThreadPriority() or AvSetMmThreadCharacteristics()? If the user is using some Workbench app (not a game or demo) and not playing sound, they may prefer power saving over smooth-as-possible graphics updates. Last edited by mark_k; 02 April 2015 at 14:24. |
|
02 April 2015, 18:47 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
None of those are used. I tried them in Vista era or so but there was some issues and there was also no gain vs time*period calls.
It is very bad idea to have longer waits unless mode is fastest possible without sound (which is useless from power saving point of view..). In all other modes emulation will always attempt to sleep 1ms-10ms when possible to reduce CPU use. If sleep takes longer (~2-3ms longer), you will get extreme bad performance. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Some findings on Windows timer functions accuracy, that may benefit WinUAE | Dr.Venom | support.WinUAE | 4 | 14 November 2013 10:35 |
[WinUAE/A500] CIA A - Timer A INT2 problem | leoha | Coders. Asm / Hardware | 2 | 22 October 2012 10:18 |
WinUAE resolution switching | Konrad | request.UAE Wishlist | 10 | 06 January 2008 18:04 |
WinUAE widescreen resolution problem | UncleJimbo | support.WinUAE | 6 | 13 March 2005 17:37 |
WinUAE - Cannot change display resolution... | Jorlin | support.WinUAE | 0 | 14 June 2003 14:41 |
|
|