diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf3719..2c526e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.19.2 | 2020-01-19 | `cpu()` muli-processor fix windows | | 4.19.1 | 2020-01-14 | `osInfo()` uefi fix windows | | 4.19.0 | 2020-01-12 | `osInfo()` added uefi | | 4.18.3 | 2020-01-10 | `fsSize()` fix excluding loop/snap devices | diff --git a/docs/history.html b/docs/history.html index 13e2dc8..5b3c5f5 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.19.2 + 2020-01-19 + cpu() multi-processor fix windows + 4.19.1 2020-01-14 diff --git a/docs/index.html b/docs/index.html index f414e98..1b34972 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.19.1
+
Current Version: 4.19.2
diff --git a/lib/cpu.js b/lib/cpu.js index f396a95..f40d879 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -625,7 +625,7 @@ function getCpu() { result.socket = socketTypes[socketId]; } // # threads / # cores - const countProcessors = util.countUniqueLines(lines, 'Caption'); + const countProcessors = util.countLines(lines, 'Caption'); const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', '='); const countCores = util.getValue(lines, 'NumberOfCores', '='); if (countProcessors) { @@ -635,6 +635,10 @@ function getCpu() { result.cores = parseInt(countThreads) || util.cores(); result.physicalCores = parseInt(countCores) || util.cores(); } + if (countProcessors > 1) { + result.cores = result.cores * countProcessors; + result.physicalCores = result.physicalCores * countProcessors; + } } util.wmic('path Win32_CacheMemory get CacheType,InstalledSize,Purpose').then((stdout, error) => { if (!error) { diff --git a/lib/util.js b/lib/util.js index 17414c2..015764b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -450,7 +450,7 @@ function countUniqueLines(lines, startingWith) { startingWith = startingWith || ''; const uniqueLines = []; lines.forEach(line => { - if (line.indexOf(startingWith) === 0) { + if (line.startsWith(startingWith)) { if (uniqueLines.indexOf(line) === -1) { uniqueLines.push(line); } @@ -459,6 +459,17 @@ function countUniqueLines(lines, startingWith) { return uniqueLines.length; } +function countLines(lines, startingWith) { + startingWith = startingWith || ''; + const uniqueLines = []; + lines.forEach(line => { + if (line.startsWith(startingWith)) { + uniqueLines.push(line); + } + }); + return uniqueLines.length; +} + function noop() { } exports.toInt = toInt; @@ -481,6 +492,7 @@ exports.getVboxmanage = getVboxmanage; exports.powerShell = powerShell; exports.nanoSeconds = nanoSeconds; exports.countUniqueLines = countUniqueLines; +exports.countLines = countLines; exports.noop = noop; exports.isRaspberry = isRaspberry; exports.isRaspbian = isRaspbian;