optimized cpu cache logic

This commit is contained in:
Harald Hope 2018-09-10 16:05:48 -07:00
parent c842901804
commit eb6294f0b0

12
inxi
View file

@ -7385,17 +7385,19 @@ sub cpu_cache_dmi {
my @item = @$ref;
next 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);
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
if ($value =~ /^Socket Designation: (L[1-3])\b/){
$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);
}
if ($id && $amount){