disksIO() added waitTime, waitPercent (linux)

This commit is contained in:
Sebastian Hildebrandt 2021-08-02 13:51:20 +02:00
parent 8b8114acfb
commit 123fb99d05
9 changed files with 150 additions and 21 deletions

View File

@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.8.0 | 2021-08-02 | `disksIO()` added waitTime, waitPercent (linux) |
| 5.7.14 | 2021-08-01 | `cpu()` cache calculation fix (linux) |
| 5.7.13 | 2021-07-28 | `osInfo()` fix uefi detection (win) |
| 5.7.12 | 2021-07-27 | `osInfo()` fix uefi detection (win) |

View File

@ -103,6 +103,7 @@ si.cpu()
(last 7 major and minor version releases)
- Version 5.8.0: `disksIO()` added waitTime, waitPercent (linux)
- Version 5.7.0: `diskLayout()` added S.M.A.R.T for Windows (if installed)
- Version 5.6.0: `cpuTemperature()` added added socket and chipset temp (linux)
- Version 5.5.0: `dockerVolumes()` added
@ -446,6 +447,12 @@ Full function reference with examples can be found at [https://systeminformation
| | rIO_sec | X | | X | | | read IO per sec (* see notes) |
| | wIO_sec | X | | X | | | write IO per sec (* see notes) |
| | tIO_sec | X | | X | | | total IO per sec (* see notes) |
| | rWaitTime | X | | | | | read IO request time (* see notes) |
| | wWaitTime | X | | | | | write IO request time (* see notes) |
| | tWaitTime | X | | | | | total IO request time (* see notes) |
| | rWaitPercent | X | | | | | read IO request time percent (* see notes) |
| | wWaitPercent | X | | | | | write IO request time percent (* see notes) |
| | tWaitPercent | X | | | | | total IO request time percent (* see notes) |
| | ms | X | | X | | | interval length (for per second values) |
| si.fsSize(cb) | [{...}] | X | X | X | X | | returns array of mounted file systems |
| | [0].fs | X | X | X | X | | name of file system |

View File

@ -174,6 +174,7 @@
<li><span class="code">cpu()</span>: added <span class="code">virtualization</span> if cpu supports virtualization</li>
<li><span class="code">cpu()</span>: now <span class="code">flags</span> are part of this function</li>
<li><span class="code">cpuTemperature()</span>: added socket and chipset temperature (linux)</li>
<li><span class="code">disksIO()</span>: added <span class="code">waitTime</span>, <span class="code">waitPercent</span> (linux)</li>
<li><span class="code">fsSize()</span>: added <span class="code">available</span></li>
<li><span class="code">fsSize()</span>: improved calculation of <span class="code">used</span></li>
<li><span class="code">getData()</span>: support for passing parameters and filters (see <a href="general.html">section General / getData</a>)</li>

View File

@ -294,7 +294,7 @@
<td>X</td>
<td>X</td>
<td></td>
<td>L1D (data) size bytes</td>
<td>L1D (data) size in bytes</td>
</tr>
<tr>
<td></td>
@ -304,7 +304,7 @@
<td>X</td>
<td>X</td>
<td></td>
<td>L1I (instruction) size bytes</td>
<td>L1I (instruction) size in bytes</td>
</tr>
<tr>
<td></td>
@ -314,7 +314,7 @@
<td>X</td>
<td>X</td>
<td></td>
<td>L2 size bytes</td>
<td>L2 size in bytes</td>
</tr>
<tr>
<td></td>
@ -324,7 +324,7 @@
<td>X</td>
<td>X</td>
<td></td>
<td>L3 size bytes</td>
<td>L3 size in bytes</td>
</tr>
<tr class="example">
<td></td>
@ -393,7 +393,7 @@ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
<td>X</td>
<td>X</td>
<td></td>
<td>L1D size</td>
<td>L1D size in bytes</td>
</tr>
<tr>
<td></td>
@ -403,7 +403,7 @@ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
<td>X</td>
<td>X</td>
<td></td>
<td>L1I size</td>
<td>L1I size in bytes</td>
</tr>
<tr>
<td></td>
@ -413,7 +413,7 @@ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
<td>X</td>
<td>X</td>
<td></td>
<td>L2 size</td>
<td>L2 size in bytes</td>
</tr>
<tr>
<td></td>
@ -423,7 +423,7 @@ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
<td>X</td>
<td>X</td>
<td></td>
<td>L3 size</td>
<td>L3 size in bytes</td>
</tr>
<tr class="example">
<td></td>
@ -432,7 +432,7 @@ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
<pre><code class="js">const si = require('systeminformation');
si.cpuCache().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{ l1d: 262144, l1i: 262144, l2: 2, l3: 16 }
{ l1d: 262144, l1i: 262144, l2: 2097152, l3: 16777216 }
</pre>
</tr>
<tr>

View File

@ -523,6 +523,66 @@ si.blockDevices().then(data => console.log(data));</code></pre class="example">
<td></td>
<td>total IO per sec (* see notes)</td>
</tr>
<tr>
<td></td>
<td>rWaitTime</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>read IO request time</td>
</tr>
<tr>
<td></td>
<td>wWaitTime</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>write IO request time</td>
</tr>
<tr>
<td></td>
<td>tWaitTime</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>total IO request time</td>
</tr>
<tr>
<td></td>
<td>rWaitPercent</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>read IO request time percent</td>
</tr>
<tr>
<td></td>
<td>wWaitPercent</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>write IO request time percent</td>
</tr>
<tr>
<td></td>
<td>tWaitPercent</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>total IO request time percent</td>
</tr>
<tr>
<td></td>
<td>ms</td>

View File

@ -56,6 +56,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.8.0</th>
<td>2021-08-02</td>
<td><span class="code">disksIO()</span> added wait time (linux)</td>
</tr>
<tr>
<th scope="row">5.7.14</th>
<td>2021-08-01</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.7.14</span></div>
<div class="version">New Version: <span id="version">5.8.0</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>
</div>
<div class="down">

View File

@ -590,7 +590,7 @@ function fsStats(callback) {
exports.fsStats = fsStats;
function calcDiskIO(rIO, wIO) {
function calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime) {
let result = {
rIO: 0,
wIO: 0,
@ -598,6 +598,12 @@ function calcDiskIO(rIO, wIO) {
rIO_sec: null,
wIO_sec: null,
tIO_sec: null,
rWaitTime: 0,
wWaitTime: 0,
tWaitTime: 0,
rWaitPercent: null,
wWaitPercent: null,
tWaitPercent: null,
ms: 0
};
if (_disk_io && _disk_io.ms) {
@ -608,22 +614,43 @@ function calcDiskIO(rIO, wIO) {
result.rIO_sec = (result.rIO - _disk_io.rIO) / (result.ms / 1000);
result.wIO_sec = (result.wIO - _disk_io.wIO) / (result.ms / 1000);
result.tIO_sec = result.rIO_sec + result.wIO_sec;
result.rWaitTime = rWaitTime;
result.wWaitTime = wWaitTime;
result.tWaitTime = tWaitTime;
result.rWaitPercent = (result.rWaitTime - _disk_io.rWaitTime) * 100 / (result.ms);
result.wWaitPercent = (result.wWaitTime - _disk_io.wWaitTime) * 100 / (result.ms);
result.tWaitPercent = (result.tWaitTime - _disk_io.tWaitTime) * 100 / (result.ms);
_disk_io.rIO = rIO;
_disk_io.wIO = wIO;
_disk_io.rIO_sec = result.rIO_sec;
_disk_io.wIO_sec = result.wIO_sec;
_disk_io.tIO_sec = result.tIO_sec;
_disk_io.rWaitTime = rWaitTime;
_disk_io.wWaitTime = wWaitTime;
_disk_io.tWaitTime = tWaitTime;
_disk_io.rWaitPercent = result.rWaitPercent;
_disk_io.wWaitPercent = result.wWaitPercent;
_disk_io.tWaitPercent = result.tWaitPercent;
_disk_io.last_ms = result.ms;
_disk_io.ms = Date.now();
} else {
result.rIO = rIO;
result.wIO = wIO;
result.tIO = rIO + wIO;
result.rWaitTime = rWaitTime;
result.wWaitTime = wWaitTime;
result.tWaitTime = tWaitTime;
_disk_io.rIO = rIO;
_disk_io.wIO = wIO;
_disk_io.rIO_sec = null;
_disk_io.wIO_sec = null;
_disk_io.tIO_sec = null;
_disk_io.rWaitTime = rWaitTime;
_disk_io.wWaitTime = wWaitTime;
_disk_io.tWaitTime = tWaitTime;
_disk_io.rWaitPercent = null;
_disk_io.wWaitPercent = null;
_disk_io.tWaitPercent = null;
_disk_io.last_ms = 0;
_disk_io.ms = Date.now();
}
@ -648,10 +675,19 @@ function disksIO(callback) {
rIO_sec: null,
wIO_sec: null,
tIO_sec: null,
rWaitTime: 0,
wWaitTime: 0,
tWaitTime: 0,
rWaitPercent: null,
wWaitPercent: null,
tWaitPercent: null,
ms: 0
};
let rIO = 0;
let wIO = 0;
let rWaitTime = 0;
let wWaitTime = 0;
let tWaitTime = 0;
if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) {
if (_linux || _freebsd || _openbsd || _netbsd) {
@ -671,8 +707,11 @@ function disksIO(callback) {
let stats = line.split(';');
rIO += parseInt(stats[0]);
wIO += parseInt(stats[4]);
rWaitTime += parseInt(stats[3]);
wWaitTime += parseInt(stats[7]);
tWaitTime += parseInt(stats[10]);
});
result = calcDiskIO(rIO, wIO);
result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime);
if (callback) {
callback(result);
@ -699,7 +738,7 @@ function disksIO(callback) {
wIO += parseInt(line[0]);
}
});
result = calcDiskIO(rIO, wIO);
result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime);
}
if (callback) {
callback(result);
@ -715,6 +754,12 @@ function disksIO(callback) {
result.rIO_sec = _disk_io.rIO_sec;
result.wIO_sec = _disk_io.wIO_sec;
result.tIO_sec = _disk_io.tIO_sec;
result.rWaitTime = _disk_io.rWaitTime;
result.wWaitTime = _disk_io.wWaitTime;
result.tWaitTime = _disk_io.tWaitTime;
result.rWaitPercent = _disk_io.rWaitPercent;
result.wWaitPercent = _disk_io.wWaitPercent;
result.tWaitPercent = _disk_io.tWaitPercent;
if (callback) {
callback(result);
}

View File

@ -33,18 +33,24 @@ const _sunos = (_platform === 'sunos');
const _processes_cpu = {
all: 0,
all_utime: 0,
all_stime: 0,
list: {},
ms: 0,
result: {}
};
const _services_cpu = {
all: 0,
all_utime: 0,
all_stime: 0,
list: {},
ms: 0,
result: {}
};
const _process_cpu = {
all: 0,
all_utime: 0,
all_stime: 0,
list: {},
ms: 0,
result: {}
@ -471,10 +477,10 @@ function calcProcStatWin(procStat, all, _cpu_old) {
}
return {
pid: procStat.pid,
utime: procStat.utime,
stime: procStat.stime,
cpuu: cpuu,
cpus: cpus
utime: cpuu > 0 ? procStat.utime : 0,
stime: cpus > 0 ? procStat.stime : 0,
cpuu: cpuu > 0 ? cpuu : 0,
cpus: cpus > 0 ? cpus : 0
};
}
@ -788,8 +794,8 @@ function processes(callback) {
let procs = [];
let procStats = [];
let list_new = {};
let allcpuu = 0;
let allcpus = 0;
let allcpuu = _processes_cpu.all_utime;
let allcpus = _processes_cpu.all_stime;
for (let i = 0; i < processSections.length; i++) {
if (processSections[i].trim() !== '') {
let lines = processSections[i].trim().split('\r\n');
@ -862,6 +868,8 @@ function processes(callback) {
}
// store old values
_processes_cpu.all = allcpuu + allcpus;
_processes_cpu.all_utime = allcpuu;
_processes_cpu.all_stime = allcpus;
// _processes_cpu.list = list_new;
_processes_cpu.list = Object.assign({}, list_new);
_processes_cpu.ms = Date.now() - _processes_cpu.ms;
@ -953,8 +961,8 @@ function processLoad(proc, callback) {
let processSections = stdout.split(/\n\s*\n/);
let procStats = [];
let list_new = {};
let allcpuu = 0;
let allcpus = 0;
let allcpuu = _process_cpu.all_utime;
let allcpus = _process_cpu.all_stime;
// go through all processes
for (let i = 0; i < processSections.length; i++) {
@ -1051,6 +1059,8 @@ function processLoad(proc, callback) {
}
// store old values
_process_cpu.all = allcpuu + allcpus;
_process_cpu.all_utime = allcpuu;
_process_cpu.all_stime = allcpus;
// _process_cpu.list = list_new;
_process_cpu.list = Object.assign({}, list_new);
_process_cpu.ms = Date.now() - _process_cpu.ms;