mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 14:10:11 +01:00
CPU: use module options
This commit is contained in:
+12
-11
@@ -1,11 +1,19 @@
|
||||
#include "cpu.h"
|
||||
#include "common/sysctl.h"
|
||||
|
||||
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu)
|
||||
const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFinstance* instance, const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
if (ffSysctlGetString("hw.model", &cpu->name))
|
||||
return "sysctlbyname(hw.model) failed";
|
||||
|
||||
if (instance->config.cpu.temp)
|
||||
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;
|
||||
|
||||
if (options->temp)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY cpuTemp = ffStrbufCreate();
|
||||
if(ffSysctlGetString("temperature", &cpuTemp))
|
||||
@@ -16,12 +24,5 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu)
|
||||
else
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
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;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user