Browse Source

fix: CPU frequency detection of FreeBSD (#12440)

Ilya Mashchenko 3 years ago
parent
commit
c1532d5e73
1 changed files with 4 additions and 0 deletions
  1. 4 0
      daemon/system-info.sh

+ 4 - 0
daemon/system-info.sh

@@ -218,6 +218,10 @@ else
   elif [ "${KERNEL_NAME}" = FreeBSD ]; then
     CPU_INFO_SOURCE="sysctl"
     LCPU_COUNT="$(sysctl -n kern.smp.cpus)"
+    if ! possible_cpu_freq=$(sysctl -n machdep.tsc_freq 2> /dev/null); then
+      possible_cpu_freq=$(sysctl -n hw.model 2> /dev/null | grep -Eo "[0-9\.]+GHz" | grep -o "^[0-9\.]*" | awk '{print int($0*1000)}')
+      [ -n "$possible_cpu_freq" ] && possible_cpu_freq="${possible_cpu_freq} MHz"
+    fi
   elif [ "${KERNEL_NAME}" = Darwin ]; then
     CPU_INFO_SOURCE="sysctl"
     LCPU_COUNT="$(sysctl -n hw.logicalcpu)"