mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
quick check of cpu
This commit is contained in:
parent
fdd359621b
commit
d473167200
30
inxi
30
inxi
|
@ -3683,6 +3683,8 @@ get_cpu_data()
|
|||
nr = 0
|
||||
count = 0
|
||||
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 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
|
||||
# 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
|
||||
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"]
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
||||
} ' $FILE_CPUINFO ) )
|
||||
}
|
||||
' $FILE_CPUINFO ) )
|
||||
|
||||
IFS="$ORIGINAL_IFS"
|
||||
log_function_data 'cat' "$FILE_CPUINFO"
|
||||
elif [[ -n $BSD_TYPE ]];then
|
||||
|
@ -9185,9 +9194,9 @@ print_short_data()
|
|||
## assemble data for output
|
||||
local cpu_clock="${a_cpu_working[1]}" # old CPU3
|
||||
# echo $cpu_clock
|
||||
if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then
|
||||
a_cpu_working[1]=$(get_cpu_speed_hack)
|
||||
fi
|
||||
# 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}
|
||||
|
@ -9495,16 +9504,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 '
|
||||
temp1=' (ARM)'
|
||||
fi
|
||||
a_cpu_working[1]="N/A ${temp1}Error"
|
||||
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
|
||||
cpu_2_data="$cpu_2_data$cpu_clock_speed"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue