From a4af64e57cb9f413f90adb2f444c9f0f81eba7cc Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 10 Nov 2019 12:29:44 +0100 Subject: [PATCH] cpu() added governor (linux) --- .gitignore | 1 + README.md | 4 ++- docs/cpu.html | 10 ++++++++ docs/history.html | 5 ++++ docs/index.html | 6 ++--- docs/processes.html | 2 +- lib/cpu.js | 60 +++++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 81 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d234c9b..bdb756c 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ npm* CVS .eslintrc.json package-lock.json +yarn.lock test/ dist/ diff --git a/README.md b/README.md index 9cc5983..3f0bc82 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ si.cpu() (last 7 major and minor version releases) +- Version 4.15.0: `cpu()` added governor (linux) - Version 4.14.0: `processes()` added process path and params - Version 4.13.0: `networkConnections()` added PID, process - Version 4.12.0: `networkInterfaces()` added property virtual @@ -162,6 +163,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | | speed | X | X | X | X | | in GHz e.g. '3.40' | | | speedmin | X | | X | X | | in GHz e.g. '0.80' | | | speedmax | X | X | X | X | | in GHz e.g. '3.90' | +| | governor | X | | | | | e.g. 'powersave' | | | cores | X | X | X | X | | # cores | | | physicalCores | X | X | X | X | | # physical cores | | | processors | X | X | X | X | | # processors | @@ -302,7 +304,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments | | --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- | | si.currentLoad(cb) | {...} | X | | X | X | X | CPU-Load | -| | avgload | X | | X | X | X | average load | +| | avgload | X | | X | | X | average load | | | currentload | X | | X | X | X | CPU load in % | | | currentload_user | X | | X | X | X | CPU load user in % | | | currentload_system | X | | X | X | X | CPU load system in % | diff --git a/docs/cpu.html b/docs/cpu.html index f28ffad..851e02c 100644 --- a/docs/cpu.html +++ b/docs/cpu.html @@ -125,6 +125,16 @@ in GHz e.g. '3.90' + + + governor + X + + + + + e.g. 'powersave' + cores diff --git a/docs/history.html b/docs/history.html index e2d13fc..d59fcad 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.15.0 + 2019-11-10 + cpu() added governor (linux) + 4.14.17 2019-10-22 diff --git a/docs/index.html b/docs/index.html index 43d27d5..cc3e782 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.14.17
+
Current Version: 4.15.0
@@ -191,7 +191,7 @@
-
9,305
+
9,361
Lines of code
@@ -199,7 +199,7 @@
Downloads last month
-
203
+
215
Dependends
diff --git a/docs/processes.html b/docs/processes.html index 3abfcf4..05d69cf 100644 --- a/docs/processes.html +++ b/docs/processes.html @@ -81,7 +81,7 @@ X X - X + X average load diff --git a/lib/cpu.js b/lib/cpu.js index 21c7930..7ada024 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -122,7 +122,61 @@ const AMDBaseFrequencies = { '7251': '2.1', '7551P': '2.0', '7401P': '2.0', - '7351P': '2.4' + '7351P': '2.4', + '2300X': '3.5', + '2500X': '3.6', + '2600': '3.1', + '2600E': '3.1', + '2600X': '3.6', + '2700': '3.2', + '2700E': '2.8', + '2700X': '3.7', + 'Pro 2700X': '3.6', + '2920': '3.5', + '2950': '3.5', + '2970WX': '3.0', + '2990WX': '3.0', + '3200U': '2.6', + '3300U': '2.1', + '3500U': '2.1', + '3550H': '2.1', + '3580U': '2.1', + '3700U': '2.3', + '3750H': '2.3', + '3780U': '2.3', + '3500X': '3.6', + '3600': '3.6', + 'Pro 3600': '3.6', + '3600X': '3.8', + 'Pro 3700': '3.6', + '3700X': '3.6', + '3800X': '3.9', + '3900': '3.1', + 'Pro 3900': '3.1', + '3900X': '3.8', + '3950X': '3.5', + '3960X': '3.8', + '3970X': '3.7', + '7232P': '3.1', + '7302P': '3.0', + '7402P': '2.8', + '7502P': '2.5', + '7702P': '2.0', + '7252': '3.1', + '7262': '3.2', + '7272': '2.9', + '7282': '2.8', + '7302': '3.0', + '7352': '2.3', + '7402': '2.8', + '7452': '2.35', + '7502': '2.5', + '7542': '2.9', + '7552': '2.2', + '7642': '2.3', + '7702': '2.0', + '7742': '2.25', + '7H12': '2.6' }; const socketTypes = { @@ -240,6 +294,7 @@ function getCpu() { speed: '0.00', speedmin: '', speedmax: '', + governor: '', cores: util.cores(), physicalCores: util.cores(), processors: 1, @@ -283,7 +338,7 @@ function getCpu() { let modelline = ''; let lines = []; if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model; - exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) { + exec('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL', function (error, stdout) { if (!error) { lines = stdout.toString().split('\n'); } @@ -327,6 +382,7 @@ function getCpu() { let processorsInt = parseInt(processors, 10); result.physicalCores = result.cores / threadsPerCoreInt; result.processors = processorsInt; + result.governor = util.getValue(lines, 'governor') || ''; // socket type let lines2 = [];