memLayout() optimized parsing (win)

This commit is contained in:
Sebastian Hildebrandt 2018-11-20 20:06:57 +01:00
parent 598f921486
commit 94e3802949
2 changed files with 8 additions and 7 deletions

View File

@ -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 |

View File

@ -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,
});
});
}