mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
better cpu count guess
This commit is contained in:
parent
4a0c4a69f0
commit
ed1402cbd3
1 changed files with 14 additions and 9 deletions
|
|
@ -29,22 +29,28 @@
|
||||||
|
|
||||||
#include "platform/platformCPUCount.h"
|
#include "platform/platformCPUCount.h"
|
||||||
#include "console/console.h"
|
#include "console/console.h"
|
||||||
|
#include <math/mMathFn.h>
|
||||||
|
|
||||||
Platform::SystemInfo_struct Platform::SystemInfo;
|
Platform::SystemInfo_struct Platform::SystemInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Processor::init()
|
void Processor::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
S32 lCpuCount = SDL_GetCPUCount();
|
S32 lCpuCount = SDL_GetCPUCount();
|
||||||
Platform::SystemInfo.processor.numLogicalProcessors = lCpuCount;
|
Platform::SystemInfo.processor.numLogicalProcessors = lCpuCount;
|
||||||
//sdl dont have logical/physical CPU count so ... time to guess
|
//sdl dont have logical/physical CPU count so ... time to guess
|
||||||
Platform::SystemInfo.processor.numPhysicalProcessors = 1; // :/ lCpuCount;
|
if (lCpuCount > 1)
|
||||||
Platform::SystemInfo.processor.isMultiCore = lCpuCount > 1;
|
{
|
||||||
//modern CPU should have isHyperThreaded
|
Platform::SystemInfo.processor.numPhysicalProcessors = mFloor(lCpuCount / 2); // guessing ;
|
||||||
Platform::SystemInfo.processor.isHyperThreaded = true;
|
Platform::SystemInfo.processor.isMultiCore = true;
|
||||||
|
//modern CPU should have isHyperThreaded
|
||||||
|
Platform::SystemInfo.processor.isHyperThreaded = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Platform::SystemInfo.processor.numPhysicalProcessors = lCpuCount; // guessing ;
|
||||||
|
Platform::SystemInfo.processor.isMultiCore = false;
|
||||||
|
Platform::SystemInfo.processor.isHyperThreaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
//hackfest
|
//hackfest
|
||||||
Platform::SystemInfo.processor.mhz = 2666;
|
Platform::SystemInfo.processor.mhz = 2666;
|
||||||
|
|
@ -139,5 +145,4 @@ namespace CPUInfo
|
||||||
}
|
}
|
||||||
}; // namespace CPUInfo
|
}; // namespace CPUInfo
|
||||||
|
|
||||||
|
#endif // defined( __FreeBSD__ )
|
||||||
#endif
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue