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