[O] Display number of sockets for multi-cpu systems

Fix for https://github.com/dylanaraps/neofetch/issues/1574
Corrected implementation of https://github.com/dylanaraps/neofetch/pull/1585
This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-08-11 22:12:20 -04:00
parent eeead8d7c3
commit c176e6ffae

View file

@ -2531,6 +2531,8 @@ get_cpu() {
;;
*)
sockets="$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)"
case $cpu_cores in
"logical" | "on")
cores="$(grep -c "^processor" "$cpu_file")"
@ -2753,7 +2755,14 @@ get_cpu() {
cpu="${cpu/@/(${cores}) @}"
fi
;;
*) cpu="$cpu ($cores)" ;;
*)
# If socket information is present and more than 1, display cpu count first
if [[ $sockets ]] && [[ $sockets -gt 1 ]]; then
cpu="${sockets}x $cpu $((cores / sockets))"
else
cpu="$cpu ($cores)"
fi
;;
esac
# Add CPU speed to the output.