mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
bug fix, some intel cpus give core id as 0 for each core, thus creating a situation where
inxi thinks it's a single core cpu, no matter if it's multicpu or multicore. Using the: cpu cores value to double check, as a fallback. This seems to work, ie, if cpu cores is listed as 1 but processor count * cpu count is > 1, then clearly the intel reporting bug is in play. Note that this is NOT an inxi bug, but is a bug in how some intel cpus create their cpuinfo data, but since intel is a major player, it's worth handling that issue.
This commit is contained in:
parent
bd15318705
commit
9d8da0627f
15
inxi
15
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.7.29
|
#### version: 1.7.30
|
||||||
#### Date: February 9 2012
|
#### Date: February 21 2012
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -3029,6 +3029,7 @@ get_cpu_ht_multicore_smp_data()
|
||||||
num_of_cores = 0
|
num_of_cores = 0
|
||||||
num_of_processors = 0
|
num_of_processors = 0
|
||||||
num_of_cpus = 0
|
num_of_cpus = 0
|
||||||
|
cpu_core_count = 0
|
||||||
core_id[0]
|
core_id[0]
|
||||||
processor_id[0]
|
processor_id[0]
|
||||||
cpu_id[0]
|
cpu_id[0]
|
||||||
|
@ -3048,6 +3049,12 @@ get_cpu_ht_multicore_smp_data()
|
||||||
core_id[iter] = $NF
|
core_id[iter] = $NF
|
||||||
iter++
|
iter++
|
||||||
}
|
}
|
||||||
|
# this will be used to fix an intel glitch if needed, cause, intel
|
||||||
|
# sometimes reports core id as the same number for each core, 0
|
||||||
|
# so if cpu cores shows greater value than number of cores, use this
|
||||||
|
/^cpu cores/ {
|
||||||
|
cpu_core_count = $NF
|
||||||
|
}
|
||||||
END {
|
END {
|
||||||
## Look thru the array and filter same numbers.
|
## Look thru the array and filter same numbers.
|
||||||
## only unique numbers required
|
## only unique numbers required
|
||||||
|
@ -3056,6 +3063,7 @@ get_cpu_ht_multicore_smp_data()
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
## count unique processors ##
|
## count unique processors ##
|
||||||
|
# note, this fails for intel cpus at times
|
||||||
for ( i in processor_id ) {
|
for ( i in processor_id ) {
|
||||||
procHolder[processor_id[i]] = 1
|
procHolder[processor_id[i]] = 1
|
||||||
}
|
}
|
||||||
|
@ -3080,6 +3088,9 @@ get_cpu_ht_multicore_smp_data()
|
||||||
for ( i in coreHolder ) {
|
for ( i in coreHolder ) {
|
||||||
num_of_cores++
|
num_of_cores++
|
||||||
}
|
}
|
||||||
|
if ( ( num_of_cores == 1 ) && ( cpu_core_count * num_of_cpus > 1 ) ) {
|
||||||
|
num_of_cores = cpu_core_count * num_of_cpus
|
||||||
|
}
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# algorithm
|
# algorithm
|
||||||
|
|
Loading…
Reference in a new issue