diff --git a/CHANGELOG.md b/CHANGELOG.md index bc33175..1b252a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.49.3 | 2018-11-20 | `memLayout()` optimized parsing (win) | | 3.49.2 | 2018-11-19 | code cleanup | | 3.49.1 | 2018-11-19 | `cpu().brand` removed extra spaces, tabs | | 3.49.0 | 2018-11-19 | added system `uuid()` (os specific), `versions()` added postgresql | diff --git a/lib/memory.js b/lib/memory.js index 70c8c80..d021d02 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -334,24 +334,24 @@ function memLayout(callback) { 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('|'); try { - exec(util.getWmic() + ' memorychip get BankLabel, Capacity, ConfiguredClockSpeed, ConfiguredVoltage, MaxVoltage, MinVoltage, DataWidth, FormFactor, Manufacturer, MemoryType, PartNumber, SerialNumber, Speed, Tag /value', util.execOptsWin, function (error, stdout) { + exec(util.getWmic() + ' memorychip get /value', util.execOptsWin, function (error, stdout) { if (!error) { let devices = stdout.toString().split('BankL'); devices.shift(); devices.forEach(function (device) { let lines = device.split('\r\n'); result.push({ - size: parseInt(util.getValue(lines, 'Capacity', '='), 10), + size: parseInt(util.getValue(lines, 'Capacity', '='), 10) || 0, bank: util.getValue(lines, 'abel', '='), // BankLabel type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', '='), 10)], - clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10), - formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10)], + clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10) || 0, + formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10) || 0], manufacturer: util.getValue(lines, 'Manufacturer', '='), partNum: util.getValue(lines, 'PartNumber', '='), serialNum: util.getValue(lines, 'SerialNumber', '='), - voltageConfigured: parseInt(util.getValue(lines, 'ConfiguredVoltage', '='), 10) / 1000.0, - voltageMin: parseInt(util.getValue(lines, 'MinVoltage', '='), 10) / 1000.0, - voltageMax: parseInt(util.getValue(lines, 'MaxVoltage', '='), 10) / 1000.0, + voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', '='), 10) || 0) / 1000.0, + voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', '='), 10) || 0) / 1000.0, + voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', '='), 10) || 0) / 1000.0, }); }); }