2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +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:
Jean Delvare
2007-06-25 17:08:15 +00:00
parent 24f6b62c3f
commit 7a48555748

View File

@@ -2244,11 +2244,12 @@ sub initialize_cpu_list
{
open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!";
local $_;
my %entry;
my $entry;
while (<INPUTFILE>) {
if (m/^processor\s*:\s*(\d+)/) {
push @cpu, \%entry if scalar keys(%entry); # Previous entry
%entry = (); # New entry
push @cpu, $entry if scalar keys(%{$entry}); # Previous entry
$entry = {}; # New entry
next;
}
if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) {
@@ -2256,11 +2257,11 @@ sub initialize_cpu_list
my $v = $2;
$v =~ s/\s+/ /g; # Merge multiple spaces
$v =~ s/ $//; # Trim trailing space
$entry{$k} = $v;
$entry->{$k} = $v;
next;
}
}
push @cpu, \%entry if scalar keys(%entry); # Last entry
push @cpu, $entry if scalar keys(%{$entry}); # Last entry
close INPUTFILE;
}