diff --git a/CHANGELOG.md b/CHANGELOG.md index d492634..8c9bff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,12 @@ 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 | +| 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 | | 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue | diff --git a/README.md b/README.md index f1c5649..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 @@ -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] @@ -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..5e40337 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,36 @@ + + 4.22.5 + 2020-03-04 + graphics() fixed vram (macOS) + + + 4.22.4 + 2020-03-01 + versions() added dotnet, fix typings + + + 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 diff --git a/docs/index.html b/docs/index.html index f29e218..1924802 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.21.3
+
Current Version: 4.22.5
@@ -207,7 +207,7 @@
Downloads last month
-
248
+
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; } } 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/memory.js b/lib/memory.js index bfe9632..88e2f03 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 = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0; + if (voltage) { + result[0].voltageConfigured = voltage; + result[0].voltageMin = voltage; + result[0].voltageMax = voltage; + } + } + } catch (e) { + util.noop(); + } + + } if (callback) { callback(result); } resolve(result); }); 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); 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 }); 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'; diff --git a/package.json b/package.json index 51e883c..a1657cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "systeminformation", - "version": "4.21.3", + "version": "4.22.5", "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)",