getCpuCurrentSpeedSync() workarround fix
This commit is contained in:
parent
4c28e0ac8e
commit
772e3b02cd
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 4.23.7 | 2020-04-26 | `getCpuCurrentSpeedSync()` workarround fix |
|
||||||
| 4.23.6 | 2020-04-25 | `networkGatewayDefault()` bug fix no interfaces |
|
| 4.23.6 | 2020-04-25 | `networkGatewayDefault()` bug fix no interfaces |
|
||||||
| 4.23.5 | 2020-04-20 | updated docs |
|
| 4.23.5 | 2020-04-20 | updated docs |
|
||||||
| 4.23.4 | 2020-04-20 | `users()` optimized parseDateTime function |
|
| 4.23.4 | 2020-04-20 | `users()` optimized parseDateTime function |
|
||||||
|
|||||||
@ -84,8 +84,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">4.23.4</th>
|
<th scope="row">4.23.7</th>
|
||||||
<td>2020-04-20</td>
|
<td>2020-04-2&</td>
|
||||||
|
<td><span class="code">getCpuCurrentSpeedSync()</span> workarround fix</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">4.23.6</th>
|
||||||
|
<td>2020-04-25</td>
|
||||||
<td><span class="code">networkGatewayDefault()</span> bugfix no interfaces</td>
|
<td><span class="code">networkGatewayDefault()</span> bugfix no interfaces</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></div>
|
<div class="subtitle"><span id="typed"></span></div>
|
||||||
<div class="version">Current Version: <span id="version">4.23.6</span></div>
|
<div class="version">Current Version: <span id="version">4.23.7</span></div>
|
||||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
30
lib/cpu.js
30
lib/cpu.js
@ -695,7 +695,7 @@ function getCpuCurrentSpeedSync() {
|
|||||||
let avgFreq = 0;
|
let avgFreq = 0;
|
||||||
let cores = [];
|
let cores = [];
|
||||||
|
|
||||||
if (cpus.length) {
|
if (cpus && cpus.length) {
|
||||||
for (let i in cpus) {
|
for (let i in cpus) {
|
||||||
if ({}.hasOwnProperty.call(cpus, i)) {
|
if ({}.hasOwnProperty.call(cpus, i)) {
|
||||||
avgFreq = avgFreq + cpus[i].speed;
|
avgFreq = avgFreq + cpus[i].speed;
|
||||||
@ -1142,7 +1142,7 @@ function getLoad() {
|
|||||||
let totalIrq = 0;
|
let totalIrq = 0;
|
||||||
let totalIdle = 0;
|
let totalIdle = 0;
|
||||||
let cores = [];
|
let cores = [];
|
||||||
_corecount = cpus.length;
|
_corecount = (cpus && cpus.length) ? cpus.length : 1;
|
||||||
|
|
||||||
for (let i = 0; i < _corecount; i++) {
|
for (let i = 0; i < _corecount; i++) {
|
||||||
const cpu = cpus[i].times;
|
const cpu = cpus[i].times;
|
||||||
@ -1292,17 +1292,23 @@ function getFullLoad() {
|
|||||||
let totalIrq = 0;
|
let totalIrq = 0;
|
||||||
let totalIdle = 0;
|
let totalIdle = 0;
|
||||||
|
|
||||||
for (let i = 0, len = cpus.length; i < len; i++) {
|
let result = 0;
|
||||||
const cpu = cpus[i].times;
|
|
||||||
totalUser += cpu.user;
|
|
||||||
totalSystem += cpu.sys;
|
|
||||||
totalNice += cpu.nice;
|
|
||||||
totalIrq += cpu.irq;
|
|
||||||
totalIdle += cpu.idle;
|
|
||||||
}
|
|
||||||
let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
|
|
||||||
let result = (totalTicks - totalIdle) / totalTicks * 100.0;
|
|
||||||
|
|
||||||
|
if (cpus && cpus.length) {
|
||||||
|
for (let i = 0, len = cpus.length; i < len; i++) {
|
||||||
|
const cpu = cpus[i].times;
|
||||||
|
totalUser += cpu.user;
|
||||||
|
totalSystem += cpu.sys;
|
||||||
|
totalNice += cpu.nice;
|
||||||
|
totalIrq += cpu.irq;
|
||||||
|
totalIdle += cpu.idle;
|
||||||
|
}
|
||||||
|
let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
|
||||||
|
result = (totalTicks - totalIdle) / totalTicks * 100.0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user