Merge pull request #381 from dylanaraps/cores
Add option to hide/show hyperthreaded cpu cores.
This commit is contained in:
commit
6a37a9bb11
4 changed files with 33 additions and 11 deletions
|
@ -364,7 +364,9 @@ alias neofetch2="neofetch \
|
|||
NOTE: This only support Linux with cpufreq.
|
||||
--cpu_shorthand type Shorten the output of CPU
|
||||
Possible values: name, speed, tiny, on, off
|
||||
--cpu_cores on/off Whether or not to display the number of CPU cores
|
||||
--cpu_cores type Whether or not to display the number of CPU cores
|
||||
Takes: logical, physical, off
|
||||
Note: 'physical' doesn't work on BSD.
|
||||
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
|
||||
NOTE: This is only possible on Linux, macOS, and Solaris
|
||||
--kernel_shorthand on/off Shorten the output of kernel
|
||||
|
|
|
@ -108,8 +108,11 @@ cpu_display="off"
|
|||
|
||||
# CPU Cores
|
||||
# Display CPU cores in output
|
||||
# --cpu_cores on/off
|
||||
cpu_cores="on"
|
||||
# Logical: All virtual cores
|
||||
# Physical: All physical cores
|
||||
# --cpu_cores logical, physical, off
|
||||
# Note: 'physical' doesn't work on BSD.
|
||||
cpu_cores="logical"
|
||||
|
||||
|
||||
# GPU
|
||||
|
|
26
neofetch
26
neofetch
|
@ -724,7 +724,11 @@ getcpu() {
|
|||
speed="$((speed / 100))"
|
||||
fi
|
||||
|
||||
cores="$(grep -c ^processor /proc/cpuinfo)"
|
||||
# Show/hide hyperthreaded cores
|
||||
case "$cpu_cores" in
|
||||
"logical" | "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;;
|
||||
"physical") 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 "$cpu_cores" in
|
||||
"logical" | "on") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
||||
"physical") cores="$(sysctl -n hw.physicalcpu_max)" ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"iPhone OS")
|
||||
|
@ -884,8 +893,11 @@ getcpu() {
|
|||
speed="$(psrinfo -v | awk '/operates at/ {print $6}')"
|
||||
speed="$((speed / 100))"
|
||||
|
||||
# Get cpu cores
|
||||
cores="$(kstat -m cpu_info | grep -c "chip_id")"
|
||||
# Show/hide hyperthreaded cores
|
||||
case "$cpu_cores" in
|
||||
"logical" | "on") cores="$(kstat -m cpu_info | grep -c "chip_id")" ;;
|
||||
"physical") cores="$(psrinfo -p)" ;;
|
||||
esac
|
||||
|
||||
# Fix for speeds under 1ghz
|
||||
if [ -z "${speed:1}" ]; then
|
||||
|
@ -913,7 +925,7 @@ getcpu() {
|
|||
cpu="${cpu//with Radeon HD Graphics}"
|
||||
|
||||
# Add cpu cores to output
|
||||
[ "$cpu_cores" == "on" ] && [ "$cores" ] && \
|
||||
[ "$cpu_cores" != "off" ] && [ "$cores" ] && \
|
||||
cpu="${cpu/@/(${cores}) @}"
|
||||
|
||||
# Make the output of cpu shorter
|
||||
|
@ -2948,7 +2960,9 @@ usage() { cat << EOF
|
|||
NOTE: This only support Linux with cpufreq.
|
||||
--cpu_shorthand type Shorten the output of CPU
|
||||
Possible values: name, speed, tiny, on, off
|
||||
--cpu_cores on/off Whether or not to display the number of CPU cores
|
||||
--cpu_cores type Whether or not to display the number of CPU cores
|
||||
Takes: logical, physical, off
|
||||
Note: 'physical' doesn't work on BSD.
|
||||
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
|
||||
NOTE: This is only possible on Linux, macOS, and Solaris
|
||||
--kernel_shorthand on/off Shorten the output of kernel
|
||||
|
|
|
@ -35,8 +35,10 @@ Shorten the output of CPU
|
|||
.br
|
||||
Possible values: name, speed, tiny, on, off
|
||||
.TP
|
||||
.B \--cpu_cores 'on/off'
|
||||
.B \--cpu_cores 'logical/physical/off'
|
||||
Whether or not to display the number of CPU cores
|
||||
.br
|
||||
Note: 'physical' doesn't work on BSD.
|
||||
.TP
|
||||
.B \--distro_shorthand 'on/off'
|
||||
Shorten the output of distro (tiny, on, off)
|
||||
|
@ -51,7 +53,8 @@ Shorten the output of uptime (tiny, on, off)
|
|||
.TP
|
||||
.B \--refresh_rate 'on/off'
|
||||
Whether to display the refresh rate of each monitor
|
||||
Unsupported on Windows
|
||||
.br
|
||||
Note: Unsupported on Windows
|
||||
.TP
|
||||
.B \--gpu_shorthand 'on/off'
|
||||
Shorten the output of GPU (tiny, on, off)
|
||||
|
|
Loading…
Reference in a new issue