some fixes to bsd cpu output

This commit is contained in:
inxi-svn 2014-09-12 02:16:53 +00:00
parent fc7410f91e
commit d886822e6c

15
inxi
View file

@ -3802,12 +3802,16 @@ get_cpu_core_count()
if [[ -n $( grep -E '^[0-9]+$' <<< "$cpu_core_count" ) ]];then
cpu_alpha_count=$( get_cpu_core_count_alpha "$cpu_core_count" )
if [[ $cpu_core_count -gt 1 ]];then
cpu_type='SMP'
cpu_type='-SMP-'
else
cpu_type='-UP-'
fi
fi
if [[ -n $cores_per_cpu ]];then
cpu_physical_count=$(( $cpu_core_count / $cores_per_cpu ))
cpu_core_count=$cores_per_cpu
if [[ $cores_per_cpu -gt 1 ]];then
cpu_type='-MCP-'
fi
# do not guess here, only use phys count if it actually exists, otherwise handle in print_cpu..
# this 1 value should not be used for output, and is just to avoid math errors
else
@ -10343,6 +10347,8 @@ print_short_data()
cpc_plural='(s)'
model_plural='s'
cpu_count_print="$cpu_physical_count "
# for multicpu systems, divide total cores by cpu count to get per cpu cores
$cpu_core_count=$(($cpu_core_count/$cpu_physical_count))
fi
if [[ -z $BSD_TYPE ]];then
cpu_data_string="$cpu_count_print$cpu_core_alpha core"
@ -10580,7 +10586,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='' temp1=''
local cpu_2_data='' working_cpu='' temp1='' per_cpu_cores=''
local line_starter="CPU:" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} "
##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\""
@ -10624,7 +10630,8 @@ print_cpu_data()
cpu_data="${C1}$cpu_data_string${C2} ${a_cpu_working[0]}$model_plural ($cpu_type)"
else
if [[ $cpu_physical_count -gt 1 ]];then
cpu_data_string="${C1}Cores$SEP3${C2} $cpu_core_count ${C1}CPUs$SEP3${C2} $cpu_physical_count "
per_cpu_cores=$(($cpu_core_count/$cpu_physical_count))
cpu_data_string="${C1}Cores$SEP3${C2} $cpu_core_count ($cpu_physical_count $per_cpu_cores core cpus) "
else
cpu_data_string="${C1}Cores$SEP3${C2} $cpu_core_count "
fi