File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/BSD/i386.pm
Criterion Covered Total %
statement 15 28 53.5
branch 0 4 0.0
condition n/a
subroutine 5 7 71.4
pod 0 2 0.0
total 20 41 48.7


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::BSD::i386;
2              
3 1     1   93345189 use strict;
  1         7  
  1         50  
4 1     1   6 use warnings;
  1         6  
  1         80  
5              
6 1     1   12 use Config;
  1         54  
  1         114  
7              
8 1     1   583 use FusionInventory::Agent::Tools;
  1         2  
  1         214  
9 1     1   727 use FusionInventory::Agent::Tools::Generic;
  1         2  
  1         260  
10              
11             sub isEnabled {
12 0     0 0   return $Config{archname} =~ /^(i\d86|x86_64)/;
13             }
14              
15             sub doInventory {
16 0     0 0   my (%params) = @_;
17              
18 0           my $inventory = $params{inventory};
19 0           my $logger = $params{logger};
20              
21             # sysctl infos
22 0           my $bios = {
23             SMODEL => getFirstLine(command => 'sysctl -n hw.model')
24             };
25             my $cpu = {
26             NAME => getFirstLine(command => 'sysctl -n hw.machine'),
27 0           SPEED => (getCanonicalSpeed(split(/\s+/, $bios->{SMODEL})))[-1]
28             };
29 0           my $count = getFirstLine(command => 'sysctl -n hw.ncpu');
30              
31 0           $inventory->setBios($bios);
32              
33             # don't deal with CPUs if information can be computed from dmidecode
34 0           my $infos = getDmidecodeInfos(logger => $logger);
35 0 0         return if $infos->{4};
36              
37 0 0         return if $params{no_category}->{cpu};
38              
39 0           while ($count--) {
40 0           $inventory->addEntry(
41             section => 'CPUS',
42             entry => $cpu
43             );
44             }
45              
46             }
47              
48             1;