fix: CPU frequency detection of FreeBSD (#12440)
Ilya Mashchenko committed
Mar 18, 2022 at 15:17 UTC
c1532d5e7325a599b12d4406c4012262cd22befc
1 file changed
+4
daemon/system-info.sh
+4
@@ -218,6 +218,10 @@ else
218
elif [ "${KERNEL_NAME}" = FreeBSD ]; then
219
CPU_INFO_SOURCE="sysctl"
220
LCPU_COUNT="$(sysctl -n kern.smp.cpus)"
221
+ if ! possible_cpu_freq=$(sysctl -n machdep.tsc_freq 2> /dev/null); then
222
+ possible_cpu_freq=$(sysctl -n hw.model 2> /dev/null | grep -Eo "[0-9\.]+GHz" | grep -o "^[0-9\.]*" | awk '{print int($0*1000)}')
223
+ [ -n "$possible_cpu_freq" ] && possible_cpu_freq="${possible_cpu_freq} MHz"
224
+ fi
225
elif [ "${KERNEL_NAME}" = Darwin ]; then
226
CPU_INFO_SOURCE="sysctl"
227
LCPU_COUNT="$(sysctl -n hw.logicalcpu)"