mirror of https://github.com/PCSX2/pcsx2.git
Workaround a problem with thread affinities.
Should fix some slowness issues, mainly on AMD cpus. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1614 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
c0a0cd6bed
commit
62cc3cfbf3
|
@ -216,6 +216,19 @@ static void SetSingleAffinity()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UnSetSingleAffinity()
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS_
|
||||||
|
HANDLE s_threadId = GetCurrentThread();
|
||||||
|
s_oldmask = SetThreadAffinityMask( s_threadId, 0xFFFFFFFF );
|
||||||
|
|
||||||
|
if( s_oldmask == ERROR_INVALID_PARAMETER )
|
||||||
|
{
|
||||||
|
Console::Notice("CpuDetect: UnSetThreadAffinityMask failed...");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
s64 CPUSpeedHz( u64 time )
|
s64 CPUSpeedHz( u64 time )
|
||||||
|
@ -489,5 +502,9 @@ void cpudetectInit()
|
||||||
|
|
||||||
// This will assign values into cpuinfo.LogicalCores and PhysicalCores
|
// This will assign values into cpuinfo.LogicalCores and PhysicalCores
|
||||||
Threading::CountLogicalCores( LogicalCoresPerPhysicalCPU, PhysicalCoresPerPhysicalCPU );
|
Threading::CountLogicalCores( LogicalCoresPerPhysicalCPU, PhysicalCoresPerPhysicalCPU );
|
||||||
|
|
||||||
|
// Undo previous SetSingleAffinity() here, so the host OS can handle load distribution
|
||||||
|
// (up to 25% faster on athlonx2, about 5% faster on core2)
|
||||||
|
UnSetSingleAffinity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue