updated docs

This commit is contained in:
Sebastian Hildebrandt 2020-01-28 00:20:42 +01:00
parent 0c15f45ef6
commit 0164a65c20
2 changed files with 20 additions and 1 deletions

View File

@ -557,6 +557,25 @@
</tr>
</tbody>
</table>
<h4>Getting correct stats values</h4>
<p>In <span class="code">currentLoad()</span> the
results are calculated correctly beginning with the <strong>second</strong> call of the function.
It is determined by calculating the difference of cpu ticks between two calls of the function.</p>
<p>The first time you are calling one of this functions, you will get the load since cpu uptime.
The second time, you should then get statistics based cpu ticks between the two calls ...</p>
<p>So basically, your code should look like this:</p>
<pre><code class="js">const si = require('systeminformation');
setInterval(function() {
si.currentLoad().then(data => {
console.log(data);
})
}, 1000)</code></pre>
<p>Beginning with the second call, you get precise load values between the two calls.</p>
</div>
</div>
</div>

View File

@ -48,7 +48,7 @@
<div class="text">
<h4>Getting correct stats values</h4>
<p>In <span class="code">fsStats()</span>, <span class="code">disksIO()</span> and <span class="code">networkStats()</span> the
<p>In <span class="code">fsStats()</span>, <span class="code">disksIO()</span>, <span class="code">currentLoad()</span> and <span class="code">networkStats()</span> the
results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning with the <strong>second</strong> call of the function.
It is determined by calculating the difference of transferred bytes / IOs divided by the time between two calls of the function.</p>