getCpu() fix physicalCores (linux)

This commit is contained in:
Sebastian Hildebrandt
2019-10-14 16:31:24 +02:00
parent 6821fc4374
commit 1e2522a095
6 changed files with 9 additions and 33 deletions
-25
View File
@@ -336,31 +336,6 @@ function getCpu() {
result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim();
}
resolve(result);
// // # processurs & # threads/core - method 1
// let threadsPerCoreInt = 0;
// let lines3 = [];
// exec('cat /proc/cpuinfo | grep -E "physical id|core id"', function (error2, stdout3) {
// lines3 = stdout3.toString().split('\n');
// if (lines3 && lines3.length) {
// result.processors = util.countUniqueLines(lines3, 'physical id') || 1;
// result.physicalCores = util.countLinesStartingWith(lines3, 'core id') / result.processors;
// if (result.physicalCores) {
// threadsPerCoreInt = result.cores / result.physicalCores;
// }
// }
// // # threads/core - method 2
// if (threadsPerCoreInt === 0) {
// const threadsPerCore = util.getValue(lines, 'thread(s) per core');
// if (threadsPerCore) {
// threadsPerCoreInt = parseInt(threadsPerCore, 10);
// if (!isNaN(threadsPerCoreInt)) {
// result.physicalCores = result.cores / threadsPerCoreInt;
// }
// }
// }
// resolve(result);
// });
});
});
}
-5
View File
@@ -455,11 +455,6 @@ function countUniqueLines(lines, startingWith) {
return uniqueLines.length;
}
// function countLinesStartingWith(lines, startingWith) {
// startingWith = startingWith || '';
// return lines.filter(el => el.startsWith(startingWith)).length;
// }
function noop() { }
exports.toInt = toInt;