line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Dmidecode::Memory; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
120684394
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
65
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
532
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
190
|
|
7
|
1
|
|
|
1
|
|
523
|
use FusionInventory::Agent::Tools::Generic; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
616
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{memory}; |
12
|
0
|
|
|
|
|
|
return 1; |
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
|
0
|
|
|
|
|
|
my $memories = _getMemories(logger => $logger); |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
return unless $memories; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
foreach my $memory (@$memories) { |
26
|
0
|
|
|
|
|
|
$inventory->addEntry( |
27
|
|
|
|
|
|
|
section => 'MEMORIES', |
28
|
|
|
|
|
|
|
entry => $memory |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _getMemories { |
34
|
0
|
|
|
0
|
|
|
my $infos = getDmidecodeInfos(@_); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my ($memories, $slot); |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ($infos->{17}) { |
|
|
0
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
foreach my $info (@{$infos->{17}}) { |
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$slot++; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Flash is 'in general' an unrelated internal BIOS storage |
44
|
|
|
|
|
|
|
# See bug: #1334 |
45
|
0
|
0
|
0
|
|
|
|
next if $info->{'Type'} && $info->{'Type'} =~ /Flash/i; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $manufacturer; |
48
|
0
|
0
|
0
|
|
|
|
if ( |
49
|
|
|
|
|
|
|
$info->{'Manufacturer'} |
50
|
|
|
|
|
|
|
&& |
51
|
|
|
|
|
|
|
( $info->{'Manufacturer'} !~ / |
52
|
|
|
|
|
|
|
Manufacturer |
53
|
|
|
|
|
|
|
| |
54
|
|
|
|
|
|
|
Undefined |
55
|
|
|
|
|
|
|
| |
56
|
|
|
|
|
|
|
None |
57
|
|
|
|
|
|
|
| |
58
|
|
|
|
|
|
|
^0x |
59
|
|
|
|
|
|
|
| |
60
|
|
|
|
|
|
|
00000 |
61
|
|
|
|
|
|
|
| |
62
|
|
|
|
|
|
|
\sDIMM |
63
|
|
|
|
|
|
|
/ix ) |
64
|
|
|
|
|
|
|
) { |
65
|
0
|
|
|
|
|
|
$manufacturer = $info->{'Manufacturer'}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $memory = { |
69
|
|
|
|
|
|
|
NUMSLOTS => $slot, |
70
|
|
|
|
|
|
|
DESCRIPTION => $info->{'Form Factor'}, |
71
|
|
|
|
|
|
|
CAPTION => $info->{'Locator'}, |
72
|
|
|
|
|
|
|
SPEED => $info->{'Speed'}, |
73
|
|
|
|
|
|
|
TYPE => $info->{'Type'}, |
74
|
|
|
|
|
|
|
SERIALNUMBER => $info->{'Serial Number'}, |
75
|
|
|
|
|
|
|
MEMORYCORRECTION => $infos->{16}[0]{'Error Correction Type'}, |
76
|
|
|
|
|
|
|
MANUFACTURER => $manufacturer |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
0
|
|
|
|
if ($info->{'Size'} && $info->{'Size'} =~ /^(\d+) \s MB$/x) { |
80
|
0
|
|
|
|
|
|
$memory->{CAPACITY} = $1; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
push @$memories, $memory; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} elsif ($infos->{6}) { |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
foreach my $info (@{$infos->{6}}) { |
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$slot++; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $memory = { |
91
|
|
|
|
|
|
|
NUMSLOTS => $slot, |
92
|
|
|
|
|
|
|
TYPE => $info->{'Type'}, |
93
|
|
|
|
|
|
|
}; |
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
0
|
|
|
|
if ($info->{'Installed Size'} && $info->{'Installed Size'} =~ /^(\d+)\s*(MB|Mbyte)/x) { |
96
|
0
|
|
|
|
|
|
$memory->{CAPACITY} = $1; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
push @$memories, $memory; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return $memories; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |