cpu() added governor (linux)

This commit is contained in:
Sebastian Hildebrandt 2019-11-10 12:29:44 +01:00
parent 4da52a3507
commit a4af64e57c
7 changed files with 81 additions and 7 deletions

1
.gitignore vendored
View File

@ -60,6 +60,7 @@ npm*
CVS
.eslintrc.json
package-lock.json
yarn.lock
test/
dist/

View File

@ -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 % |

View File

@ -125,6 +125,16 @@
<td></td>
<td>in GHz e.g. '3.90'</td>
</tr>
<tr>
<td></td>
<td>governor</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>e.g. 'powersave'</td>
</tr>
<tr>
<td></td>
<td>cores</td>

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.15.0</th>
<td>2019-11-10</td>
<td><span class="code">cpu()</span> added governor (linux)</td>
</tr>
<tr>
<th scope="row">4.14.17</th>
<td>2019-10-22</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.14.17</span></div>
<div class="version">Current Version: <span id="version">4.15.0</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -191,7 +191,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">9,305</div>
<div class="numbers">9,361</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
@ -199,7 +199,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">203</div>
<div class="numbers">215</div>
<div class="title">Dependends</div>
</div>
</div>

View File

@ -81,7 +81,7 @@
<td>X</td>
<td></td>
<td>X</td>
<td>X</td>
<td></td>
<td>X</td>
<td>average load</td>
</tr>

View File

@ -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 = [];