quick check of cpu

This commit is contained in:
inxi-svn 2014-04-09 06:30:46 +00:00
parent fdd359621b
commit d473167200

34
inxi
View file

@ -3683,6 +3683,8 @@ get_cpu_data()
nr = 0 nr = 0
count = 0 count = 0
bArm = "false" bArm = "false"
# ARM cpus are erratic in /proc/cpuinfo this hack can sometimes resolve it. Linux only.
sysSpeed="'$(get_cpu_speed_hack)'"
} }
# TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+ # TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+
# TAKE NOTE: \t+ will work for $FILE_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES! # TAKE NOTE: \t+ will work for $FILE_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
@ -3760,7 +3762,12 @@ get_cpu_data()
# note: assuming bogomips for arm at 1 x clock # note: assuming bogomips for arm at 1 x clock
# http://en.wikipedia.org/wiki/BogoMips ARM could change so watch this # http://en.wikipedia.org/wiki/BogoMips ARM could change so watch this
# maybe add: && bArm == "true" but I think most of the bogomips roughly equal cpu speed if not amd/intel # maybe add: && bArm == "true" but I think most of the bogomips roughly equal cpu speed if not amd/intel
if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) { # 2014-04-08: trying to use sysSpeed hack first, that is more accurate anyway.
if ( ( cpu[i, "speed"] == "" && sysSpeed != "" ) || \
( cpu[i, "speed"] == "" && cpu[i, "bogomips"] != "" && cpu[i, "bogomips"] < 50 ) ) {
cpu[i, "speed"] = sysSpeed
}
else if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) {
cpu[i, "speed"] = cpu[i, "bogomips"] cpu[i, "speed"] = cpu[i, "bogomips"]
} }
print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm
@ -3780,7 +3787,9 @@ get_cpu_data()
printf("%s %s\n", max, "Mhz") printf("%s %s\n", max, "Mhz")
} }
} }
} ' $FILE_CPUINFO ) ) }
' $FILE_CPUINFO ) )
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
log_function_data 'cat' "$FILE_CPUINFO" log_function_data 'cat' "$FILE_CPUINFO"
elif [[ -n $BSD_TYPE ]];then elif [[ -n $BSD_TYPE ]];then
@ -9185,9 +9194,9 @@ print_short_data()
## assemble data for output ## assemble data for output
local cpu_clock="${a_cpu_working[1]}" # old CPU3 local cpu_clock="${a_cpu_working[1]}" # old CPU3
# echo $cpu_clock # echo $cpu_clock
if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then # if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then
a_cpu_working[1]=$(get_cpu_speed_hack) # a_cpu_working[1]=$(get_cpu_speed_hack)
fi # fi
# this gets that weird min/max final array item, which almost never contains any data of use # 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_nu=$(( ${#A_CPU_DATA[@]} - 1 ))
local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]/.* Mhz/ Mhz} local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]/.* Mhz/ Mhz}
@ -9495,16 +9504,15 @@ print_cpu_data()
if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then
cpu_clock_speed='' # null < verbosity level 5 cpu_clock_speed='' # null < verbosity level 5
else else
if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then if [[ -z ${a_cpu_working[1]} ]];then
a_cpu_working[1]=$(get_cpu_speed_hack) if [[ -z ${cpu_data/*ARM*/} ]];then
if [[ -z ${a_cpu_working[1]} ]];then temp1=' (ARM)'
if [[ -z ${cpu_data/*ARM*/} ]];then
temp1='ARM '
fi
a_cpu_working[1]="N/A ${temp1}Error"
fi fi
a_cpu_working[1]="N/A$temp1"
else
a_cpu_working[1]="${a_cpu_working[1]%.*} MHz"
fi fi
cpu_data="$cpu_data ${C1}clocked at${C2} ${a_cpu_working[1]%.*} MHz" cpu_clock_speed=" ${C1}clocked at${C2} ${a_cpu_working[1]}"
fi fi
cpu_2_data="$cpu_2_data$cpu_clock_speed" cpu_2_data="$cpu_2_data$cpu_clock_speed"
else else