line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Win32::Memory; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
57975517
|
use strict; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
110
|
|
4
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
108
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
639
|
use FusionInventory::Agent::Tools::Win32; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
395
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $runMeIfTheseChecksFailed = |
9
|
|
|
|
|
|
|
["FusionInventory::Agent::Task::Inventory::Generic::Dmidecode"]; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @formFactorVal = qw/ |
12
|
|
|
|
|
|
|
Unknown |
13
|
|
|
|
|
|
|
Other |
14
|
|
|
|
|
|
|
SIP |
15
|
|
|
|
|
|
|
DIP |
16
|
|
|
|
|
|
|
ZIP |
17
|
|
|
|
|
|
|
SOJ |
18
|
|
|
|
|
|
|
Proprietary |
19
|
|
|
|
|
|
|
SIMM |
20
|
|
|
|
|
|
|
DIMM |
21
|
|
|
|
|
|
|
TSOP |
22
|
|
|
|
|
|
|
PGA |
23
|
|
|
|
|
|
|
RIMM |
24
|
|
|
|
|
|
|
SODIMM |
25
|
|
|
|
|
|
|
SRIMM |
26
|
|
|
|
|
|
|
SMD |
27
|
|
|
|
|
|
|
SSMP |
28
|
|
|
|
|
|
|
QFP |
29
|
|
|
|
|
|
|
TQFP |
30
|
|
|
|
|
|
|
SOIC |
31
|
|
|
|
|
|
|
LCC |
32
|
|
|
|
|
|
|
PLCC |
33
|
|
|
|
|
|
|
BGA |
34
|
|
|
|
|
|
|
FPBGA |
35
|
|
|
|
|
|
|
LGA |
36
|
|
|
|
|
|
|
/; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my @memoryTypeVal = qw/ |
39
|
|
|
|
|
|
|
Unknown |
40
|
|
|
|
|
|
|
Other |
41
|
|
|
|
|
|
|
DRAM |
42
|
|
|
|
|
|
|
Synchronous DRAM |
43
|
|
|
|
|
|
|
Cache DRAM |
44
|
|
|
|
|
|
|
EDO |
45
|
|
|
|
|
|
|
EDRAM |
46
|
|
|
|
|
|
|
VRAM |
47
|
|
|
|
|
|
|
SRAM |
48
|
|
|
|
|
|
|
RAM |
49
|
|
|
|
|
|
|
ROM |
50
|
|
|
|
|
|
|
Flash |
51
|
|
|
|
|
|
|
EEPROM |
52
|
|
|
|
|
|
|
FEPROM |
53
|
|
|
|
|
|
|
EPROM |
54
|
|
|
|
|
|
|
CDRAM |
55
|
|
|
|
|
|
|
3DRAM |
56
|
|
|
|
|
|
|
SDRAM |
57
|
|
|
|
|
|
|
SGRAM |
58
|
|
|
|
|
|
|
RDRAM |
59
|
|
|
|
|
|
|
DDR |
60
|
|
|
|
|
|
|
DDR-2 |
61
|
|
|
|
|
|
|
/; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @memoryErrorProtection = ( |
64
|
|
|
|
|
|
|
undef, |
65
|
|
|
|
|
|
|
'Other', |
66
|
|
|
|
|
|
|
undef, |
67
|
|
|
|
|
|
|
'None', |
68
|
|
|
|
|
|
|
'Parity', |
69
|
|
|
|
|
|
|
'Single-bit ECC', |
70
|
|
|
|
|
|
|
'Multi-bit ECC', |
71
|
|
|
|
|
|
|
'CRC', |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub isEnabled { |
75
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
76
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{memory}; |
77
|
0
|
|
|
|
|
|
return 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub doInventory { |
81
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
foreach my $memory (_getMemories()) { |
86
|
0
|
|
|
|
|
|
$inventory->addEntry( |
87
|
|
|
|
|
|
|
section => 'MEMORIES', |
88
|
|
|
|
|
|
|
entry => $memory |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _getMemories { |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
0
|
|
|
my $cpt = 0; |
96
|
0
|
|
|
|
|
|
my @memories; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
99
|
|
|
|
|
|
|
class => 'Win32_PhysicalMemory', |
100
|
|
|
|
|
|
|
properties => [ qw/ |
101
|
|
|
|
|
|
|
Capacity Caption Description FormFactor Removable Speed MemoryType |
102
|
|
|
|
|
|
|
SerialNumber |
103
|
|
|
|
|
|
|
/ ] |
104
|
|
|
|
|
|
|
)) { |
105
|
|
|
|
|
|
|
# Ignore ROM storages (BIOS ROM) |
106
|
0
|
|
|
|
|
|
my $type = $memoryTypeVal[$object->{MemoryType}]; |
107
|
0
|
0
|
0
|
|
|
|
next if $type && $type eq 'ROM'; |
108
|
0
|
0
|
0
|
|
|
|
next if $type && $type eq 'Flash'; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $capacity; |
111
|
0
|
0
|
|
|
|
|
$capacity = $object->{Capacity} / (1024 * 1024) |
112
|
|
|
|
|
|
|
if $object->{Capacity}; |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
push @memories, { |
115
|
|
|
|
|
|
|
CAPACITY => $capacity, |
116
|
|
|
|
|
|
|
CAPTION => $object->{Caption}, |
117
|
|
|
|
|
|
|
DESCRIPTION => $object->{Description}, |
118
|
|
|
|
|
|
|
FORMFACTOR => $formFactorVal[$object->{FormFactor}], |
119
|
|
|
|
|
|
|
REMOVABLE => $object->{Removable} ? 1 : 0, |
120
|
|
|
|
|
|
|
SPEED => $object->{Speed}, |
121
|
|
|
|
|
|
|
TYPE => $memoryTypeVal[$object->{MemoryType}], |
122
|
|
|
|
|
|
|
NUMSLOTS => $cpt++, |
123
|
|
|
|
|
|
|
SERIALNUMBER => $object->{SerialNumber} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
128
|
|
|
|
|
|
|
class => 'Win32_PhysicalMemoryArray', |
129
|
|
|
|
|
|
|
properties => [ qw/ |
130
|
|
|
|
|
|
|
MemoryDevices SerialNumber PhysicalMemoryCorrection |
131
|
|
|
|
|
|
|
/ ] |
132
|
|
|
|
|
|
|
)) { |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $memory = $memories[$object->{MemoryDevices} - 1]; |
135
|
0
|
0
|
|
|
|
|
if (!$memory->{SERIALNUMBER}) { |
136
|
0
|
|
|
|
|
|
$memory->{SERIALNUMBER} = $object->{SerialNumber}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
if ($object->{PhysicalMemoryCorrection}) { |
140
|
0
|
|
|
|
|
|
$memory->{MEMORYCORRECTION} = |
141
|
|
|
|
|
|
|
$memoryErrorProtection[$object->{PhysicalMemoryCorrection}]; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
|
if ($memory->{MEMORYCORRECTION}) { |
145
|
0
|
|
|
|
|
|
$memory->{DESCRIPTION} .= " (".$memory->{MEMORYCORRECTION}.")"; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return @memories; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |