mirror of https://github.com/PCSX2/pcsx2.git
Correct fix for thread affinity in CpuDetect, and fixed commenting in clean_msvc.cmd
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1659 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
4ce901c47b
commit
cd5934fb57
|
@ -1,12 +1,12 @@
|
||||||
-- clean_msvc.cmd
|
:: clean_msvc.cmd
|
||||||
--
|
::
|
||||||
-- This batch file cleans up some files that MSVC's Clean/Rebuild commands tend to miss.
|
:: This batch file cleans up some files that MSVC's Clean/Rebuild commands tend to miss.
|
||||||
-- In particular the .ilk and .pdb files are known to get corrupted and cause all sorts of odd
|
:: In particular the .ilk and .pdb files are known to get corrupted and cause all sorts of odd
|
||||||
-- linker errors, and the .ncb files can also get corrupted and cause intellisense breakges.
|
:: linker errors, and the .ncb files can also get corrupted and cause intellisense breakges.
|
||||||
--
|
::
|
||||||
-- Safety: This tool should be pretty safe. None of the files it deletes are important. That
|
:: Safety: This tool should be pretty safe. None of the files it deletes are important. That
|
||||||
-- is, they're all files MSVC just rebuilds automatically next time you run/recompile. But even
|
:: is, they're all files MSVC just rebuilds automatically next time you run/recompile. But even
|
||||||
-- so, don't go running this batch file in your root c:\ folder. It's probably not a wise action.
|
:: so, don't go running this batch file in your root c:\ folder. It's probably not a wise action.
|
||||||
-- Enjoy. :)
|
:: Enjoy. :)
|
||||||
|
|
||||||
del /s *.ncb;*.ilk;*.pdb;*.bsc;*.sbr
|
del /s *.ncb;*.ilk;*.pdb;*.bsc;*.sbr
|
|
@ -200,7 +200,7 @@ static void SetSingleAffinity()
|
||||||
if( availProcCpus & (1<<i) ) break;
|
if( availProcCpus & (1<<i) ) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE s_threadId = GetCurrentThread();
|
s_threadId = GetCurrentThread();
|
||||||
s_oldmask = SetThreadAffinityMask( s_threadId, (1UL<<i) );
|
s_oldmask = SetThreadAffinityMask( s_threadId, (1UL<<i) );
|
||||||
|
|
||||||
if( s_oldmask == ERROR_INVALID_PARAMETER )
|
if( s_oldmask == ERROR_INVALID_PARAMETER )
|
||||||
|
@ -216,19 +216,6 @@ 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 )
|
||||||
|
@ -502,9 +489,5 @@ 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