line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Win32::Memory; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
78173372
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
90
|
|
4
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
119
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1258
|
use FusionInventory::Agent::Tools::Win32; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1259
|
|
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
|
0
|
my (%params) = @_; |
76
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{memory}; |
77
|
0
|
|
|
|
|
0
|
return 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub doInventory { |
81
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
foreach my $memory (_getMemories()) { |
86
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
87
|
|
|
|
|
|
|
section => 'MEMORIES', |
88
|
|
|
|
|
|
|
entry => $memory |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _getMemories { |
94
|
|
|
|
|
|
|
|
95
|
4
|
|
|
4
|
|
1671
|
my $cpt = 0; |
96
|
4
|
|
|
|
|
6
|
my @memories; |
97
|
|
|
|
|
|
|
|
98
|
4
|
|
|
|
|
24
|
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
|
7
|
|
|
|
|
6344
|
my $type = $memoryTypeVal[$object->{MemoryType}]; |
107
|
7
|
50
|
33
|
|
|
41
|
next if $type && $type eq 'ROM'; |
108
|
7
|
50
|
33
|
|
|
69
|
next if $type && $type eq 'Flash'; |
109
|
|
|
|
|
|
|
|
110
|
7
|
|
|
|
|
9
|
my $capacity; |
111
|
|
|
|
|
|
|
$capacity = $object->{Capacity} / (1024 * 1024) |
112
|
7
|
50
|
|
|
|
24
|
if $object->{Capacity}; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
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
|
7
|
50
|
|
|
|
74
|
} |
126
|
|
|
|
|
|
|
|
127
|
4
|
|
|
|
|
31
|
foreach my $object (getWMIObjects( |
128
|
|
|
|
|
|
|
class => 'Win32_PhysicalMemoryArray', |
129
|
|
|
|
|
|
|
properties => [ qw/ |
130
|
|
|
|
|
|
|
MemoryDevices SerialNumber PhysicalMemoryCorrection |
131
|
|
|
|
|
|
|
/ ] |
132
|
|
|
|
|
|
|
)) { |
133
|
|
|
|
|
|
|
|
134
|
4
|
|
|
|
|
1162
|
my $memory = $memories[$object->{MemoryDevices} - 1]; |
135
|
4
|
50
|
|
|
|
12
|
if (!$memory->{SERIALNUMBER}) { |
136
|
4
|
|
|
|
|
10
|
$memory->{SERIALNUMBER} = $object->{SerialNumber}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
4
|
50
|
|
|
|
11
|
if ($object->{PhysicalMemoryCorrection}) { |
140
|
|
|
|
|
|
|
$memory->{MEMORYCORRECTION} = |
141
|
0
|
|
|
|
|
0
|
$memoryErrorProtection[$object->{PhysicalMemoryCorrection}]; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
4
|
50
|
|
|
|
16
|
if ($memory->{MEMORYCORRECTION}) { |
145
|
0
|
|
|
|
|
0
|
$memory->{DESCRIPTION} .= " (".$memory->{MEMORYCORRECTION}.")"; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
4
|
|
|
|
|
21
|
return @memories; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |