CPU: Update comments
This commit is contained in:
parent
5a6a3d7e5b
commit
f7686ee8e8
33
neofetch
33
neofetch
|
@ -727,7 +727,7 @@ get_cpu() {
|
|||
|
||||
case "$os" in
|
||||
"Linux" | "Windows")
|
||||
# Get cpu name
|
||||
# Get CPU name
|
||||
case "$distro" in
|
||||
"Android"*) cpu="$(getprop ro.product.board)" ;;
|
||||
*) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;;
|
||||
|
@ -736,7 +736,7 @@ get_cpu() {
|
|||
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||
temp_dir="/sys/class/hwmon/hwmon0/temp1_input"
|
||||
|
||||
# Get cpu speed
|
||||
# Get CPU speed
|
||||
if [[ -d "$speed_dir" ]]; then
|
||||
# Fallback to bios_limit if $speed_type fails.
|
||||
speed="$(< "${speed_dir}/${speed_type}")" || \
|
||||
|
@ -749,14 +749,14 @@ get_cpu() {
|
|||
speed="$((speed / 100))"
|
||||
fi
|
||||
|
||||
# Get cpu temp
|
||||
# Get CPU temp
|
||||
if [[ "$cpu_temp" == "on" && -f "$temp_dir" ]]; then
|
||||
temp="$(< "$temp_dir")"
|
||||
temp="$((temp * 100 / 10000))"
|
||||
temp="[${temp/${temp: -1}}.${temp: -1}°C]"
|
||||
fi
|
||||
|
||||
# Show/hide hyperthreaded cores
|
||||
# Get CPU cores
|
||||
case "$cpu_cores" in
|
||||
"logical" | "on") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
|
||||
"physical") cores="$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)" ;;
|
||||
|
@ -766,7 +766,7 @@ get_cpu() {
|
|||
"Mac OS X")
|
||||
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
||||
|
||||
# Show/hide hyperthreaded cores
|
||||
# Get CPU cores
|
||||
case "$cpu_cores" in
|
||||
"logical" | "on") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
||||
"physical") cores="$(sysctl -n hw.physicalcpu_max)" ;;
|
||||
|
@ -801,20 +801,20 @@ get_cpu() {
|
|||
;;
|
||||
|
||||
"BSD")
|
||||
# Get cpu name
|
||||
# Get CPU name
|
||||
cpu="$(sysctl -n hw.model)"
|
||||
cpu="${cpu/[0-9]\.*}"
|
||||
cpu="${cpu/ @*}"
|
||||
|
||||
# Get cpu speed
|
||||
# Get CPU speed
|
||||
speed="$(sysctl -n hw.cpuspeed)"
|
||||
[[ -z "$speed" ]] && speed="$(sysctl -n hw.clockrate)"
|
||||
speed="$((speed / 100))"
|
||||
|
||||
# Get cpu cores
|
||||
# Get CPU cores
|
||||
cores="$(sysctl -n hw.ncpu)"
|
||||
|
||||
# Get cpu temp
|
||||
# Get CPU temp
|
||||
if [[ "$cpu_temp" == "on" ]]; then
|
||||
case "$kernel_name" in
|
||||
"FreeBSD"* | "DragonFly"*)
|
||||
|
@ -830,17 +830,17 @@ get_cpu() {
|
|||
;;
|
||||
|
||||
"Solaris")
|
||||
# Get cpuname
|
||||
# Get CPU name
|
||||
cpu="$(psrinfo -pv)"
|
||||
cpu="${cpu//*$'\n'}"
|
||||
cpu="${cpu/[0-9]\.*}"
|
||||
cpu="${cpu/ @*}"
|
||||
|
||||
# Get cpu speed
|
||||
# Get CPU speed
|
||||
speed="$(psrinfo -v | awk '/operates at/ {print $6; exit}')"
|
||||
speed="$((speed / 100))"
|
||||
|
||||
# Show/hide hyperthreaded cores
|
||||
# Get CPU cores
|
||||
case "$cpu_cores" in
|
||||
"logical" | "on") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
|
||||
"physical") cores="$(psrinfo -p)" ;;
|
||||
|
@ -848,11 +848,16 @@ get_cpu() {
|
|||
;;
|
||||
|
||||
"Haiku")
|
||||
# Get CPU name
|
||||
cpu="$(sysinfo -cpu | awk -F '\\"' '/CPU #0/ {print $2}')"
|
||||
cpu="${cpu/@*}"
|
||||
|
||||
# Get CPU speed
|
||||
speed="$(sysinfo -cpu | awk '/running at/ {print $NF; exit}')"
|
||||
speed="${speed/MHz}"
|
||||
speed="$((speed / 100))"
|
||||
|
||||
# Get CPU cores
|
||||
cores="$(sysinfo -cpu | grep -c -F 'CPU #')"
|
||||
;;
|
||||
esac
|
||||
|
@ -906,9 +911,7 @@ get_cpu() {
|
|||
cpu="${cpu/Core? Duo }"
|
||||
cpu="${cpu/AMD }"
|
||||
|
||||
case "$cpu_shorthand" in
|
||||
"tiny") cpu="${cpu/@*}" ;;
|
||||
esac
|
||||
[[ "$cpu_shorthand" == "tiny" ]] && cpu="${cpu/@*}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Reference in New Issue