line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::CPU; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
83593337
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
72
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
59
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
410
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
156
|
|
7
|
1
|
|
|
1
|
|
450
|
use FusionInventory::Agent::Tools::Generic; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
262
|
|
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; |