mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-03 15:55:15 +00:00
Fix the case where the system has different CPU models.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4467 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -2244,11 +2244,12 @@ sub initialize_cpu_list
|
|||||||
{
|
{
|
||||||
open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!";
|
open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!";
|
||||||
local $_;
|
local $_;
|
||||||
my %entry;
|
my $entry;
|
||||||
|
|
||||||
while (<INPUTFILE>) {
|
while (<INPUTFILE>) {
|
||||||
if (m/^processor\s*:\s*(\d+)/) {
|
if (m/^processor\s*:\s*(\d+)/) {
|
||||||
push @cpu, \%entry if scalar keys(%entry); # Previous entry
|
push @cpu, $entry if scalar keys(%{$entry}); # Previous entry
|
||||||
%entry = (); # New entry
|
$entry = {}; # New entry
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) {
|
if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) {
|
||||||
@@ -2256,11 +2257,11 @@ sub initialize_cpu_list
|
|||||||
my $v = $2;
|
my $v = $2;
|
||||||
$v =~ s/\s+/ /g; # Merge multiple spaces
|
$v =~ s/\s+/ /g; # Merge multiple spaces
|
||||||
$v =~ s/ $//; # Trim trailing space
|
$v =~ s/ $//; # Trim trailing space
|
||||||
$entry{$k} = $v;
|
$entry->{$k} = $v;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
push @cpu, \%entry if scalar keys(%entry); # Last entry
|
push @cpu, $entry if scalar keys(%{$entry}); # Last entry
|
||||||
close INPUTFILE;
|
close INPUTFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user