sysiddr5 1.0.1-beta-3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sysiddr5 might be problematic. Click here for more details.

package/lib/memory.js ADDED
@@ -0,0 +1,559 @@
1
+ 'use strict';
2
+ // @ts-check
3
+ // ==================================================================================
4
+ // memory.js
5
+ // ----------------------------------------------------------------------------------
6
+ // Description: System Information - library
7
+ // for Node.js
8
+ // Copyright: (c) 2014 - 2023
9
+ // Author: Sebastian Hildebrandt
10
+ // ----------------------------------------------------------------------------------
11
+ // License: MIT
12
+ // ==================================================================================
13
+ // 5. Memory
14
+ // ----------------------------------------------------------------------------------
15
+
16
+ const os = require('os');
17
+ const exec = require('child_process').exec;
18
+ const execSync = require('child_process').execSync;
19
+ const util = require('./util');
20
+ const fs = require('fs');
21
+
22
+ let _platform = process.platform;
23
+
24
+ const _linux = (_platform === 'linux' || _platform === 'android');
25
+ const _darwin = (_platform === 'darwin');
26
+ const _windows = (_platform === 'win32');
27
+ const _freebsd = (_platform === 'freebsd');
28
+ const _openbsd = (_platform === 'openbsd');
29
+ const _netbsd = (_platform === 'netbsd');
30
+ const _sunos = (_platform === 'sunos');
31
+
32
+ const OSX_RAM_manufacturers = {
33
+ '0x014F': 'Transcend Information',
34
+ '0x2C00': 'Micron Technology Inc.',
35
+ '0x802C': 'Micron Technology Inc.',
36
+ '0x80AD': 'Hynix Semiconductor Inc.',
37
+ '0x80CE': 'Samsung Electronics Inc.',
38
+ '0xAD00': 'Hynix Semiconductor Inc.',
39
+ '0xCE00': 'Samsung Electronics Inc.',
40
+ '0x02FE': 'Elpida',
41
+ '0x5105': 'Qimonda AG i. In.',
42
+ '0x8551': 'Qimonda AG i. In.',
43
+ '0x859B': 'Crucial',
44
+ '0x04CD': 'G-Skill'
45
+ };
46
+
47
+ const LINUX_RAM_manufacturers = {
48
+ '017A': 'Apacer',
49
+ '0198': 'HyperX',
50
+ '029E': 'Corsair',
51
+ '04CB': 'A-DATA',
52
+ '04CD': 'G-Skill',
53
+ '059B': 'Crucial',
54
+ '00CE': 'Samsung',
55
+ '1315': 'Crutial',
56
+ '014F': 'Transcend Information',
57
+ '2C00': 'Micron Technology Inc.',
58
+ '802C': 'Micron Technology Inc.',
59
+ '80AD': 'Hynix Semiconductor Inc.',
60
+ '80CE': 'Samsung Electronics Inc.',
61
+ 'AD00': 'Hynix Semiconductor Inc.',
62
+ 'CE00': 'Samsung Electronics Inc.',
63
+ '02FE': 'Elpida',
64
+ '5105': 'Qimonda AG i. In.',
65
+ '8551': 'Qimonda AG i. In.',
66
+ '859B': 'Crucial'
67
+ };
68
+
69
+ // _______________________________________________________________________________________
70
+ // | R A M | H D |
71
+ // |______________________|_________________________| | |
72
+ // | active buffers/cache | | |
73
+ // |________________________________________________|___________|_________|______________|
74
+ // | used free | used free |
75
+ // |____________________________________________________________|________________________|
76
+ // | total | swap |
77
+ // |____________________________________________________________|________________________|
78
+
79
+ // free (older versions)
80
+ // ----------------------------------
81
+ // # free
82
+ // total used free shared buffers cached
83
+ // Mem: 16038 (1) 15653 (2) 384 (3) 0 (4) 236 (5) 14788 (6)
84
+ // -/+ buffers/cache: 628 (7) 15409 (8)
85
+ // Swap: 16371 83 16288
86
+ //
87
+ // |------------------------------------------------------------|
88
+ // | R A M |
89
+ // |______________________|_____________________________________|
90
+ // | active (2-(5+6) = 7) | available (3+5+6 = 8) |
91
+ // |______________________|_________________________|___________|
92
+ // | active | buffers/cache (5+6) | |
93
+ // |________________________________________________|___________|
94
+ // | used (2) | free (3) |
95
+ // |____________________________________________________________|
96
+ // | total (1) |
97
+ // |____________________________________________________________|
98
+
99
+ //
100
+ // free (since free von procps-ng 3.3.10)
101
+ // ----------------------------------
102
+ // # free
103
+ // total used free shared buffers/cache available
104
+ // Mem: 16038 (1) 628 (2) 386 (3) 0 (4) 15024 (5) 14788 (6)
105
+ // Swap: 16371 83 16288
106
+ //
107
+ // |------------------------------------------------------------|
108
+ // | R A M |
109
+ // |______________________|_____________________________________|
110
+ // | | available (6) estimated |
111
+ // |______________________|_________________________|___________|
112
+ // | active (2) | buffers/cache (5) | free (3) |
113
+ // |________________________________________________|___________|
114
+ // | total (1) |
115
+ // |____________________________________________________________|
116
+ //
117
+ // Reference: http://www.software-architect.net/blog/article/date/2015/06/12/-826c6e5052.html
118
+
119
+ // /procs/meminfo - sample (all in kB)
120
+ //
121
+ // MemTotal: 32806380 kB
122
+ // MemFree: 17977744 kB
123
+ // MemAvailable: 19768972 kB
124
+ // Buffers: 517028 kB
125
+ // Cached: 2161876 kB
126
+ // SwapCached: 456 kB
127
+ // Active: 12081176 kB
128
+ // Inactive: 2164616 kB
129
+ // Active(anon): 10832884 kB
130
+ // Inactive(anon): 1477272 kB
131
+ // Active(file): 1248292 kB
132
+ // Inactive(file): 687344 kB
133
+ // Unevictable: 0 kB
134
+ // Mlocked: 0 kB
135
+ // SwapTotal: 16768892 kB
136
+ // SwapFree: 16768304 kB
137
+ // Dirty: 268 kB
138
+ // Writeback: 0 kB
139
+ // AnonPages: 11568832 kB
140
+ // Mapped: 719992 kB
141
+ // Shmem: 743272 kB
142
+ // Slab: 335716 kB
143
+ // SReclaimable: 256364 kB
144
+ // SUnreclaim: 79352 kB
145
+
146
+ function mem(callback) {
147
+
148
+ return new Promise((resolve) => {
149
+ process.nextTick(() => {
150
+
151
+ let result = {
152
+ total: os.totalmem(),
153
+ free: os.freemem(),
154
+ used: os.totalmem() - os.freemem(),
155
+
156
+ active: os.totalmem() - os.freemem(), // temporarily (fallback)
157
+ available: os.freemem(), // temporarily (fallback)
158
+ buffers: 0,
159
+ cached: 0,
160
+ slab: 0,
161
+ buffcache: 0,
162
+
163
+ swaptotal: 0,
164
+ swapused: 0,
165
+ swapfree: 0
166
+ };
167
+
168
+ if (_linux) {
169
+ fs.readFile('/proc/meminfo', function (error, stdout) {
170
+ if (!error) {
171
+ const lines = stdout.toString().split('\n');
172
+ result.total = parseInt(util.getValue(lines, 'memtotal'), 10);
173
+ result.total = result.total ? result.total * 1024 : os.totalmem();
174
+ result.free = parseInt(util.getValue(lines, 'memfree'), 10);
175
+ result.free = result.free ? result.free * 1024 : os.freemem();
176
+ result.used = result.total - result.free;
177
+
178
+ result.buffers = parseInt(util.getValue(lines, 'buffers'), 10);
179
+ result.buffers = result.buffers ? result.buffers * 1024 : 0;
180
+ result.cached = parseInt(util.getValue(lines, 'cached'), 10);
181
+ result.cached = result.cached ? result.cached * 1024 : 0;
182
+ result.slab = parseInt(util.getValue(lines, 'slab'), 10);
183
+ result.slab = result.slab ? result.slab * 1024 : 0;
184
+ result.buffcache = result.buffers + result.cached + result.slab;
185
+
186
+ let available = parseInt(util.getValue(lines, 'memavailable'), 10);
187
+ result.available = available ? available * 1024 : result.free + result.buffcache;
188
+ result.active = result.total - result.available;
189
+
190
+ result.swaptotal = parseInt(util.getValue(lines, 'swaptotal'), 10);
191
+ result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0;
192
+ result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10);
193
+ result.swapfree = result.swapfree ? result.swapfree * 1024 : 0;
194
+ result.swapused = result.swaptotal - result.swapfree;
195
+ }
196
+ if (callback) { callback(result); }
197
+ resolve(result);
198
+ });
199
+ }
200
+ if (_freebsd || _openbsd || _netbsd) {
201
+ exec('/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size', function (error, stdout) {
202
+ if (!error) {
203
+ let lines = stdout.toString().split('\n');
204
+ const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
205
+ const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
206
+ const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
207
+
208
+ result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
209
+ if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
210
+ result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
211
+ result.buffcache = inactive + cache;
212
+ result.available = result.buffcache + result.free;
213
+ result.active = result.total - result.free - result.buffcache;
214
+
215
+ result.swaptotal = 0;
216
+ result.swapfree = 0;
217
+ result.swapused = 0;
218
+
219
+ }
220
+ if (callback) { callback(result); }
221
+ resolve(result);
222
+ });
223
+ }
224
+ if (_sunos) {
225
+ if (callback) { callback(result); }
226
+ resolve(result);
227
+ }
228
+ if (_darwin) {
229
+ let pageSize = 4096;
230
+ try {
231
+ let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString());
232
+ pageSize = sysPpageSize || pageSize;
233
+ } catch (e) {
234
+ util.noop();
235
+ }
236
+ exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) {
237
+ if (!error) {
238
+ let lines = stdout.toString().split('\n');
239
+
240
+ result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
241
+ result.buffcache = result.used - result.active;
242
+ result.available = result.free + result.buffcache;
243
+ }
244
+ exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) {
245
+ if (!error) {
246
+ let lines = stdout.toString().split('\n');
247
+ if (lines.length > 0) {
248
+ let firstline = lines[0].replace(/,/g, '.').replace(/M/g, '');
249
+ let lineArray = firstline.trim().split(' ');
250
+ lineArray.forEach(line => {
251
+ if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
252
+ if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
253
+ if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
254
+ });
255
+ }
256
+ }
257
+ if (callback) { callback(result); }
258
+ resolve(result);
259
+ });
260
+ });
261
+ }
262
+ if (_windows) {
263
+ let swaptotal = 0;
264
+ let swapused = 0;
265
+ try {
266
+ util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
267
+ if (!error) {
268
+ let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
269
+ lines.forEach(function (line) {
270
+ if (line !== '') {
271
+ line = line.trim().split(/\s\s+/);
272
+ swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
273
+ swapused = swapused + (parseInt(line[1], 10) || 0);
274
+ }
275
+ });
276
+ }
277
+ result.swaptotal = swaptotal * 1024 * 1024;
278
+ result.swapused = swapused * 1024 * 1024;
279
+ result.swapfree = result.swaptotal - result.swapused;
280
+
281
+ if (callback) { callback(result); }
282
+ resolve(result);
283
+ });
284
+ } catch (e) {
285
+ if (callback) { callback(result); }
286
+ resolve(result);
287
+ }
288
+ }
289
+ });
290
+ });
291
+ }
292
+
293
+ exports.mem = mem;
294
+
295
+ function memLayout(callback) {
296
+
297
+ function getManufacturerDarwin(manId) {
298
+ if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) {
299
+ return (OSX_RAM_manufacturers[manId]);
300
+ }
301
+ return manId;
302
+ }
303
+
304
+ function getManufacturerLinux(manId) {
305
+ const manIdSearch = manId.replace('0x', '').toUpperCase();
306
+ if (manIdSearch.length === 4 && {}.hasOwnProperty.call(LINUX_RAM_manufacturers, manIdSearch)) {
307
+ return (LINUX_RAM_manufacturers[manIdSearch]);
308
+ }
309
+ return manId;
310
+ }
311
+
312
+ return new Promise((resolve) => {
313
+ process.nextTick(() => {
314
+
315
+ let result = [];
316
+
317
+ if (_linux || _freebsd || _openbsd || _netbsd) {
318
+ exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) {
319
+ if (!error) {
320
+ let devices = stdout.toString().split('Memory Device');
321
+ devices.shift();
322
+ devices.forEach(function (device) {
323
+ let lines = device.split('\n');
324
+ const sizeString = util.getValue(lines, 'Size');
325
+ const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
326
+ let bank = util.getValue(lines, 'Bank Locator');
327
+ if (bank.toLowerCase().indexOf('bad') >= 0) {
328
+ bank = '';
329
+ }
330
+ if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
331
+ const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
332
+ const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
333
+ result.push({
334
+ size,
335
+ bank,
336
+ type: util.getValue(lines, 'Type:'),
337
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
338
+ clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)),
339
+ formFactor: util.getValue(lines, 'Form Factor:'),
340
+ manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
341
+ partNum: util.getValue(lines, 'Part Number:'),
342
+ serialNum: util.getValue(lines, 'Serial Number:'),
343
+ voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
344
+ voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
345
+ voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null,
346
+ });
347
+ } else {
348
+ result.push({
349
+ size: 0,
350
+ bank,
351
+ type: 'Empty',
352
+ ecc: null,
353
+ clockSpeed: 0,
354
+ formFactor: util.getValue(lines, 'Form Factor:'),
355
+ partNum: '',
356
+ serialNum: '',
357
+ voltageConfigured: null,
358
+ voltageMin: null,
359
+ voltageMax: null,
360
+ });
361
+ }
362
+ });
363
+ }
364
+ if (!result.length) {
365
+ result.push({
366
+ size: os.totalmem(),
367
+ bank: '',
368
+ type: '',
369
+ ecc: null,
370
+ clockSpeed: 0,
371
+ formFactor: '',
372
+ partNum: '',
373
+ serialNum: '',
374
+ voltageConfigured: null,
375
+ voltageMin: null,
376
+ voltageMax: null,
377
+ });
378
+
379
+ // Try Raspberry PI
380
+ try {
381
+ let stdout = execSync('cat /proc/cpuinfo 2>/dev/null');
382
+ let lines = stdout.toString().split('\n');
383
+ let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
384
+ let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
385
+
386
+ if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') {
387
+
388
+ const clockSpeed = {
389
+ '0': 400,
390
+ '1': 450,
391
+ '2': 450,
392
+ '3': 3200
393
+ };
394
+ result[0].type = 'LPDDR2';
395
+ result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
396
+ result[0].ecc = false;
397
+ result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
398
+ result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
399
+ result[0].formFactor = 'SoC';
400
+
401
+ stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
402
+ lines = stdout.toString().split('\n');
403
+ let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
404
+ if (freq) {
405
+ result[0].clockSpeed = freq;
406
+ }
407
+
408
+ stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
409
+ lines = stdout.toString().split('\n');
410
+ let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
411
+ if (voltage) {
412
+ result[0].voltageConfigured = voltage;
413
+ result[0].voltageMin = voltage;
414
+ result[0].voltageMax = voltage;
415
+ }
416
+ }
417
+ } catch (e) {
418
+ util.noop();
419
+ }
420
+
421
+ }
422
+ if (callback) { callback(result); }
423
+ resolve(result);
424
+ });
425
+ }
426
+
427
+ if (_darwin) {
428
+ exec('system_profiler SPMemoryDataType', function (error, stdout) {
429
+ if (!error) {
430
+ const allLines = stdout.toString().split('\n');
431
+ const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
432
+ let devices = stdout.toString().split(' BANK ');
433
+ let hasBank = true;
434
+ if (devices.length === 1) {
435
+ devices = stdout.toString().split(' DIMM');
436
+ hasBank = false;
437
+ }
438
+ devices.shift();
439
+ devices.forEach(function (device) {
440
+ let lines = device.split('\n');
441
+ const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0];
442
+ const size = parseInt(util.getValue(lines, ' Size'));
443
+ if (size) {
444
+ result.push({
445
+ size: size * 1024 * 1024 * 1024,
446
+ bank: bank,
447
+ type: util.getValue(lines, ' Type:'),
448
+ ecc: eccStatus ? eccStatus === 'enabled' : null,
449
+ clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10),
450
+ formFactor: '',
451
+ manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')),
452
+ partNum: util.getValue(lines, ' Part Number:'),
453
+ serialNum: util.getValue(lines, ' Serial Number:'),
454
+ voltageConfigured: null,
455
+ voltageMin: null,
456
+ voltageMax: null,
457
+ });
458
+ } else {
459
+ result.push({
460
+ size: 0,
461
+ bank: bank,
462
+ type: 'Empty',
463
+ ecc: null,
464
+ clockSpeed: 0,
465
+ formFactor: '',
466
+ manufacturer: '',
467
+ partNum: '',
468
+ serialNum: '',
469
+ voltageConfigured: null,
470
+ voltageMin: null,
471
+ voltageMax: null,
472
+ });
473
+ }
474
+ });
475
+ }
476
+ if (!result.length) {
477
+ const lines = stdout.toString().split('\n');
478
+ const size = parseInt(util.getValue(lines, ' Memory:'));
479
+ const type = util.getValue(lines, ' Type:');
480
+ if (size && type) {
481
+ result.push({
482
+ size: size * 1024 * 1024 * 1024,
483
+ bank: '0',
484
+ type,
485
+ ecc: false,
486
+ clockSpeed: 0,
487
+ formFactor: '',
488
+ manufacturer: 'Apple',
489
+ partNum: '',
490
+ serialNum: '',
491
+ voltageConfigured: null,
492
+ voltageMin: null,
493
+ voltageMax: null,
494
+ });
495
+
496
+ }
497
+ }
498
+ if (callback) { callback(result); }
499
+ resolve(result);
500
+ });
501
+ }
502
+ if (_sunos) {
503
+ if (callback) { callback(result); }
504
+ resolve(result);
505
+ }
506
+ if (_windows) {
507
+ const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4'.split('|');
508
+ const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
509
+
510
+ try {
511
+ util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage | fl').then((stdout, error) => {
512
+ if (!error) {
513
+ let devices = stdout.toString().split(/\n\s*\n/);
514
+ devices.shift();
515
+ devices.forEach(function (device) {
516
+ let lines = device.split('\r\n');
517
+ let replacementType;
518
+ if (parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10) === 34) {
519
+ if (parseInt(util.getValue(lines, 'FormFactor', ':'), 10) === 'SODIMM') {
520
+ replacementType = 'LPDDR5'
521
+ } else {
522
+ replacementType = 'DDR5'
523
+ }
524
+ };
525
+ const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
526
+ const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
527
+ const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
528
+ if (size) {
529
+ result.push({
530
+ size,
531
+ bank: util.getValue(lines, 'BankLabel', ':'), // BankLabel
532
+ type: replacementType || memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
533
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
534
+ clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
535
+ formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
536
+ manufacturer: util.getValue(lines, 'Manufacturer', ':'),
537
+ partNum: util.getValue(lines, 'PartNumber', ':'),
538
+ serialNum: util.getValue(lines, 'SerialNumber', ':'),
539
+ voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
540
+ voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
541
+ voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
542
+ });
543
+ }
544
+ });
545
+ }
546
+ if (callback) { callback(result); }
547
+ resolve(result);
548
+ });
549
+ } catch (e) {
550
+ if (callback) { callback(result); }
551
+ resolve(result);
552
+ }
553
+ }
554
+ });
555
+ });
556
+ }
557
+
558
+ exports.memLayout = memLayout;
559
+