diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2022-07-18 00:20:26 -0700 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2022-08-02 22:24:06 -0700 |
| commit | b473c3587388e06823c153c4fecc2104bcafedff (patch) | |
| tree | c2535ae7e17de810873049825255b85e2602cf21 /Source/Core/Common/Timer.cpp | |
| parent | 3384b1385edba826f56dec3c92c01426e1fcd48d (diff) | |
windows: mark as HighQoS, ensure timer resolution is honored
Diffstat (limited to 'Source/Core/Common/Timer.cpp')
| -rw-r--r-- | Source/Core/Common/Timer.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp index ef910f6c27..3d2a2ed777 100644 --- a/Source/Core/Common/Timer.cpp +++ b/Source/Core/Common/Timer.cpp @@ -102,6 +102,22 @@ u64 Timer::GetLocalTimeSinceJan1970() void Timer::IncreaseResolution() { #ifdef _WIN32 + // Disable execution speed and timer resolution throttling process-wide. + // This mainly will keep Dolphin marked as high performance if it's in the background. The OS + // should make it high performance if it's in the foreground anyway (or for some specific + // threads e.g. audio). + // This is best-effort (i.e. the call may fail on older versions of Windows, where such throttling + // doesn't exist, anyway), and we don't bother reverting once set. + // This adjusts behavior on CPUs with "performance" and "efficiency" cores + PROCESS_POWER_THROTTLING_STATE PowerThrottling{}; + PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION; + PowerThrottling.ControlMask = + PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION; + PowerThrottling.StateMask = 0; + SetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, &PowerThrottling, + sizeof(PowerThrottling)); + + // Not actually sure how useful this is these days.. :') timeBeginPeriod(1); #endif } |
