CPU (FreeBSD): actually support temp detection

This commit is contained in:
Carter Li
2023-06-22 04:06:08 +00:00
parent f7059783dc
commit 85597e4d46
5 changed files with 30 additions and 12 deletions
+3 -9
View File
@@ -1,5 +1,6 @@
#include "cpu.h"
#include "common/sysctl.h"
#include "detection/temps/temps_bsd.h"
const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFinstance* instance, const FFCPUOptions* options, FFCPUResult* cpu)
{
@@ -12,17 +13,10 @@ const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFinstance* instance, const FF
cpu->frequencyMin = ffSysctlGetInt("hw.clockrate", 0) / 1000.0;
cpu->frequencyMax = cpu->frequencyMin;
cpu->temperature = FF_CPU_TEMP_UNSET;
if (options->temp)
{
FF_STRBUF_AUTO_DESTROY cpuTemp = ffStrbufCreate();
if(ffSysctlGetString("hw.acpi.thermal.tz0.temperature", &cpuTemp))
cpu->temperature = FF_CPU_TEMP_UNSET;
else
cpu->temperature = ffStrbufToDouble(&cpuTemp);
}
else
cpu->temperature = FF_CPU_TEMP_UNSET;
ffDetectThermalTemp(&cpu->temperature);
return NULL;
}