Skip to content

Commit 3def466

Browse files
committed
Revert "CPU (FreeBSD): remove using of freq_levels"
This reverts commit ed2dd8f.
1 parent 59868c6 commit 3def466

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/detection/cpu/cpu_bsd.c

+18
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
105105

106106
uint32_t clockrate = (uint32_t) ffSysctlGetInt("hw.clockrate", 0);
107107
if (clockrate > cpu->frequencyBase) cpu->frequencyBase = clockrate;
108+
109+
for (uint16_t i = 0; i < cpu->coresLogical; ++i)
110+
{
111+
ffStrbufClear(&buffer);
112+
char key[32];
113+
snprintf(key, sizeof(key), "dev.cpu.%u.freq_levels", i);
114+
if (ffSysctlGetString(key, &buffer) == NULL)
115+
{
116+
if (buffer.length == 0) continue;
117+
118+
// MHz/Watts pairs like: 2501/32000 2187/27125 2000/24000
119+
uint32_t fmax = (uint32_t) strtoul(buffer.chars, NULL, 10);
120+
if (cpu->frequencyMax < fmax) cpu->frequencyMax = fmax;
121+
}
122+
else
123+
break;
124+
}
125+
108126
cpu->temperature = FF_CPU_TEMP_UNSET;
109127

110128
if (options->temp)

0 commit comments

Comments
 (0)