2022-09-19 22:23:31 +02:00
|
|
|
#include "cpu.h"
|
2022-09-19 23:16:43 +02:00
|
|
|
#include "common/sysctl.h"
|
2022-09-19 22:23:31 +02:00
|
|
|
|
2022-09-24 15:59:36 +02:00
|
|
|
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
2022-09-19 22:23:31 +02:00
|
|
|
{
|
2022-09-24 15:59:36 +02:00
|
|
|
FF_UNUSED(instance);
|
|
|
|
|
|
2022-09-21 17:26:10 +02:00
|
|
|
cpu->temperature = FF_CPU_TEMP_UNSET;
|
2022-09-24 15:59:36 +02:00
|
|
|
|
2022-09-21 17:26:10 +02:00
|
|
|
if(cached)
|
|
|
|
|
return;
|
2022-09-19 23:16:43 +02:00
|
|
|
|
|
|
|
|
ffSysctlGetString("hw.model", &cpu->name);
|
|
|
|
|
|
|
|
|
|
cpu->coresPhysical = (uint16_t) ffSysctlGetInt("hw.ncpu", 1);
|
|
|
|
|
cpu->coresLogical = cpu->coresPhysical;
|
|
|
|
|
cpu->coresOnline = cpu->coresPhysical;
|
|
|
|
|
|
|
|
|
|
cpu->frequencyMin = ffSysctlGetInt("hw.clockrate", 0) / 1000.0;
|
|
|
|
|
cpu->frequencyMax = cpu->frequencyMin;
|
2022-09-19 22:23:31 +02:00
|
|
|
}
|