1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC::CPU;
use strict;
#processor : 0
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#processor : 1
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#timebase : 181495202
#machine : CHRP IBM,7029-6C3
#
#
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read ("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpus;
my $current;
my $isIBM;
open CPUINFO, "</proc/cpuinfo" or warn;
foreach(<CPUINFO>) {
$isIBM = 1 if /^machine\s*:.*IBM/;
$current->{TYPE} = $1 if /cpu\s+:\s+(\S.*)/;
$current->{SPEED} = $1 if /clock\s+:\s+(\S.*)/;
$current->{SPEED} =~ s/\.[0-9]+MHz//;
if (/^\s*$/) {
if ($current->{TYPE}) {
push @cpus, $current;
}
$current = {};
}
}
if (/^\s*$/) {
if ($current->{TYPE}) {
push @cpus, $current;
}
$current = {};
}
foreach my $cpu (@cpus) {
$cpu->{MANUFACTURER} = 'IBM' if $isIBM;
$cpu->{CPUARCH} = 'PowerPC';
$common->addCPU($cpu);
}
}
1;
|