New version, tarball, ARM cpu /proc/cpuinfo has broken the bogomips output, since this

is an upstream bug, I'm adding in a quick hack that will work maybe for single core
ARM cpus, but NOT for multicores that have the same issue.
This commit is contained in:
inxi-svn 2014-04-09 00:17:54 +00:00
parent 48700dbe25
commit a2ec193fd6
2 changed files with 44 additions and 4 deletions

34
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.1.19
#### Date: 2014-04-06
#### Version: 2.1.20
#### Date: 2014-04-08
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -3794,6 +3794,17 @@ get_cpu_data()
eval $LOGFE
# echo getMainCpu: ${[@]}
}
# this triggers in one and only one case, ARM cpus that have fake bogomips data
get_cpu_speed_hack()
{
local speed=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null )
if [[ -n $speed ]];then
speed=${speed%[0-9][0-9][0-9]} # trim off last 3 digits
fi
echo $speed
}
get_cpu_data_bsd()
{
@ -9174,6 +9185,9 @@ print_short_data()
local cpu_model="${a_cpu_working[0]}"
## assemble data for output
local cpu_clock="${a_cpu_working[1]}" # old CPU3
if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then
$a_cpu_working[1]=$(get_cpu_speed_hack)
fi
# this gets that weird min/max final array item, which almost never contains any data of use
local min_max_clock_nu=$(( ${#A_CPU_DATA[@]} - 1 ))
local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]/.* Mhz/ Mhz}
@ -9379,7 +9393,7 @@ print_cpu_data()
local a_cpu_working='' cpu_model='' cpu_clock='' cpu_null_error=''
local cpc_plural='' cpu_count_print='' model_plural='' cpu_data_string=''
local cpu_physical_count='' cpu_core_count='' cpu_core_alpha='' cpu_type=''
local cpu_2_data='' working_cpu=''
local cpu_2_data='' working_cpu='' temp1=''
local line_starter="CPU:" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} "
##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\""
@ -9429,7 +9443,10 @@ print_cpu_data()
# ARM may use the faked 1 cpucorecount to make this work
# echo $cpu_core_count $cpu_physical_count
if [[ -n ${a_cpu_working[4]} ]];then
bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" )
# new arm shows bad bogomip value, so don't use it
if [[ ${a_cpu_working[4]} > 50 ]];then
bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" )
fi
bmip_data=${bmip_data%.*}
fi
# else
@ -9478,6 +9495,15 @@ print_cpu_data()
if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then
cpu_clock_speed='' # null < verbosity level 5
else
if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then
a_cpu_working[1]=$(get_cpu_speed_hack)
if [[ -z ${a_cpu_working[1]} ]];then
if [[ -z ${cpu_data/*ARM*/} ]];then
temp1='ARM '
fi
a_cpu_working[1]="N/A ${temp1}Error"
fi
fi
cpu_data="$cpu_data ${C1}clocked at${C2} ${a_cpu_working[1]%.*} MHz"
fi
cpu_2_data="$cpu_2_data$cpu_clock_speed"

View file

@ -1,3 +1,17 @@
=====================================================================================
Version: 2.1.20
Patch Version: 00
Script Date: 2014-04-08
-----------------------------------
Changes:
-----------------------------------
New version, tarball, ARM cpu /proc/cpuinfo has broken the bogomips output, since this
is an upstream bug, I'm adding in a quick hack that will work maybe for single core
ARM cpus, but NOT for multicores that have the same issue.
-----------------------------------
-- Harald Hope - Tue, 08 Apr 2014 17:15:41 -0700
=====================================================================================
Version: 2.1.19
Patch Version: 00