diff --git a/Include/Aurora/Runtime.hpp b/Include/Aurora/Runtime.hpp index 72d8677f..8eadc170 100644 --- a/Include/Aurora/Runtime.hpp +++ b/Include/Aurora/Runtime.hpp @@ -349,30 +349,31 @@ namespace Aurora // This is comparable to Win32's SetCriticalSectionSpinCount applied across every single AuThreadPrimitives try-lock and lock. // Adjust this value to compensate for longer critical sections when context switching isn't preferrable. AuUInt8 uSpinLoopLinearBit { 4 }; - AuUInt64 bEnableAggressiveScheduling : 1 { false }; - AuUInt64 bEnableAgrSchedulingRatelimit : 1 { true }; - AuUInt64 bPreferNt51XpMutexesOver8 : 1 { false }; - AuUInt64 bPreferNt51XpCondvarsOver8 : 1 { false }; - AuUInt64 bPreferNtCondvarModernWinSpin : 1 { false }; - AuUInt64 bPreferNtCondvarOlderWinSpin : 1 { true }; - AuUInt64 bPreferNtSemaphoreSpinTryLock : 1 { true }; - AuUInt64 bPreferNtMutexSpinTryLock : 1 { true }; - AuUInt64 bPreferNtCondMutexSpinTryLock : 1 { true }; - AuUInt64 bPreferLinuxSemaphoreSpinTryLock : 1 { true }; - AuUInt64 bPreferLinuxMutexSpinTryLock : 1 { true }; - AuUInt64 bPreferLinuxCondMutexSpinTryLock : 1 { true }; - AuUInt64 bPreferEmulatedWakeOnAddress : 1 { false }; - AuUInt64 bPreferWaitOnAddressAlwaysSpin : 1 { true }; // ..., if emulated! if double-spinning under higher level locks, disable me. - AuUInt64 bPreferRWLockReadLockSpin : 1 { true }; - AuUInt64 bUWPNanosecondEmulationCheckFirst: 1 { false }; - AuUInt64 uUWPNanosecondEmulationMaxYields : 7 { 12 }; - AuUInt64 bForceEnableAdaptiveSpin : 1 { false }; - AuUInt64 bPreferLinuxAdaptiveSpin : 1 { true }; - AuUInt64 uAdaptiveSpinCUCnt0 : 4 { 0 }; - AuUInt64 uAdaptiveSpinCUCnt4 : 4 { 2 }; - AuUInt64 uAdaptiveSpinCUCnt8 : 4 { 3 }; - AuUInt64 uAdaptiveSpinCUCnt16 : 4 { 4 }; - AuUInt64 bPreferFutexRWLock : 1 { true }; + AuUInt64 bEnableAggressiveScheduling : 1 { false }; + AuUInt64 bEnableAgrSchedulingRatelimit : 1 { true }; + AuUInt64 bPreferNt51XpMutexesOver8 : 1 { false }; + AuUInt64 bPreferNt51XpCondvarsOver8 : 1 { false }; + AuUInt64 bPreferNtCondvarModernWinSpin : 1 { false }; + AuUInt64 bPreferNtCondvarOlderWinSpin : 1 { true }; + AuUInt64 bPreferNtSemaphoreSpinTryLock : 1 { true }; + AuUInt64 bPreferNtMutexSpinTryLock : 1 { true }; + AuUInt64 bPreferNtCondMutexSpinTryLock : 1 { true }; + AuUInt64 bPreferLinuxSemaphoreSpinTryLock : 1 { true }; + AuUInt64 bPreferLinuxMutexSpinTryLock : 1 { true }; + AuUInt64 bPreferLinuxCondMutexSpinTryLock : 1 { true }; + AuUInt64 bPreferEmulatedWakeOnAddress : 1 { false }; + AuUInt64 bPreferWaitOnAddressAlwaysSpin : 1 { true }; // ..., if emulated! if double-spinning under higher level locks, disable me. + AuUInt64 bPreferRWLockReadLockSpin : 1 { true }; + AuUInt64 bUWPNanosecondEmulationCheckFirst : 1 { false }; + AuUInt64 uUWPNanosecondEmulationMaxYields : 7 { 12 }; + AuUInt64 bForceEnableAdaptiveSpin : 1 { false }; + AuUInt64 bPreferLinuxAdaptiveSpin : 1 { true }; + AuUInt64 uAdaptiveSpinCUCnt0 : 4 { 0 }; + AuUInt64 uAdaptiveSpinCUCnt4 : 4 { 2 }; + AuUInt64 uAdaptiveSpinCUCnt8 : 4 { 3 }; + AuUInt64 uAdaptiveSpinCUCnt16 : 4 { 4 }; + AuUInt64 bPreferFutexRWLock : 1 { true }; + AuUInt64 bWinXpThrough7BlazeOptimizerPower : 7 { 12 }; // dont worry about it. we dont care about old portables. lets try to make older win32 targets tweak the scheduling in our favor a bit. }; struct DummyConfig diff --git a/Source/AuProcAddresses.NT.cpp b/Source/AuProcAddresses.NT.cpp index a9432df0..04feaa18 100644 --- a/Source/AuProcAddresses.NT.cpp +++ b/Source/AuProcAddresses.NT.cpp @@ -216,7 +216,7 @@ namespace Aurora if (gRuntimeConfig.threadingConfig.bEnableAgrSchedulingRatelimit) { - if (!((uCounter++) & 128)) + if (!((uCounter++) & (1ull << (gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower + 5ull)))) { return; }