cpuTemperature() optimized parsing
This commit is contained in:
parent
796c31aa8d
commit
bb58e99ffe
@ -100,6 +100,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.42.9 | 2018-08-08 | `cpuTemperature()` optimized parsing |
|
||||||
| 3.42.8 | 2018-08-03 | updated docs |
|
| 3.42.8 | 2018-08-03 | updated docs |
|
||||||
| 3.42.7 | 2018-08-03 | `processes()` optimized parsing ps name |
|
| 3.42.7 | 2018-08-03 | `processes()` optimized parsing ps name |
|
||||||
| 3.42.6 | 2018-08-03 | `processes()` bugfix parsing ps linux |
|
| 3.42.6 | 2018-08-03 | `processes()` bugfix parsing ps linux |
|
||||||
|
|||||||
@ -564,6 +564,7 @@ Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebra
|
|||||||
- Adam Reis [adamreisnz](https://github.com/adamreisnz)
|
- Adam Reis [adamreisnz](https://github.com/adamreisnz)
|
||||||
- Jimi M [ItsJimi](https://github.com/ItsJimi)
|
- Jimi M [ItsJimi](https://github.com/ItsJimi)
|
||||||
- Git² [GitSquared](https://github.com/GitSquared)
|
- Git² [GitSquared](https://github.com/GitSquared)
|
||||||
|
- weiyin [weiyin](https://github.com/weiyin)
|
||||||
|
|
||||||
OSX Temperature: credits here are going to:
|
OSX Temperature: credits here are going to:
|
||||||
|
|
||||||
|
|||||||
@ -464,10 +464,11 @@ function cpuTemperature(callback) {
|
|||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
let regex = /[+-]([^°]*)/g;
|
let regex = /[+-]([^°]*)/g;
|
||||||
let temps = line.match(regex);
|
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);
|
result.main = parseFloat(temps);
|
||||||
}
|
}
|
||||||
if (line.split(':')[0].toUpperCase().indexOf('CORE ') !== -1) {
|
if (firstPart.indexOf('CORE ') !== -1) {
|
||||||
result.cores.push(parseFloat(temps));
|
result.cores.push(parseFloat(temps));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user