processes() fix calculation (windows)

This commit is contained in:
Sebastian Hildebrandt 2022-01-19 16:50:12 +01:00
parent 4e580fac16
commit 75fb6e7525
5 changed files with 16 additions and 10 deletions

View File

@ -80,7 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 5.10.4 | 2022-01-18 | `battery()` fix deection (windows) | | 5.10.5 | 2022-01-19 | `processes()` fix calculation (windows) |
| 5.10.4 | 2022-01-18 | `battery()` fix detection (windows) |
| 5.10.3 | 2022-01-17 | `system()` improved virtual detection (windows) | | 5.10.3 | 2022-01-17 | `system()` improved virtual detection (windows) |
| 5.10.2 | 2022-01-17 | `uuid()` fix results (windows) | | 5.10.2 | 2022-01-17 | `uuid()` fix results (windows) |
| 5.10.1 | 2022-01-17 | `cpu()` fix manufacturer | | 5.10.1 | 2022-01-17 | `cpu()` fix manufacturer |

View File

@ -57,9 +57,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.10.5</th>
<td>2022-01-19</td>
<td><span class="code">processes()</span> fix calculation (windows)</td>
</tr>
<tr> <tr>
<th scope="row">5.10.4</th> <th scope="row">5.10.4</th>
<td>2022-01-187</td> <td>2022-01-18</td>
<td><span class="code">battery()</span> fix detection (windows)</td> <td><span class="code">battery()</span> fix detection (windows)</td>
</tr> </tr>
<tr> <tr>

View File

@ -170,7 +170,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>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.10.4</span></div> <div class="version">New Version: <span id="version">5.10.5</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">

View File

@ -324,13 +324,13 @@ function services(srv, callback) {
} }
if (_windows) { if (_windows) {
try { try {
let wincommand = "Get-WmiObject Win32_Service"; let wincommand = 'Get-WmiObject Win32_Service';
if (srvs[0] !== '*') { if (srvs[0] !== '*') {
wincommand += ' -Filter "'; wincommand += ' -Filter "';
for (let i = 0; i < srvs.length; i++) { for (let i = 0; i < srvs.length; i++) {
wincommand += `Name='${srvs[i]}' or `; wincommand += `Name='${srvs[i]}' or `;
} }
wincommand = `${wincommand.slice(0,-4)}"`; wincommand = `${wincommand.slice(0, -4)}"`;
} }
wincommand += ' | fl *'; wincommand += ' | fl *';
util.powerShell(wincommand).then((stdout, error) => { util.powerShell(wincommand).then((stdout, error) => {
@ -817,8 +817,8 @@ function processes(callback) {
let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
allcpuu = allcpuu + utime; allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0);
allcpus = allcpus + stime; allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0);
result.all++; result.all++;
if (!statusValue) { result.unknown++; } if (!statusValue) { result.unknown++; }
if (statusValue === '3') { result.running++; } if (statusValue === '3') { result.running++; }
@ -982,8 +982,8 @@ function processLoad(proc, callback) {
let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
allcpuu = allcpuu + utime; allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0);
allcpus = allcpus + stime; allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0);
procStats.push({ procStats.push({
pid: pid, pid: pid,

View File

@ -5,7 +5,7 @@ const testWithTimeout = async (fn) => {
(async () => { (async () => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
reject('Test Timeout'); reject('Test Timeout');
}, 40000); }, 60000);
const result = await fn(); const result = await fn();
clearTimeout(timeout); clearTimeout(timeout);
return resolve(result); return resolve(result);