added speed per CPU core in cpuCurrentspeed()
This commit is contained in:
parent
591ae9d145
commit
4165cb414f
@ -100,6 +100,7 @@ Other changes
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 3.43.0 | 2018-08-25 | `cpuCurrentspeed()` added cpu speed for all cores |
|
||||
| 3.42.10 | 2018-08-25 | `processes()` optimized start time parsing |
|
||||
| 3.42.9 | 2018-08-08 | `cpuTemperature()` optimized parsing |
|
||||
| 3.42.8 | 2018-08-03 | updated docs |
|
||||
|
||||
@ -54,13 +54,13 @@ async function cpu() {
|
||||
|
||||
(last 7 major and minor version releases)
|
||||
|
||||
- Version 3.43.0: added speed per CPU core `cpuCurrentspeed()`
|
||||
- Version 3.42.0: added parent process PID `processes()`
|
||||
- Version 3.41.0: first partial `SunOS` support
|
||||
- Version 3.40.0: extended `versions()` (php, redis, mongodb)
|
||||
- Version 3.39.0: added `versions().mysql` and `versions().nginx`, start implementing `SunOS` support
|
||||
- Version 3.38.0: added `battery.acconnected`
|
||||
- Version 3.37.0: extended FreeBSD support `networkStats()`
|
||||
- Version 3.36.0: extended FreeBSD support `networkConnections()`
|
||||
- ...
|
||||
|
||||
You can find all changes here: [detailed changelog][changelog-url]
|
||||
@ -149,6 +149,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
|
||||
| | avg | X | X | X | X | X | avg CPU speed (all cores) |
|
||||
| | min | X | X | X | X | X | min CPU speed (all cores) |
|
||||
| | max | X | X | X | X | X | max CPU speed (all cores) |
|
||||
| | cores | X | X | X | X | X | CPU speed per core (array) |
|
||||
| si.cpuTemperature(cb) | {...} | X | X | X* | X | | CPU temperature (if supported) |
|
||||
| | main | X | X | X | X | | main temperature (avg) |
|
||||
| | cores | X | X | X | X | | array of temperatures |
|
||||
|
||||
@ -405,6 +405,7 @@ function getCpuCurrentSpeedSync() {
|
||||
let minFreq = 999999999;
|
||||
let maxFreq = 0;
|
||||
let avgFreq = 0;
|
||||
let cores = [];
|
||||
|
||||
if (cpus.length) {
|
||||
for (let i in cpus) {
|
||||
@ -413,18 +414,21 @@ function getCpuCurrentSpeedSync() {
|
||||
if (cpus[i].speed > maxFreq) maxFreq = cpus[i].speed;
|
||||
if (cpus[i].speed < minFreq) minFreq = cpus[i].speed;
|
||||
}
|
||||
cores.push(parseFloat(((cpus[i].speed + 1) / 1000).toFixed(2)));
|
||||
}
|
||||
avgFreq = avgFreq / cpus.length;
|
||||
return {
|
||||
min: parseFloat(((minFreq + 1) / 1000).toFixed(2)),
|
||||
max: parseFloat(((maxFreq + 1) / 1000).toFixed(2)),
|
||||
avg: parseFloat(((avgFreq + 1) / 1000).toFixed(2))
|
||||
avg: parseFloat(((avgFreq + 1) / 1000).toFixed(2)),
|
||||
cores: cores
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
min: 0,
|
||||
max: 0,
|
||||
avg: 0
|
||||
avg: 0,
|
||||
cores: cores
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user