line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Alpha::CPU; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
115679204
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
399
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
248
|
|
7
|
2
|
|
|
2
|
|
459
|
use FusionInventory::Agent::Tools::Linux; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
411
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{cpu}; |
12
|
0
|
|
|
|
|
0
|
return -r '/proc/cpuinfo'; |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
foreach my $cpu (_getCPUsFromProc( |
22
|
|
|
|
|
|
|
logger => $logger, file => '/proc/cpuinfo') |
23
|
|
|
|
|
|
|
) { |
24
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
25
|
|
|
|
|
|
|
section => 'CPUS', |
26
|
|
|
|
|
|
|
entry => $cpu |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _getCPUsFromProc { |
32
|
1
|
|
|
1
|
|
194
|
my @cpus; |
33
|
1
|
|
|
|
|
3
|
foreach my $cpu (getCPUsFromProc(@_)) { |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
1
|
my $speed; |
36
|
1
|
50
|
33
|
|
|
10
|
if ( |
37
|
|
|
|
|
|
|
$cpu->{'cycle frequency [hz]'} && |
38
|
|
|
|
|
|
|
$cpu->{'cycle frequency [hz]'} =~ /(\d+)000000/ |
39
|
|
|
|
|
|
|
) { |
40
|
1
|
|
|
|
|
2
|
$speed = $1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
push @cpus, { |
44
|
|
|
|
|
|
|
ARCH => 'Alpha', |
45
|
|
|
|
|
|
|
NAME => $cpu->{processor}, |
46
|
1
|
|
|
|
|
6
|
SERIAL => $cpu->{'cpu serial number'}, |
47
|
|
|
|
|
|
|
SPEED => $speed |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
6
|
return @cpus; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |