Merge pull request #757 from konimex/arm

CPU [Linux]: Fix inaccurate ARM CPU on SoC systems
This commit is contained in:
Herdiansyah 2017-06-22 13:00:48 +07:00 committed by GitHub
commit a032067e54
2 changed files with 23 additions and 20 deletions

View file

@ -1,3 +1,8 @@
## Contributors ## Contributors
## Info
**CPU**
- [Linux] Fixed inaccurate output on ARM SoC devices.

View file

@ -828,26 +828,22 @@ get_cpu() {
case "$os" in case "$os" in
"Linux" | "MINIX" | "Windows") "Linux" | "MINIX" | "Windows")
# Get CPU name. # Get CPU name.
case "$distro" in case "$machine_arch" in
"Android"*) cpu="$(getprop ro.product.board)" ;; "frv" | "hppa" | "m68k" | "openrisc" | "or"* | "powerpc" | "ppc"* | "sparc"*)
*) cpu="$(awk -F':' '/^cpu\t|^CPU/ {printf $2; exit}' /proc/cpuinfo)"
case "$machine_arch" in ;;
"frv" | "hppa" | "m68k" | "openrisc" | "or"* | "powerpc" | "ppc"* | "sparc"*) "s390"*)
cpu="$(awk -F':' '/^cpu\t|^CPU/ {printf $2; exit}' /proc/cpuinfo)" cpu="$(awk -F'=' '/machine/ {print $4; exit}' /proc/cpuinfo)"
;; ;;
"s390"*) "ia64" | "m32r")
cpu="$(awk -F'=' '/machine/ {print $4; exit}' /proc/cpuinfo)" cpu="$(awk -F':' '/model/ {print $2; exit}' /proc/cpuinfo)"
;; [[ -z "$cpu" ]] && cpu="$(awk -F':' '/family/ {printf $2; exit}' /proc/cpuinfo)"
"ia64" | "m32r") ;;
cpu="$(awk -F':' '/model/ {print $2; exit}' /proc/cpuinfo)" *)
[[ -z "$cpu" ]] && cpu="$(awk -F':' '/family/ {printf $2; exit}' /proc/cpuinfo)" cpu="$(awk -F ': | @' '/model name|Processor|^cpu model|chip type|^cpu type/ {printf $2; exit}' /proc/cpuinfo)"
;; [[ "$cpu" == *"processor rev"* ]] && cpu="$(awk -F':' '/Hardware/ {print $2; exit}' /proc/cpuinfo)"
*) ;;
cpu="$(awk -F ': | @' '/model name|Processor|^cpu model|chip type|^cpu type/ {printf $2; exit}' /proc/cpuinfo)" esac
;;
esac
;;
esac
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
temp_dir="/sys/class/hwmon/hwmon0/temp1_input" temp_dir="/sys/class/hwmon/hwmon0/temp1_input"
@ -1047,6 +1043,7 @@ get_cpu() {
cpu="${cpu//, altivec supported}" cpu="${cpu//, altivec supported}"
cpu="${cpu//FPU*}" cpu="${cpu//FPU*}"
cpu="${cpu//Chip Revision*}" cpu="${cpu//Chip Revision*}"
cpu="${cpu//Technologies, Inc}"
# Trim spaces from core output # Trim spaces from core output
cores="${cores//[[:space:]]}" cores="${cores//[[:space:]]}"
@ -1068,6 +1065,7 @@ get_cpu() {
cpu="${cpu/AMD }" cpu="${cpu/AMD }"
cpu="${cpu/Intel }" cpu="${cpu/Intel }"
cpu="${cpu/Core? Duo }" cpu="${cpu/Core? Duo }"
cpu="${cpu/Qualcomm }"
[[ "$cpu_shorthand" == "tiny" ]] && cpu="${cpu/@*}" [[ "$cpu_shorthand" == "tiny" ]] && cpu="${cpu/@*}"
;; ;;