From dc32c0b71cc263e4cec410ddcd7fac721863e29b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 21 Oct 2016 16:26:34 +1100 Subject: [PATCH] Add option to hide/show hypertheaded cpu cores --- neofetch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 3819e310..74a48387 100755 --- a/neofetch +++ b/neofetch @@ -724,7 +724,11 @@ getcpu() { speed="$((speed / 100))" fi - cores="$(grep -c ^processor /proc/cpuinfo)" + # Show/hide hyperthreaded cores + case "$cores_ht" in + "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;; + "off") cores="$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)" ;; + esac # Fix for speeds under 1ghz if [ -z "${speed:1}" ]; then @@ -738,7 +742,12 @@ getcpu() { "Mac OS X") cpu="$(sysctl -n machdep.cpu.brand_string)" - cores="$(sysctl -n hw.ncpu)" + + # Show/hide hyperthreaded cores + case "$cores_ht" in + "on") cores="$(sysctl -n hw.logicalcpu_max)" ;; + "off") cores="$(sysctl -n hw.physicalcpu_max)" ;; + esac ;; "iPhone OS")