line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::ARM::CPU; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
134720438
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
162
|
|
4
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
148
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1131
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
393
|
|
7
|
2
|
|
|
2
|
|
716
|
use FusionInventory::Agent::Tools::Linux; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
562
|
|
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
|
3
|
|
|
3
|
|
839
|
my @cpus; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# https://github.com/joyent/libuv/issues/812 |
35
|
3
|
|
|
|
|
11
|
foreach my $cpu (getCPUsFromProc(@_)) { |
36
|
|
|
|
|
|
|
push @cpus, { |
37
|
|
|
|
|
|
|
ARCH => 'ARM', |
38
|
|
|
|
|
|
|
NAME => $cpu->{'model name'} || $cpu->{processor} |
39
|
3
|
|
66
|
|
|
20
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
18
|
return @cpus; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |