minor cpuTemperature fix (OSX)

This commit is contained in:
Sebastian Hildebrandt 2017-01-17 18:32:13 +01:00
parent 60bbc43d42
commit 7a3b36f90e
5 changed files with 21 additions and 8 deletions

View File

@ -94,6 +94,8 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.15.1 | 2017-01-17 | minor cpuTemperature fix (OSX) |
| 3.15.0 | 2017-01-15 | added cpuTemperature also for OSX |
| 3.14.0 | 2017-01-14 | added currentLoad per cpu/core, cpu cache and cpu flags | | 3.14.0 | 2017-01-14 | added currentLoad per cpu/core, cpu cache and cpu flags |
| 3.13.0 | 2016-11-23 | added shell (returns standard shell) | | 3.13.0 | 2016-11-23 | added shell (returns standard shell) |
| 3.12.0 | 2016-11-17 | refactoring and extended currentLoad | | 3.12.0 | 2016-11-17 | refactoring and extended currentLoad |

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014-2016 Sebastian Hildebrandt Copyright (c) 2014-2017 Sebastian Hildebrandt
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@ -382,6 +382,11 @@ Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebra
- Quentin Busuttil [Buzut](https://github.com/Buzut) - Quentin Busuttil [Buzut](https://github.com/Buzut)
- lapsio [lapsio](https://github.com/lapsio) - lapsio [lapsio](https://github.com/lapsio)
OSX Temperature: Credits here are going to:
- Massimiliano Marcon [mmarcon](https://github.com/mmarcon) - for his work on [smc-code][smc-code-url]
- Sébastien Lavoie[lavoiesl](https://github.com/lavoiesl) for his work on [osx-cpu-temp][osx-cpu-temp-url] code.
## Copyright Information ## Copyright Information
Linux is a registered trademark of Linus Torvalds, OS X is a registered trademark of Apple Inc., Linux is a registered trademark of Linus Torvalds, OS X is a registered trademark of Apple Inc.,
@ -394,7 +399,7 @@ All other trademarks are the property of their respective owners.
>The [`MIT`][license-url] License (MIT) >The [`MIT`][license-url] License (MIT)
> >
>Copyright © 2014-2016 Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com). >Copyright © 2014-2017 Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com).
> >
>Permission is hereby granted, free of charge, to any person obtaining a copy >Permission is hereby granted, free of charge, to any person obtaining a copy
>of this software and associated documentation files (the "Software"), to deal >of this software and associated documentation files (the "Software"), to deal
@ -438,3 +443,6 @@ All other trademarks are the property of their respective owners.
[mmon-npm-url]: https://npmjs.org/package/mmon [mmon-npm-url]: https://npmjs.org/package/mmon
[mmon-github-url]: https://github.com/sebhildebrandt/mmon [mmon-github-url]: https://github.com/sebhildebrandt/mmon
[smc-code-url]: https://github.com/mmarcon/node-smc
[osx-cpu-temp-url]: https://github.com/lavoiesl/osx-cpu-temp

View File

@ -261,15 +261,16 @@ function cpuTemperature(callback) {
let value = smc.get(key); let value = smc.get(key);
if (id == 0) { if (id == 0) {
if (value > 0) { if (value > 0) {
result.main = value result.main = value;
result.max = value; result.max = value;
} }
id = 1; id = 1;
} } else {
if (value > 0) { if (value > 0) {
result.cores.push(value); result.cores.push(value);
sum = sum + value; sum = sum + value;
if (value > result.max) result.max = value; if (value > result.max) result.max = value;
}
} }
}); });
if (result.cores.length) { if (result.cores.length) {

View File

@ -81,6 +81,8 @@
// -------------------------------- // --------------------------------
// //
// version date comment // version date comment
// 3.15.1 2017-01-17 minor cpuTemperature fix (OSX)
// 3.15.0 2017-01-15 added cpuTemperature also for OSX
// 3.14.0 2017-01-14 added currentLoad per cpu/core, cpu cache (L1, L2, L3) and cpu flags // 3.14.0 2017-01-14 added currentLoad per cpu/core, cpu cache (L1, L2, L3) and cpu flags
// 3.13.0 2016-11-23 added shell (determines standard shell) // 3.13.0 2016-11-23 added shell (determines standard shell)
// 3.12.0 2016-11-17 refactoring and extended currentLoad (better OSX coverage and added irq load) // 3.12.0 2016-11-17 refactoring and extended currentLoad (better OSX coverage and added irq load)