Get rid of ancient workaround

...that probably negatively impacted performance or something else
This commit is contained in:
sfan5 2022-01-22 21:00:54 +01:00
parent 53db262bd2
commit 7d1dc8b2d5

@ -94,16 +94,9 @@ namespace os
static LARGE_INTEGER HighPerformanceFreq; static LARGE_INTEGER HighPerformanceFreq;
static BOOL HighPerformanceTimerSupport = FALSE; static BOOL HighPerformanceTimerSupport = FALSE;
static BOOL MultiCore = FALSE;
void Timer::initTimer(bool usePerformanceTimer) void Timer::initTimer(bool usePerformanceTimer)
{ {
#if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
// workaround for hires timer on multiple core systems, bios bugs result in bad hires timers.
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
MultiCore = (sysinfo.dwNumberOfProcessors > 1);
#endif
if (usePerformanceTimer) if (usePerformanceTimer)
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq); HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
else else
@ -115,24 +108,11 @@ namespace os
{ {
if (HighPerformanceTimerSupport) if (HighPerformanceTimerSupport)
{ {
#if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
// Avoid potential timing inaccuracies across multiple cores by
// temporarily setting the affinity of this process to one core.
DWORD_PTR affinityMask=0;
if(MultiCore)
affinityMask = SetThreadAffinityMask(GetCurrentThread(), 1);
#endif
LARGE_INTEGER nTime; LARGE_INTEGER nTime;
BOOL queriedOK = QueryPerformanceCounter(&nTime); BOOL queriedOK = QueryPerformanceCounter(&nTime);
#if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
// Restore the true affinity.
if(MultiCore)
(void)SetThreadAffinityMask(GetCurrentThread(), affinityMask);
#endif
if(queriedOK) if(queriedOK)
return u32((nTime.QuadPart) * 1000 / HighPerformanceFreq.QuadPart); return u32((nTime.QuadPart) * 1000 / HighPerformanceFreq.QuadPart);
} }
return GetTickCount(); return GetTickCount();