[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:
parent
eeead8d7c3
commit
c176e6ffae
1 changed files with 12 additions and 3 deletions
15
neofetch
15
neofetch
|
|
@ -2531,6 +2531,8 @@ get_cpu() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
sockets="$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)"
|
||||||
|
|
||||||
case $cpu_cores in
|
case $cpu_cores in
|
||||||
"logical" | "on")
|
"logical" | "on")
|
||||||
cores="$(grep -c "^processor" "$cpu_file")"
|
cores="$(grep -c "^processor" "$cpu_file")"
|
||||||
|
|
@ -2550,8 +2552,8 @@ get_cpu() {
|
||||||
|
|
||||||
speed="$(system_profiler SPHardwareDataType | grep CPU\ Speed)"
|
speed="$(system_profiler SPHardwareDataType | grep CPU\ Speed)"
|
||||||
speed="${speed/CPU\ Speed\:/}"
|
speed="${speed/CPU\ Speed\:/}"
|
||||||
speed="${speed/ MHz/}"
|
speed="${speed/ MHz/}"
|
||||||
speed="${speed/ GHz/}"
|
speed="${speed/ GHz/}"
|
||||||
|
|
||||||
cores="$(system_profiler SPHardwareDataType | grep Number\ Of\ CPUs)"
|
cores="$(system_profiler SPHardwareDataType | grep Number\ Of\ CPUs)"
|
||||||
cores="${cores/Number\ Of\ CPUs\:/}"
|
cores="${cores/Number\ Of\ CPUs\:/}"
|
||||||
|
|
@ -2753,7 +2755,14 @@ get_cpu() {
|
||||||
cpu="${cpu/@/(${cores}) @}"
|
cpu="${cpu/@/(${cores}) @}"
|
||||||
fi
|
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
|
esac
|
||||||
|
|
||||||
# Add CPU speed to the output.
|
# Add CPU speed to the output.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue