bugfix cpuTemperature() - parsing values on windows
This commit is contained in:
parent
2a7a9f681b
commit
efce5e2fce
@ -98,6 +98,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.30.4 | 2017-10-03 | bugfix `cpuTemperature()` - parsing values on windows |
|
||||||
| 3.30.3 | 2017-10-03 | bugfix `cpuTemperature()` - max value on windows |
|
| 3.30.3 | 2017-10-03 | bugfix `cpuTemperature()` - max value on windows |
|
||||||
| 3.30.2 | 2017-09-26 | bugfix `networkInterfaces()` - optimized ip6 address selection |
|
| 3.30.2 | 2017-09-26 | bugfix `networkInterfaces()` - optimized ip6 address selection |
|
||||||
| 3.30.1 | 2017-09-21 | bugfix/typo `inetChecksite()` |
|
| 3.30.1 | 2017-09-21 | bugfix/typo `inetChecksite()` |
|
||||||
|
|||||||
11
lib/cpu.js
11
lib/cpu.js
@ -361,20 +361,15 @@ function cpuTemperature(callback) {
|
|||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
if (_windows) {
|
if (_windows) {
|
||||||
exec("wmic /namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint,CurrentTemperature /value", function (error, stdout) {
|
exec("wmic /namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature", function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
let lines = stdout.trim().split(/\s\s+/);
|
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
// if (line.match('CriticalTripPoint') && result.max === -1)
|
let value = (parseInt(line) - 2732) / 10;
|
||||||
// result.max = (parseInt(line.split('CriticalTripPoint=')[1]) - 2732) / 10;
|
|
||||||
// else
|
|
||||||
if (line.match('CurrentTemperature')) {
|
|
||||||
let value = (parseInt(line.split('CurrentTemperature=')[1]) - 2732) / 10;
|
|
||||||
sum = sum + value;
|
sum = sum + value;
|
||||||
if (value > result.max) result.max = value;
|
if (value > result.max) result.max = value;
|
||||||
result.cores.push(value);
|
result.cores.push(value);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (result.cores.length) {
|
if (result.cores.length) {
|
||||||
result.main = sum / result.cores.length;
|
result.main = sum / result.cores.length;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user