diff --git a/CHANGELOG.md b/CHANGELOG.md index 6409b0d..071c696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,7 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | 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.2 | 2022-01-17 | `uuid()` fix results (windows) | | 5.10.1 | 2022-01-17 | `cpu()` fix manufacturer | diff --git a/docs/history.html b/docs/history.html index e6df981..dcda34f 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,9 +57,14 @@ + + 5.10.5 + 2022-01-19 + processes() fix calculation (windows) + 5.10.4 - 2022-01-187 + 2022-01-18 battery() fix detection (windows) diff --git a/docs/index.html b/docs/index.html index 2691c56..6f71e12 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.10.4
+
New Version: 5.10.5
diff --git a/lib/processes.js b/lib/processes.js index 05d3f1b..abc6537 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -324,13 +324,13 @@ function services(srv, callback) { } if (_windows) { try { - let wincommand = "Get-WmiObject Win32_Service"; + let wincommand = 'Get-WmiObject Win32_Service'; if (srvs[0] !== '*') { wincommand += ' -Filter "'; for (let i = 0; i < srvs.length; i++) { wincommand += `Name='${srvs[i]}' or `; } - wincommand = `${wincommand.slice(0,-4)}"`; + wincommand = `${wincommand.slice(0, -4)}"`; } wincommand += ' | fl *'; util.powerShell(wincommand).then((stdout, error) => { @@ -817,8 +817,8 @@ function processes(callback) { let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); - allcpuu = allcpuu + utime; - allcpus = allcpus + stime; + allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0); + allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0); result.all++; if (!statusValue) { result.unknown++; } if (statusValue === '3') { result.running++; } @@ -982,8 +982,8 @@ function processLoad(proc, callback) { let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); - allcpuu = allcpuu + utime; - allcpus = allcpus + stime; + allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0); + allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0); procStats.push({ pid: pid, diff --git a/test/ci.js b/test/ci.js index 05e597e..fd99b62 100644 --- a/test/ci.js +++ b/test/ci.js @@ -5,7 +5,7 @@ const testWithTimeout = async (fn) => { (async () => { const timeout = setTimeout(() => { reject('Test Timeout'); - }, 40000); + }, 60000); const result = await fn(); clearTimeout(timeout); return resolve(result);