cpuTemperature() optimized parsing
This commit is contained in:
+3
-2
@@ -464,10 +464,11 @@ function cpuTemperature(callback) {
|
||||
lines.forEach(function (line) {
|
||||
let regex = /[+-]([^°]*)/g;
|
||||
let temps = line.match(regex);
|
||||
if (line.split(':')[0].toUpperCase().indexOf('PHYSICAL') !== -1) {
|
||||
let firstPart = line.split(':')[0].toUpperCase();
|
||||
if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1) {
|
||||
result.main = parseFloat(temps);
|
||||
}
|
||||
if (line.split(':')[0].toUpperCase().indexOf('CORE ') !== -1) {
|
||||
if (firstPart.indexOf('CORE ') !== -1) {
|
||||
result.cores.push(parseFloat(temps));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user