This commit is contained in:
Reece Wilson 2023-08-27 17:52:20 +01:00
parent 4674f45dd3
commit b8458990c9
2 changed files with 17 additions and 7 deletions

View File

@ -346,10 +346,10 @@ namespace Aurora
bool bNoThreadNames { false };
bool bPlatformIsSMPProcessorOptimized { true }; // Whether to attempt to using mm_pause or similar before yielding into the kernel
AuUInt8 uSpinLoopPowerA { 5 }; // Nudgable spinloop power. This is our local userland niceness factor; where 1 << n is the amount of smt-yield instructions to stall for
AuUInt8 uSpinLoopPowerA { 3 }; // Nudgable spinloop power. This is our local userland niceness factor; where 1 << n is the amount of smt-yield instructions to stall for
// 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 };
AuUInt8 uSpinLoopLinearBit { 6 };
AuUInt64 bEnableAggressiveScheduling : 1 { false };
AuUInt64 bEnableAgrSchedulingRatelimit : 1 { true };
AuUInt64 bPreferNt51XpMutexesOver8 : 1 { false };
@ -374,9 +374,9 @@ namespace Aurora
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.
AuUInt64 bPreferLinuxPrimitivesFutexNoSpin : 1 { false };
AuUInt64 bPreferUnixPrimitivesNoSpin : 1 { false };
AuUInt64 bWinXpThrough7BlazeOptimizerPower : 7 { 6 }; // 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.
AuUInt64 bPreferLinuxPrimitivesFutexNoSpin : 1 { false };
AuUInt64 bPreferUnixPrimitivesNoSpin : 1 { false };
};
struct DummyConfig

View File

@ -234,10 +234,20 @@ namespace Aurora
if (gRuntimeConfig.threadingConfig.bEnableAgrSchedulingRatelimit)
{
if (!((uCounter++) & (1ull << (gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower + 5ull))))
AuUInt uCount {};
if (!(((uCount = uCounter++)) & (1ull << (gRuntimeConfig.threadingConfig.bWinXpThrough7BlazeOptimizerPower + 5ull))))
{
return;
if (uCount != 0)
{
return;
}
}
else
{
uCounter = 0;
}
}
if (pZwSetTimerResolution)