mirror of
https://github.com/smxi/inxi.git
synced 2025-09-02 10:39:17 +00:00
optimized cpu cache logic
This commit is contained in:
parent
c842901804
commit
eb6294f0b0
1 changed files with 7 additions and 5 deletions
12
inxi
12
inxi
|
@ -7385,17 +7385,19 @@ sub cpu_cache_dmi {
|
||||||
my @item = @$ref;
|
my @item = @$ref;
|
||||||
next if $item[0] != 7;
|
next if $item[0] != 7;
|
||||||
last if $item[0] > 7;
|
last if $item[0] > 7;
|
||||||
|
# skip first three row, we don't need that data
|
||||||
|
splice @item, 0, 3;
|
||||||
($id,$amount) = ('',0);
|
($id,$amount) = ('',0);
|
||||||
foreach my $value (@item){
|
foreach my $value (@item){
|
||||||
# some cpus only show Socket Designation: Internal cache
|
|
||||||
if (!$id && $value =~ /^Configuration:.* Level.*([1-3])\b/){
|
|
||||||
$id = "L$1";
|
|
||||||
}
|
|
||||||
# variants: L3 - Cache; L3 Cache; L3-cache
|
# variants: L3 - Cache; L3 Cache; L3-cache
|
||||||
if ($value =~ /^Socket Designation: (L[1-3])\b/){
|
if ($value =~ /^Socket Designation: (L[1-3])\b/){
|
||||||
$id = $1;
|
$id = $1;
|
||||||
}
|
}
|
||||||
if ($value =~ /^Installed Size: (.*B)$/){
|
# some cpus only show Socket Designation: Internal cache
|
||||||
|
elsif (!$id && $value =~ /^Configuration:.* Level.*([1-3])\b/){
|
||||||
|
$id = "L$1";
|
||||||
|
}
|
||||||
|
elsif ($id && $value =~ /^Installed Size: (.*B)$/){
|
||||||
$amount = main::translate_size($1);
|
$amount = main::translate_size($1);
|
||||||
}
|
}
|
||||||
if ($id && $amount){
|
if ($id && $amount){
|
||||||
|
|
Loading…
Add table
Reference in a new issue