cpu() muli-processor fix windows

This commit is contained in:
Sebastian Hildebrandt 2020-01-19 21:08:56 +01:00
parent 544b60f1b0
commit 8e9e4042b2
5 changed files with 25 additions and 3 deletions

View File

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

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.19.2</th>
<td>2020-01-19</td>
<td><span class="code">cpu()</span> multi-processor fix windows</td>
</tr>
<tr>
<th scope="row">4.19.1</th>
<td>2020-01-14</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.19.1</span></div>
<div class="version">Current Version: <span id="version">4.19.2</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

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

View File

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