From dc8706cfa7820dbd67a6922bd0047448b7c25ec4 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 5 Mar 2010 07:22:56 +0000 Subject: [PATCH] small issue fix for intel ht dual core, it has bad core ids, so I had to replace smart count with a manual dumb count, that works --- inxi | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/inxi b/inxi index 275db2b..7ddf94a 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.6 -#### Date: February 17 2010 +#### version: 1.4.7 +#### Date: March 4 2010 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -2017,6 +2017,7 @@ get_cpu_ht_multicore_smp_data() FS=": " IGNORECASE = 1 core_count = 0 + holder = 0 i = 0 index_temp = "" num_of_cores = 0 @@ -2043,13 +2044,25 @@ get_cpu_ht_multicore_smp_data() i++ } END { - # look for the largest id number, and assign it - for ( j = 0; j < processor_logical_count; j++ ) { - if ( a_core_id[j] > core_count ) { - core_count = a_core_id[j] + # look for the largest id number, and assign it (dumped this method due intel) + # note that there are some cases, intel i5 core 2 HT where core_id shows + # as 0/2, not 0/1. this triggers a 3 core output, erroneously. + # Sorting the data solves this, since the counter now is mechanical, not + # trusting the data from the proc/cpuinfo at all re what the core id is + asort(a_core_id) + # awk increments j++ counter BEFORE the loop? + for ( j = 0; j <= processor_logical_count; j++ ) { + # if ( j in a_core_id && a_core_id[j] > core_count ) { + if ( j in a_core_id ) { + #core_count = a_core_id[j] + if ( a_core_id[j] != holder ){ + core_count++ + holder = a_core_id[j] + } } } - core_count = core_count + 1 + core_count = core_count + 1 + # trick, set the index equal to value, if the same, it will overwrite # this lets us create the actual array of true cpu physical ids for ( j in a_physical_id ) { @@ -2081,7 +2094,8 @@ get_cpu_ht_multicore_smp_data() } print type " " physical_cpu_count " " core_count } - ' $FILE_CPUINFO ) ) + ' $FILE_CPUINFO + ) ) fi log_function_data "A_CPU_TYPE_PCNT_CCNT: ${A_CPU_TYPE_PCNT_CCNT[@]}" eval $LOGFE @@ -3271,7 +3285,7 @@ get_ps_data() array_length=${#A_PS_DATA[@]}; while (( $i < $array_length/2 )) do - reorder_temp=${A_PS_DATA[i]} + reorder_temp=${A_PS_DATA[i]}f A_PS_DATA[i]=${A_PS_DATA[$array_length-$i-1]} A_PS_DATA[$array_length-$i-1]=$reorder_temp (( i++ ))