From 59006046cb98dc38e11886df2df5b9012ced78ff Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 17 Feb 2020 20:11:28 +0100 Subject: [PATCH 01/12] services() added pids (windows) --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 2 +- lib/processes.js | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d492634..c4ccc44 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.22.0 | 2020-02-17 | `services()` added pids (windows) | | 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) | | 4.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue | | 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue | diff --git a/README.md b/README.md index f1c5649..4d3bd8b 100644 --- a/README.md +++ b/README.md @@ -355,7 +355,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | | [0].name | X | X | X | X | | name of service | | | [0].running | X | X | X | X | | true / false | | | [0].startmode | | | | X | | manual, automatic, ... | -| | [0].pids | X | X | X | | | pids | +| | [0].pids | X | X | X | X | | pids | | | [0].pcpu | X | X | X | | | process % CPU | | | [0].pmem | X | X | X | | | process % MEM | diff --git a/docs/history.html b/docs/history.html index d2af45c..a4fc72b 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.0 + 2020-02-17 + services() added pids (windows) + 4.21.3 2020-02-16 diff --git a/docs/index.html b/docs/index.html index f29e218..cfa35a7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.21.3
+
Current Version: 4.22.0
diff --git a/lib/processes.js b/lib/processes.js index 2938e5a..075a216 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -260,11 +260,13 @@ function services(srv, callback) { let srvName = util.getValue(lines, 'Name', '=', true).toLowerCase(); let started = util.getValue(lines, 'Started', '=', true); let startMode = util.getValue(lines, 'StartMode', '=', true); + let pid = util.getValue(lines, 'ProcessId', '=', true); if (srv === '*' || srvs.indexOf(srvName) >= 0) { result.push({ name: srvName, running: (started === 'TRUE'), startmode: startMode, + pids: [ pid], pcpu: 0, pmem: 0 }); @@ -281,6 +283,7 @@ function services(srv, callback) { name: srvName, running: false, startmode: '', + pids: [], pcpu: 0, pmem: 0 }); From 3fee3ae45baa1fc53f798a0c3da28e34ed62aecf Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 17 Feb 2020 20:11:44 +0100 Subject: [PATCH 02/12] 4.22.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 51e883c..b5fde88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.21.3", + "version": "4.22.0", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", From 8c251354b08356479c3aa2d2225812ff5afac1d8 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 17 Feb 2020 21:35:21 +0100 Subject: [PATCH 03/12] memLayout() raspberry PI support --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 2 +- lib/memory.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/system.js | 4 ++++ 5 files changed, 68 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ccc44..510915e 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.22.1 | 2020-02-17 | `memLayout()` raspberry PI support | | 4.22.0 | 2020-02-17 | `services()` added pids (windows) | | 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) | | 4.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue | diff --git a/docs/history.html b/docs/history.html index a4fc72b..8568500 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.1 + 2020-02-17 + memLayout() raspberry PI support + 4.22.0 2020-02-17 diff --git a/docs/index.html b/docs/index.html index cfa35a7..95bb7ee 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.0
+
Current Version: 4.22.1
diff --git a/lib/memory.js b/lib/memory.js index bfe9632..ace26ac 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -15,6 +15,7 @@ const os = require('os'); const exec = require('child_process').exec; +const execSync = require('child_process').execSync; const util = require('./util'); let _platform = process.platform; @@ -314,6 +315,62 @@ function memLayout(callback) { } }); } + if (!result.length) { + result.push({ + size: os.totalmem(), + bank: '', + type: '', + clockSpeed: 0, + formFactor: '', + partNum: '', + serialNum: '', + voltageConfigured: -1, + voltageMin: -1, + voltageMax: -1, + }); + + // Try Raspberry PI + try { + let stdout = execSync('cat /proc/cpuinfo 2>/dev/null'); + let lines = stdout.toString().split('\n'); + let model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); + let version = util.getValue(lines, 'revision', ':', true).toLowerCase(); + + if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') { + + const clockSpeed = { + '0': 400, + '1': 450, + '2': 450, + '3': 3200 + }; + result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400; + result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed; + result[0].type = 'LPDDR2'; + result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type; + result[0].formFactor = 'SoC'; + + stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null'); + lines = stdout.toString().split('\n'); + let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; + if (freq) { + result.clockSpeed = freq; + } + + stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null'); + lines = stdout.toString().split('\n'); + let voltage = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; + if (voltage) { + result.voltageConfigured = voltage; + result.voltageMin = voltage; + result.voltageMax = voltage; + } + } + } catch (e) { + util.noop(); + } + + } if (callback) { callback(result); } resolve(result); }); diff --git a/lib/system.js b/lib/system.js index d946286..9650f72 100644 --- a/lib/system.js +++ b/lib/system.js @@ -100,6 +100,10 @@ function system(callback) { if (result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') { // Pi 4 + if (['c03112'].indexOf(result.version) >= 0) { + result.model = result.model + ' - Pi 4 Model B'; + result.version = result.version + ' - Rev. 1.2'; + } if (['a03111', 'b03111', 'c03111'].indexOf(result.version) >= 0) { result.model = result.model + ' - Pi 4 Model B'; result.version = result.version + ' - Rev. 1.1'; From affaef90a3ff3a32e8b9ced5d9279b7ae8e24a10 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 17 Feb 2020 21:35:36 +0100 Subject: [PATCH 04/12] 4.22.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5fde88..dca33a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.22.0", + "version": "4.22.1", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", From be1bd305ce3eeb546714778e0d062c22b743f02d Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 20 Feb 2020 08:15:01 +0100 Subject: [PATCH 05/12] memLayout() raspberry PI mem voltage fix --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 2 +- lib/memory.js | 8 ++++---- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 510915e..a2e54ef 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.22.2 | 2020-02-20 | `memLayout()` raspberry PI mem voltage fix | | 4.22.1 | 2020-02-17 | `memLayout()` raspberry PI support | | 4.22.0 | 2020-02-17 | `services()` added pids (windows) | | 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) | diff --git a/README.md b/README.md index 4d3bd8b..5f6d603 100644 --- a/README.md +++ b/README.md @@ -85,13 +85,13 @@ si.cpu() (last 7 major and minor version releases) +- Version 4.22.0: `services()` added pids (windows) - Version 4.21.0: added npx copmpatibility - Version 4.20.0: `battery()` added designcapacity, voltage, unit - Version 4.19.0: `osInfo()` added uefi (OS uses UEFI during startup) - Version 4.18.0: `networkInterfaces()` added dhcp for mac os, added dhcp linux fallback - Version 4.17.0: `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState - Version 4.16.0: `networkGatewayDefault()` added -- Version 4.15.0: `cpu()` added governor (linux) - ... You can find all changes here: [detailed changelog][changelog-url] diff --git a/docs/history.html b/docs/history.html index 8568500..955cb4f 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.2 + 2020-02-19 + memLayout() raspberry PI mem voltage fix + 4.22.1 2020-02-17 diff --git a/docs/index.html b/docs/index.html index 95bb7ee..ff6f165 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.1
+
Current Version: 4.22.2
diff --git a/lib/memory.js b/lib/memory.js index ace26ac..19eff2f 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -359,11 +359,11 @@ function memLayout(callback) { stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null'); lines = stdout.toString().split('\n'); - let voltage = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; + let voltage = parseFloat(util.getValue(lines, 'volt', '=', true), 10) || 0; if (voltage) { - result.voltageConfigured = voltage; - result.voltageMin = voltage; - result.voltageMax = voltage; + result[0].voltageConfigured = voltage; + result[0].voltageMin = voltage; + result[0].voltageMax = voltage; } } } catch (e) { From 31a86f08883a1de6292d3ee7f6e1766e90869e7a Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 20 Feb 2020 08:15:07 +0100 Subject: [PATCH 06/12] 4.22.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dca33a8..e37087e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.22.1", + "version": "4.22.2", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", From beb86acecc75c243bc4acf20c8146f15622edffd Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 20 Feb 2020 13:45:19 +0100 Subject: [PATCH 07/12] memLayout() code cleanup --- CHANGELOG.md | 3 ++- docs/history.html | 5 +++++ docs/index.html | 2 +- lib/memory.js | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e54ef..0ec5560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | -| 4.22.2 | 2020-02-20 | `memLayout()` raspberry PI mem voltage fix | +| 4.22.3 | 2020-02-20 | `memLayout()` code cleanup | +| 4.22.2 | 2020-02-19 | `memLayout()` raspberry PI mem voltage fix | | 4.22.1 | 2020-02-17 | `memLayout()` raspberry PI support | | 4.22.0 | 2020-02-17 | `services()` added pids (windows) | | 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) | diff --git a/docs/history.html b/docs/history.html index 955cb4f..8e360dc 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.3 + 2020-02-20 + memLayout() code cleanup + 4.22.2 2020-02-19 diff --git a/docs/index.html b/docs/index.html index ff6f165..420e5b2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.2
+
Current Version: 4.22.3
diff --git a/lib/memory.js b/lib/memory.js index 19eff2f..88e2f03 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -359,7 +359,7 @@ function memLayout(callback) { stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null'); lines = stdout.toString().split('\n'); - let voltage = parseFloat(util.getValue(lines, 'volt', '=', true), 10) || 0; + let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0; if (voltage) { result[0].voltageConfigured = voltage; result[0].voltageMin = voltage; From 2f9874e0b55ab1a894855e7ee5259b097a411109 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 20 Feb 2020 13:45:24 +0100 Subject: [PATCH 08/12] 4.22.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e37087e..ec7d128 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.22.2", + "version": "4.22.3", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", From cf788499b19459c39567a7f9b42b4fff6b495831 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 1 Mar 2020 21:36:47 +0100 Subject: [PATCH 09/12] versions() added dotnet, typings fix --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/index.d.ts | 7 ++++--- lib/osinfo.js | 12 ++++++++++-- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec5560..af4164b 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.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix | | 4.22.3 | 2020-02-20 | `memLayout()` code cleanup | | 4.22.2 | 2020-02-19 | `memLayout()` raspberry PI mem voltage fix | | 4.22.1 | 2020-02-17 | `memLayout()` raspberry PI support | diff --git a/README.md b/README.md index 5f6d603..056f262 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ [![Sponsoring][sponsor-badge]][sponsor-url] [![MIT license][license-img]][license-url] -This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 250 versions published, up to 1 mio downloads per month, > 5 mio downloads overall. Thank you to all who contributed to this project! +This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, up to 1 mio downloads per month, > 6 mio downloads overall. Thank you to all who contributed to this project! ## New Version 4.0 diff --git a/docs/history.html b/docs/history.html index 8e360dc..a64a456 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.4 + 2020-03-01 + versions() added dotnet, fix typings + 4.22.3 2020-02-20 diff --git a/docs/index.html b/docs/index.html index 420e5b2..681ca3b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.3
+
Current Version: 4.22.4
@@ -207,7 +207,7 @@
Downloads last month
-
248
+
249
Dependends
diff --git a/lib/index.d.ts b/lib/index.d.ts index 15fe936..1b79512 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -83,9 +83,9 @@ export namespace Systeminformation { } interface CpuCurrentSpeedData { - min: string; - max: string; - avg: string; + min: number; + max: number; + avg: number; cores: number[]; } @@ -243,6 +243,7 @@ export namespace Systeminformation { java: string; gcc: string; virtualbox: string; + dotnet: string; } interface UserData { diff --git a/lib/osinfo.js b/lib/osinfo.js index 45b6625..63e1ae9 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -384,11 +384,12 @@ function versions(callback) { pip3: '', java: '', gcc: '', - virtualbox: '' + virtualbox: '', + dotnet: '' }; let functionProcessed = (function () { - let totalFunctions = 25; + let totalFunctions = 26; return function () { if (--totalFunctions === 0) { if (callback) { @@ -694,6 +695,13 @@ function versions(callback) { } functionProcessed(); }); + exec('dotnet --version 2>&1', function (error, stdout) { + if (!error) { + const dotnet = stdout.toString().split('\n')[0] || ''; + result.dotnet = dotnet.trim(); + } + functionProcessed(); + }); } catch (e) { if (callback) { callback(result); } resolve(result); From 93d9139e32d7ee1dee181061b2378703609ae3b9 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 1 Mar 2020 21:36:55 +0100 Subject: [PATCH 10/12] 4.22.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec7d128..c859ac8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.22.3", + "version": "4.22.4", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", From 07fe8f9cd1c716964beb203cbad5f1a3475b947e Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 4 Mar 2020 19:37:27 +0100 Subject: [PATCH 11/12] graphics() fixed vram macOS --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/graphics.js | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af4164b..8c9bff6 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.22.5 | 2020-03-04 | `graphics()` fixed vram macOS | | 4.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix | | 4.22.3 | 2020-02-20 | `memLayout()` code cleanup | | 4.22.2 | 2020-02-19 | `memLayout()` raspberry PI mem voltage fix | diff --git a/docs/history.html b/docs/history.html index a64a456..5e40337 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.22.5 + 2020-03-04 + graphics() fixed vram (macOS) + 4.22.4 2020-03-01 diff --git a/docs/index.html b/docs/index.html index 681ca3b..1924802 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.22.4
+
Current Version: 4.22.5
@@ -207,7 +207,7 @@
Downloads last month
-
249
+
250
Dependends
diff --git a/lib/graphics.js b/lib/graphics.js index 361803b..75f5941 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -133,10 +133,16 @@ function graphics(callback) { if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vendor') !== -1) currentController.vendor = parts[1].split('(')[0].trim(); if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(total)') !== -1) { currentController.vram = parseInt(parts[1]); // in MB + if (parts[1].toLowerCase().indexOf('gb') !== -1) { + currentController.vram = currentController.vram * 1024; + } currentController.vramDynamic = false; } if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(dynamic,max)') !== -1) { currentController.vram = parseInt(parts[1]); // in MB + if (parts[1].toLowerCase().indexOf('gb') !== -1) { + currentController.vram = currentController.vram * 1024; + } currentController.vramDynamic = true; } } From ade400710976d029b3b9c0a1d0842c5d2e0181ce Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 4 Mar 2020 19:37:39 +0100 Subject: [PATCH 12/12] 4.22.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c859ac8..a1657cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.22.4", + "version": "4.22.5", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)",