cpu() fix BSD, networkStats() fix BSD
This commit is contained in:
parent
1fd784f219
commit
8e783f2cf8
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,5 +65,4 @@ yarn.lock
|
|||||||
test/
|
test/
|
||||||
dist/
|
dist/
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
tslint.json
|
|
||||||
typings.d.ts
|
typings.d.ts
|
||||||
|
|||||||
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 4.24.2 | 2020-05-06 | `cpu()` fix (BSD), `networkStats()` fix BSD |
|
||||||
| 4.24.1 | 2020-05-03 | `processes()` fix parsing command and params |
|
| 4.24.1 | 2020-05-03 | `processes()` fix parsing command and params |
|
||||||
| 4.24.0 | 2020-05-01 | `networkInterfaces()` added subnet mask ip4 and ip6 |
|
| 4.24.0 | 2020-05-01 | `networkInterfaces()` added subnet mask ip4 and ip6 |
|
||||||
| 4.23.10 | 2020-05-01 | `cpuTemperature()` optimized parsing linux |
|
| 4.23.10 | 2020-05-01 | `cpuTemperature()` optimized parsing linux |
|
||||||
|
|||||||
@ -83,6 +83,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">4.24.2</th>
|
||||||
|
<td>2020-05-06</td>
|
||||||
|
<td><span class="code">cpu()</span> fix BSD, <span class="code">networkStats()</span> fix BSD </td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">4.24.1</th>
|
<th scope="row">4.24.1</th>
|
||||||
<td>2020-05-03</td>
|
<td>2020-05-03</td>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></div>
|
<div class="subtitle"><span id="typed"></span></div>
|
||||||
<div class="version">Current Version: <span id="version">4.24.1</span></div>
|
<div class="version">Current Version: <span id="version">4.24.2</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>
|
<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>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -506,12 +506,12 @@ function getCpu() {
|
|||||||
let modelline = '';
|
let modelline = '';
|
||||||
let lines = [];
|
let lines = [];
|
||||||
if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model;
|
if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model;
|
||||||
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', function (error, stdout) {
|
||||||
let cache = [];
|
let cache = [];
|
||||||
if (!error) {
|
if (!error) {
|
||||||
const data = stdout.toString().split('# dmidecode');
|
const data = stdout.toString().split('# dmidecode');
|
||||||
const processor = data.length > 0 ? data[1] : '';
|
const processor = data.length > 1 ? data[1] : '';
|
||||||
cache = data.length > 1 ? data[2].split('Cache Information') : [];
|
cache = data.length > 2 ? data[2].split('Cache Information') : [];
|
||||||
|
|
||||||
lines = processor.split('\n');
|
lines = processor.split('\n');
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ function cpuTemperature(callback) {
|
|||||||
for (let i = 0; i < temps.length; i++) {
|
for (let i = 0; i < temps.length; i++) {
|
||||||
if (temps[i] && (labels[i] === undefined || (labels[i] && labels[i].toLowerCase().startsWith('core')))) {
|
if (temps[i] && (labels[i] === undefined || (labels[i] && labels[i].toLowerCase().startsWith('core')))) {
|
||||||
result.cores.push(Math.round(parseInt(temps[i], 10) / 100) / 10);
|
result.cores.push(Math.round(parseInt(temps[i], 10) / 100) / 10);
|
||||||
} else if (temps[i] && labels[i] && result.main === -1) {
|
} else if (temps[i] && labels[i] && result.main === -1) {
|
||||||
result.main = Math.round(parseInt(temps[i], 10) / 100) / 10;
|
result.main = Math.round(parseInt(temps[i], 10) / 100) / 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1081,11 +1081,11 @@ function networkStatsSingle(iface) {
|
|||||||
const line = lines[i].replace(/ +/g, ' ').split(' ');
|
const line = lines[i].replace(/ +/g, ' ').split(' ');
|
||||||
if (line && line[0] && line[7] && line[10]) {
|
if (line && line[0] && line[7] && line[10]) {
|
||||||
rx_bytes = rx_bytes + parseInt(line[7]);
|
rx_bytes = rx_bytes + parseInt(line[7]);
|
||||||
if (stats[6].trim() !== '-') { rx_dropped = rx_dropped + parseInt(stats[6]); }
|
if (line[6].trim() !== '-') { rx_dropped = rx_dropped + parseInt(line[6]); }
|
||||||
if (stats[5].trim() !== '-') { rx_errors = rx_errors + parseInt(stats[5]); }
|
if (line[5].trim() !== '-') { rx_errors = rx_errors + parseInt(line[5]); }
|
||||||
tx_bytes = tx_bytes + parseInt(line[10]);
|
tx_bytes = tx_bytes + parseInt(line[10]);
|
||||||
if (stats[12].trim() !== '-') { tx_dropped = tx_dropped + parseInt(stats[12]); }
|
if (line[12].trim() !== '-') { tx_dropped = tx_dropped + parseInt(line[12]); }
|
||||||
if (stats[9].trim() !== '-') { tx_errors = tx_errors + parseInt(stats[9]); }
|
if (line[9].trim() !== '-') { tx_errors = tx_errors + parseInt(line[9]); }
|
||||||
operstate = 'up';
|
operstate = 'up';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
51
tslint.json
Normal file
51
tslint.json
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "error",
|
||||||
|
"extends": [
|
||||||
|
"tslint:recommended"
|
||||||
|
],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {
|
||||||
|
"no-trailing-whitespace": false,
|
||||||
|
"quotemark": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"comment-format": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"member-access": false,
|
||||||
|
"whitespace": [
|
||||||
|
true
|
||||||
|
],
|
||||||
|
"object-literal-shorthand": false,
|
||||||
|
"ordered-imports": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"one-line": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"max-line-length": [
|
||||||
|
true,
|
||||||
|
140
|
||||||
|
],
|
||||||
|
"only-arrow-functions": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"object-literal-sort-keys": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"array-type": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"variable-name": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"interface-name": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"one-variable-per-declaration": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"no-console": false
|
||||||
|
},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user