| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::PowerPC::CPU; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
102852356
|
use strict; |
|
|
1
|
|
|
|
|
13
|
|
|
|
1
|
|
|
|
|
94
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
9
|
|
|
|
1
|
|
|
|
|
88
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
681
|
use FusionInventory::Agent::Tools::Linux; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
451
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
|
9
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
|
10
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{cpu}; |
|
11
|
0
|
|
|
|
|
|
return -r '/proc/cpuinfo'; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub doInventory { |
|
15
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
|
18
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
foreach my $cpu (_getCPUsFromProc( |
|
21
|
|
|
|
|
|
|
logger => $logger, file => '/proc/cpuinfo' |
|
22
|
|
|
|
|
|
|
)) { |
|
23
|
0
|
|
|
|
|
|
$inventory->addEntry( |
|
24
|
|
|
|
|
|
|
section => 'CPUS', |
|
25
|
|
|
|
|
|
|
entry => $cpu |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _getCPUsFromProc { |
|
31
|
0
|
|
|
0
|
|
|
my @cpus; |
|
32
|
0
|
|
|
|
|
|
foreach my $cpu (getCPUsFromProc(@_)) { |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $speed; |
|
35
|
0
|
0
|
0
|
|
|
|
if ( |
|
36
|
|
|
|
|
|
|
$cpu->{clock} && |
|
37
|
|
|
|
|
|
|
$cpu->{clock} =~ /(\d+)/ |
|
38
|
|
|
|
|
|
|
) { |
|
39
|
0
|
|
|
|
|
|
$speed = $1; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $manufacturer; |
|
43
|
0
|
0
|
0
|
|
|
|
if ($cpu->{machine} && |
|
44
|
|
|
|
|
|
|
$cpu->{machine} =~ /IBM/ |
|
45
|
|
|
|
|
|
|
) { |
|
46
|
0
|
|
|
|
|
|
$manufacturer = 'IBM'; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
push @cpus, { |
|
50
|
|
|
|
|
|
|
ARCH => 'PowerPC', |
|
51
|
|
|
|
|
|
|
NAME => $cpu->{cpu}, |
|
52
|
|
|
|
|
|
|
MANUFACTURER => $manufacturer, |
|
53
|
|
|
|
|
|
|
SPEED => $speed |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return @cpus; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |