getCpu() fix physicalCores (linux)
This commit is contained in:
-25
@@ -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);
|
||||
// });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user