[*] Lower idle CPU usage (idle utilization regression)
This commit is contained in:
parent
03dbfeefe1
commit
9a27f3d44b
@ -351,6 +351,7 @@ namespace Aurora
|
||||
AuUInt8 uSpinLoopPowerA { 7 }; // Nudgable spinloop power. This is our local userland niceness factor; where 1 << n is the amount of yield instructions to stall for
|
||||
|
||||
bool bEnableAggressiveScheduling { false };
|
||||
bool bEnableAgrSchedulingRatelimit { true };
|
||||
bool bPreferNt51XpMutexesOver8 { false }; // Fun Fact: Undocumented Windows XP APIs are still better than whatever the fuck shit fest they sharted out under Windows Vista and maybe 8.1
|
||||
bool bPerferNt51XpCondvarsOver8 { false }; // Wth the former set of apis, we are still nothing more than a futex intended for nothing more than x86 bittestandset with undefined
|
||||
}; // bahviour on the higher bits, and we're crippled by some annoying thread switch function. Windows Vista superseded the dumb kernel-io
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
namespace Aurora
|
||||
{
|
||||
static bool gShouldResPathDoNothing {};
|
||||
|
||||
void InitNTAddresses()
|
||||
{
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
@ -121,23 +123,39 @@ namespace Aurora
|
||||
!pNtWaitForKeyedEvent;
|
||||
|
||||
gUseNativeWaitCondvar = (pWaitOnAddress &&
|
||||
!gRuntimeConfig.threadingConfig.bPerferNt51XpCondvarsOver8 &&
|
||||
(pRtlWaitOnAddress || AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32)) ||
|
||||
!pNtWaitForKeyedEvent;
|
||||
!gRuntimeConfig.threadingConfig.bPerferNt51XpCondvarsOver8 &&
|
||||
(pRtlWaitOnAddress || AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32)) ||
|
||||
!pNtWaitForKeyedEvent;
|
||||
|
||||
gUseNativeWaitSemapahore = bool(pWaitOnAddress);
|
||||
}
|
||||
|
||||
void Win32DropInit()
|
||||
{
|
||||
gShouldResPathDoNothing =
|
||||
(AuBuild::kCurrentPlatform != AuBuild::EPlatform::ePlatformWin32) ||
|
||||
(!gRuntimeConfig.threadingConfig.bEnableAggressiveScheduling &&
|
||||
AuSwInfo::IsWindows10OrGreater());
|
||||
}
|
||||
|
||||
void Win32DropSchedulerResolution()
|
||||
{
|
||||
static AuUInt uCounter {};
|
||||
ULONG ullActualResolution {};
|
||||
|
||||
if (!gRuntimeConfig.threadingConfig.bEnableAggressiveScheduling &&
|
||||
AuSwInfo::IsWindows10OrGreater())
|
||||
if (gShouldResPathDoNothing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (gRuntimeConfig.threadingConfig.bEnableAgrSchedulingRatelimit)
|
||||
{
|
||||
if (!((uCounter++) & 128))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pZwSetTimerResolution)
|
||||
{
|
||||
auto uRet = pZwSetTimerResolution(1, true, &ullActualResolution);
|
||||
|
@ -200,5 +200,6 @@ namespace Aurora
|
||||
inline bool gUseNativeWaitCondvar {};
|
||||
inline bool gUseNativeWaitSemapahore {};
|
||||
|
||||
void Win32DropInit();
|
||||
void Win32DropSchedulerResolution();
|
||||
}
|
@ -58,9 +58,8 @@ static void Init()
|
||||
|
||||
gRuntimeRunLevel = 1;
|
||||
tlsHackIsMainThread = true;
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
Aurora::Win32DropSchedulerResolution();
|
||||
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
Aurora::Extensions::Win32::InitDarkMode();
|
||||
#endif
|
||||
|
||||
@ -73,6 +72,12 @@ static void Init()
|
||||
Aurora::Threading::InitSleep();
|
||||
Aurora::Process::InitProcess();
|
||||
Aurora::SWInfo::InitSwInfo();
|
||||
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
Aurora::Win32DropInit();
|
||||
Aurora::Win32DropSchedulerResolution();
|
||||
#endif
|
||||
|
||||
Aurora::Threading::Threads::InitThreading();
|
||||
Aurora::Exit::InitExit();
|
||||
Aurora::IO::Net::InitNetworking();
|
||||
|
Loading…
Reference in New Issue
Block a user