line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::CPU; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
92609106
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
58
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
399
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
146
|
|
7
|
1
|
|
|
1
|
|
370
|
use FusionInventory::Agent::Tools::Generic; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
207
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{cpu}; |
12
|
0
|
|
|
|
|
|
return canRun('dmidecode'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $speed; |
21
|
0
|
|
|
|
|
|
my $hwModel = getFirstLine(command => 'sysctl -n hw.model'); |
22
|
0
|
0
|
|
|
|
|
if ($hwModel =~ /([\.\d]+)GHz/) { |
23
|
0
|
|
|
|
|
|
$speed = $1 * 1000; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
foreach my $cpu (getCpusFromDmidecode()) { |
27
|
0
|
|
|
|
|
|
$cpu->{SPEED} = $speed; |
28
|
0
|
|
|
|
|
|
$inventory->addEntry( |
29
|
|
|
|
|
|
|
section => 'CPUS', |
30
|
|
|
|
|
|
|
entry => $cpu |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |