File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments