From 9b1108133caf38bcd8a19d4b96ebaa720caf0500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne?= Date: Fri, 11 Jun 2021 09:37:57 +0200 Subject: [PATCH] OpenBSD: change cpu count (#1650) Instead of using hw.ncpu, use hw.ncpuonline and hw.ncpufound, and check SMT status --- neofetch | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 85473d29..28900c8f 100755 --- a/neofetch +++ b/neofetch @@ -2286,7 +2286,17 @@ get_cpu() { [[ -z "$speed" ]] && speed="$(sysctl -n hw.clockrate)" # Get CPU cores. - cores="$(sysctl -n hw.ncpu)" + case $kernel_name in + "OpenBSD"*) + [[ "$(sysctl -n hw.smt)" == "1" ]] && smt="on" || smt="off" + ncpufound="$(sysctl -n hw.ncpufound)" + ncpuonline="$(sysctl -n hw.ncpuonline)" + cores="${ncpuonline}/${ncpufound},\\xc2\\xa0SMT\\xc2\\xa0${smt}" + ;; + *) + cores="$(sysctl -n hw.ncpu)" + ;; + esac # Get CPU temp. case $kernel_name in