diff --git a/inxi b/inxi index 5672e6f..74a738e 100755 --- a/inxi +++ b/inxi @@ -1486,72 +1486,72 @@ get_cpu_ht_multicore_smp_data() if [[ $B_CPUINFO == 'true' ]]; then { A_CPU_TYPE_PCNT_CCNT=( $(gawk ' - BEGIN { FS=": "; i = 0 } {IGNORECASE = 1} - /^processor/ { num_of_processors = $NF + 1 } # counts logical processors, both HT and physical - /^cpu cores/ { num_of_cores = $NF } # counts physical cores - /^physical/ { physical_id[i] = $NF } # array of physical cpus ids - /^core id/ { core_id[i] = $NF; i++ } # array of core ids + BEGIN { FS=": "; i = 0 } {IGNORECASE = 1} + /^processor/ { num_of_processors = $NF + 1 } # counts logical processors, both HT and physical + /^cpu cores/ { num_of_cores = $NF } # counts physical cores + /^physical/ { physical_id[i] = $NF } # array of physical cpus ids + /^core id/ { core_id[i] = $NF; i++ } # array of core ids + { + processors = 1 + cores = 1 # single cores are obviously a Uni-processor + type = "UP" + cpu_temp = 0 + core_temp = 0 + + # look for the largest id number, and assign it + for ( j = 0; j <= num_of_processors; j++) + { + if ( physical[j] > cpu_temp ) { - processors = 1 - cores = 1 # single cores are obviously a Uni-processor - type = "UP" - cpu_temp = 0 - core_temp = 0 + cpu_temp = physical[j] + } + if ( core_id[j] > core_temp ) + { + core_temp = core_id[j] + } + } - # look for the largest id number, and assign it - for ( j = 0; j <= num_of_processors; j++) + physical_cpu_count = cpu_temp + 1 + core_count = core_temp + 1 + + # looking at logical processor counts over 1, which means either HT, SMP or MCP + if ( num_of_processors > 1 ) + { + if ( physical_cpu_count == 1 ) + { + if ( physical_cpu_count == core_count ) { - if ( physical[j] > cpu_temp ) - { - cpu_temp = physical[j] - } - if ( core_id[j] > core_temp ) - { - core_temp = core_id[j] - } + type = "HT" # this is more than likely a P4 w/HT or an Atom 270 } - - physical_cpu_count = cpu_temp + 1 - core_count = core_temp + 1 - - # looking at logical processor counts over 1, which means either HT, SMP or MCP - if ( num_of_processors > 1 ) + else { - if ( physical_cpu_count == 1 ) + if ( core_count == num_of_cores && core_count == num_of_processors) { - if ( physical_cpu_count == core_count ) - { - type = "HT" # this is more than likely a P4 w/HT or an Atom 270 - } - else - { - if ( core_count == num_of_cores && core_count == num_of_processors) - { - type = "MCP" - cores = core_count - } - else - { - type = "HT" # this is i7 or Atom 330 - cores = core_count - } - } + type = "MCP" + cores = core_count } else { - type = "SMP" - processors = physical_cpu_count - - if ( num_of_cores > 1 ) - { - type = "SMPMC" # processors could be both MCP and SMP - cores = core_count - } + type = "HT" # this is i7 or Atom 330 + cores = core_count } } } - END { print type " " processors " " cores } - ' $DIR_CPUINFO )) + else + { + type = "SMP" + processors = physical_cpu_count + + if ( num_of_cores > 1 ) + { + type = "SMPMC" # processors could be both MCP and SMP + cores = core_count + } + } + } + } + END { print type " " processors " " cores } + ' $DIR_CPUINFO )) } fi }