From bf5df7f63ed80903a425ce6134b782992aa0337a Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 9 Nov 2023 06:40:15 +0100 Subject: [PATCH] currentLoad() improved parsing (linux) --- CHANGELOG.md | 1 + README.md | 6 +++--- docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/cpu.js | 2 +- lib/processes.js | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 801eb051..520e5ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.21.16 | 2023-11-09 | `currentLoad()` improved parsing (linux) | | 5.21.15 | 2023-10-27 | `wifiConnections()` improved parsing (linux) | | 5.21.14 | 2023-10-26 | `execSync()` added explicit encoding (linux) | | 5.21.13 | 2023-10-21 | `system()` Raspberry Pi 5 detection | diff --git a/README.md b/README.md index 9d157c5e..7716eaa8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ [![MIT license][license-img]][license-url] ## The Systeminformation Project -This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 8 mio downloads per month, > 200 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project! +This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 8 mio downloads per month, > 220 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project! ## Please support this project ... ☕️ @@ -50,7 +50,7 @@ The new Version 5 is here - this next major version release 5.0 comes with new f - better uuid function to get unique hardware and OS UUIDs - better/extended cpu info detection - better/extended system info detection -- Apple Silicon M1 support +- Apple Silicon M1/M2/M3 support - better Raspberry-PI detection - systeminformation website updated and extended with full documentation and examples [systeminformation.io][systeminformation-url] - lot of minor improvements @@ -935,7 +935,7 @@ To be able to measure temperature on macOS I created a little additional package in NPM with `optionalDependencies` I unfortunately was getting unexpected warnings on other platforms. So I decided to drop this optional dependency for macOS - so by default, you will not get correct values. -This additional package is now also supporting Apple Silicon M1 machines. +This additional package is now also supporting Apple Silicon M1/M2/M3 machines. But if you need to detect macOS temperature just run the following additional installation command: diff --git a/docs/history.html b/docs/history.html index 4d7f4a46..1a427c50 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@

Full version history

+ + 5.21.16 + 2023-11-09 + currentLoad() improved parsing (linux) + 5.21.15 2023-10-27 diff --git a/docs/index.html b/docs/index.html index 1dbd9c27..441dad69 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.21.15
+
New Version: 5.21.16
@@ -212,7 +212,7 @@
Downloads last month
-
659
+
663
Dependents
diff --git a/lib/cpu.js b/lib/cpu.js index 72fd0983..9eed305e 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -1604,7 +1604,7 @@ function getLoad() { // linux: try to get other cpu stats if (_linux) { try { - const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu').toString().split('\n'); + const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', { encoding: 'utf8' }).toString().split('\n'); if (lines.length > 1) { lines.shift(); if (lines.length === cpus.length) { diff --git a/lib/processes.js b/lib/processes.js index 8314bc93..b94f0ad4 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -211,7 +211,7 @@ function services(srv, callback) { } else { ps = lines.filter(function (e) { - return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1); + return (e.toLowerCase().indexOf(' ' + srv.toLowerCase() + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv.toLowerCase()) !== -1); }); } const pids = [];