bugfix cpuTemperature() - max value on windows

This commit is contained in:
Sebastian Hildebrandt 2017-10-03 09:32:30 +02:00
parent 098aba023c
commit e677113bdf
3 changed files with 7 additions and 4 deletions

View File

@ -98,6 +98,7 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 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.1 | 2017-09-21 | bugfix/typo `inetChecksite()` |
| 3.30.0 | 2017-09-21 | extended `versions()` (added `yarn`, `gulp`, `grunt`, `tsc`, `git`) |

View File

@ -158,7 +158,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
| | min | X | X | X | min CPU speed (all cores) |
| | max | X | X | X | max CPU speed (all cores) |
| si.cpuTemperature(cb) | {...} | X | X* | X | CPU temperature (if supported) |
| | main | X | X | X | main temperature |
| | main | X | X | X | main temperature (avg) |
| | cores | X | X | X | array of temperatures |
| | max | X | X | X | max temperature |
| si.mem(cb) | {...} | X | X | X | Memory information (in bytes)|

View File

@ -366,11 +366,13 @@ function cpuTemperature(callback) {
let sum = 0;
let lines = stdout.trim().split(/\s\s+/);
lines.forEach(function (line) {
if (line.match('CriticalTripPoint') && !result.max)
result.max = (parseInt(line.split('CriticalTripPoint=')[1]) - 2732) / 10;
else if (line.match('CurrentTemperature')) {
// if (line.match('CriticalTripPoint') && result.max === -1)
// 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;
if (value > result.max) result.max = value;
result.cores.push(value);
}
});