From ce0bc13706fc39aa463abb92c7523f723e47b9a3 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 24 Apr 2019 10:19:40 +0200 Subject: [PATCH] memory() swap used fix (linux) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/memory.js | 3 +-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c45376a..1bc363c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.1.6 | 2019-04-24 | `memory()` swap used fix (linux) | | 4.1.5 | 2019-04-19 | refactored `wmic` calls to work also on Windows XP | | 4.1.4 | 2019-03-26 | `networkInterfaces()` speed bug (windows) | | 4.1.3 | 2019-03-24 | wmic path detection (windows) | diff --git a/docs/history.html b/docs/history.html index bf12749..57bef67 100644 --- a/docs/history.html +++ b/docs/history.html @@ -80,6 +80,11 @@ + + 4.1.6 + 2019-04-24 + memory() swap used fix (linux) + 4.1.5 2019-04-19 diff --git a/docs/index.html b/docs/index.html index 6059594..d37a372 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
-
Current Version: 4.1.5
+
Current Version: 4.1.6
@@ -201,7 +201,7 @@
Downloads last month
-
153
+
154
Dependends
diff --git a/lib/memory.js b/lib/memory.js index 7067bf4..5df939e 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -152,8 +152,7 @@ function mem(callback) { result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0; result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10); result.swapfree = result.swapfree ? result.swapfree * 1024 : 0; - result.swapused = parseInt(util.getValue(lines, 'swapcached'), 10); - result.swapused = result.swapused ? result.swapused * 1024 : 0; + result.swapused = result.swaptotal - result.swapfree; } if (callback) { callback(result); } resolve(result);