systeminformation 5.27.15 → 5.27.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/lib/cpu.js +51 -47
- package/lib/graphics.js +348 -241
- package/lib/network.js +361 -219
- package/lib/system.js +246 -143
- package/lib/util.js +52 -51
- package/lib/wifi.js +120 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,22 +33,22 @@
|
|
|
33
33
|
### Merry Christmas and Happy new year
|
|
34
34
|
|
|
35
35
|
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
. */.'.'.\*
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
.''.
|
|
37
|
+
.''. . *''* :_\/_:
|
|
38
|
+
:_\/_: _\(/_ .:.*_\/_* : /\ :
|
|
39
|
+
.''.: /\ : ./)\ ':'* /\ * : '..'.
|
|
40
|
+
:_\/_:'.:::. ' *''* * '.\'/.' _\(/_
|
|
41
|
+
: /\ : ::::: *_\/_* -= o =- /)\
|
|
42
|
+
'..' ':::' * /\ * .'/.\'. '
|
|
43
|
+
*..* :
|
|
44
|
+
*
|
|
45
|
+
* /.\ * * . *
|
|
46
|
+
. /..'\ . . * .
|
|
47
|
+
*/'.'\* . . . * *
|
|
48
|
+
* /.''.'\ * . . . *
|
|
49
|
+
. */.'.'.\*
|
|
50
|
+
.........".""""/'.''.'.\""."."........".".".......................
|
|
51
|
+
^^^[_]^^^*
|
|
52
52
|
```
|
|
53
53
|
I wish you all a Merry Christmas and a peaceful New Year 2026.
|
|
54
54
|
|
package/lib/cpu.js
CHANGED
|
@@ -728,8 +728,8 @@ function getCpu() {
|
|
|
728
728
|
result.flags = flags;
|
|
729
729
|
result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
|
|
730
730
|
if (_darwin) {
|
|
731
|
-
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily',
|
|
732
|
-
|
|
731
|
+
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', (error, stdout) => {
|
|
732
|
+
const lines = stdout.toString().split('\n');
|
|
733
733
|
const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
|
|
734
734
|
const modellineParts = modelline.split('@');
|
|
735
735
|
result.brand = modellineParts[0].trim();
|
|
@@ -759,12 +759,12 @@ function getCpu() {
|
|
|
759
759
|
const performanceCores = clusters.filter((line) => line.indexOf('"P"') >= 0).length;
|
|
760
760
|
result.efficiencyCores = efficiencyCores;
|
|
761
761
|
result.performanceCores = performanceCores;
|
|
762
|
-
} catch
|
|
762
|
+
} catch {
|
|
763
763
|
util.noop();
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
if (countProcessors) {
|
|
767
|
-
result.processors = parseInt(countProcessors) || 1;
|
|
767
|
+
result.processors = parseInt(countProcessors, 10) || 1;
|
|
768
768
|
}
|
|
769
769
|
if (countCores && countThreads) {
|
|
770
770
|
result.cores = parseInt(countThreads) || util.cores();
|
|
@@ -782,7 +782,7 @@ function getCpu() {
|
|
|
782
782
|
if (os.cpus()[0] && os.cpus()[0].model) {
|
|
783
783
|
modelline = os.cpus()[0].model;
|
|
784
784
|
}
|
|
785
|
-
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',
|
|
785
|
+
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', (error, stdout) => {
|
|
786
786
|
if (!error) {
|
|
787
787
|
lines = stdout.toString().split('\n');
|
|
788
788
|
}
|
|
@@ -866,7 +866,7 @@ function getCpu() {
|
|
|
866
866
|
|
|
867
867
|
// socket type
|
|
868
868
|
let lines2 = [];
|
|
869
|
-
exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL',
|
|
869
|
+
exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', (error2, stdout2) => {
|
|
870
870
|
lines2 = stdout2.toString().split('\n');
|
|
871
871
|
if (lines2 && lines2.length) {
|
|
872
872
|
result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket;
|
|
@@ -881,7 +881,7 @@ function getCpu() {
|
|
|
881
881
|
if (os.cpus()[0] && os.cpus()[0].model) {
|
|
882
882
|
modelline = os.cpus()[0].model;
|
|
883
883
|
}
|
|
884
|
-
exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL',
|
|
884
|
+
exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', (error, stdout) => {
|
|
885
885
|
let cache = [];
|
|
886
886
|
if (!error) {
|
|
887
887
|
const data = stdout.toString().split('# dmidecode');
|
|
@@ -1181,13 +1181,13 @@ function cpuTemperature(callback) {
|
|
|
1181
1181
|
const cmd =
|
|
1182
1182
|
'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
|
|
1183
1183
|
try {
|
|
1184
|
-
exec(cmd,
|
|
1184
|
+
exec(cmd, (error, stdout) => {
|
|
1185
1185
|
stdout = stdout.toString();
|
|
1186
1186
|
const tdiePos = stdout.toLowerCase().indexOf('tdie');
|
|
1187
1187
|
if (tdiePos !== -1) {
|
|
1188
1188
|
stdout = stdout.substring(tdiePos);
|
|
1189
1189
|
}
|
|
1190
|
-
|
|
1190
|
+
const lines = stdout.split('\n');
|
|
1191
1191
|
let tctl = 0;
|
|
1192
1192
|
lines.forEach((line) => {
|
|
1193
1193
|
const parts = line.split('___');
|
|
@@ -1223,13 +1223,13 @@ function cpuTemperature(callback) {
|
|
|
1223
1223
|
resolve(result);
|
|
1224
1224
|
return;
|
|
1225
1225
|
}
|
|
1226
|
-
exec('sensors',
|
|
1226
|
+
exec('sensors', (error, stdout) => {
|
|
1227
1227
|
if (!error) {
|
|
1228
|
-
|
|
1228
|
+
const lines = stdout.toString().split('\n');
|
|
1229
1229
|
let tdieTemp = null;
|
|
1230
1230
|
let newSectionStarts = true;
|
|
1231
1231
|
let section = '';
|
|
1232
|
-
lines.forEach(
|
|
1232
|
+
lines.forEach((line) => {
|
|
1233
1233
|
// determine section
|
|
1234
1234
|
if (line.trim() === '') {
|
|
1235
1235
|
newSectionStarts = true;
|
|
@@ -1243,11 +1243,14 @@ function cpuTemperature(callback) {
|
|
|
1243
1243
|
if (line.trim().toLowerCase().startsWith('core')) {
|
|
1244
1244
|
section = 'core';
|
|
1245
1245
|
}
|
|
1246
|
+
if (line.trim().toLowerCase().startsWith('k10temp')) {
|
|
1247
|
+
section = 'coreAMD';
|
|
1248
|
+
}
|
|
1246
1249
|
newSectionStarts = false;
|
|
1247
1250
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
+
const regex = /[+-]([^°]*)/g;
|
|
1252
|
+
const temps = line.match(regex);
|
|
1253
|
+
const firstPart = line.split(':')[0].toUpperCase();
|
|
1251
1254
|
if (section === 'acpi') {
|
|
1252
1255
|
// socket temp
|
|
1253
1256
|
if (firstPart.indexOf('TEMP') !== -1) {
|
|
@@ -1260,7 +1263,7 @@ function cpuTemperature(callback) {
|
|
|
1260
1263
|
}
|
|
1261
1264
|
}
|
|
1262
1265
|
// cpu temp
|
|
1263
|
-
if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1) {
|
|
1266
|
+
if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1) || firstPart.indexOf('TEMP') !== -1) {
|
|
1264
1267
|
result.main = parseFloat(temps);
|
|
1265
1268
|
}
|
|
1266
1269
|
if (firstPart.indexOf('CORE ') !== -1) {
|
|
@@ -1272,7 +1275,7 @@ function cpuTemperature(callback) {
|
|
|
1272
1275
|
});
|
|
1273
1276
|
if (result.cores.length > 0) {
|
|
1274
1277
|
result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
|
|
1275
|
-
|
|
1278
|
+
const maxtmp = Math.max.apply(Math, result.cores);
|
|
1276
1279
|
result.max = maxtmp > result.main ? maxtmp : result.main;
|
|
1277
1280
|
} else {
|
|
1278
1281
|
if (result.main === null && tdieTemp !== null) {
|
|
@@ -1280,6 +1283,9 @@ function cpuTemperature(callback) {
|
|
|
1280
1283
|
result.max = tdieTemp;
|
|
1281
1284
|
}
|
|
1282
1285
|
}
|
|
1286
|
+
if (result.main !== null && result.max === null) {
|
|
1287
|
+
result.max = result.main;
|
|
1288
|
+
}
|
|
1283
1289
|
if (result.main !== null || result.max !== null) {
|
|
1284
1290
|
if (callback) {
|
|
1285
1291
|
callback(result);
|
|
@@ -1288,11 +1294,11 @@ function cpuTemperature(callback) {
|
|
|
1288
1294
|
return;
|
|
1289
1295
|
}
|
|
1290
1296
|
}
|
|
1291
|
-
fs.stat('/sys/class/thermal/thermal_zone0/temp',
|
|
1297
|
+
fs.stat('/sys/class/thermal/thermal_zone0/temp', (err) => {
|
|
1292
1298
|
if (err === null) {
|
|
1293
|
-
fs.readFile('/sys/class/thermal/thermal_zone0/temp',
|
|
1299
|
+
fs.readFile('/sys/class/thermal/thermal_zone0/temp', (error, stdout) => {
|
|
1294
1300
|
if (!error) {
|
|
1295
|
-
|
|
1301
|
+
const lines = stdout.toString().split('\n');
|
|
1296
1302
|
if (lines.length > 0) {
|
|
1297
1303
|
result.main = parseFloat(lines[0]) / 1000.0;
|
|
1298
1304
|
result.max = result.main;
|
|
@@ -1304,9 +1310,9 @@ function cpuTemperature(callback) {
|
|
|
1304
1310
|
resolve(result);
|
|
1305
1311
|
});
|
|
1306
1312
|
} else {
|
|
1307
|
-
exec('/opt/vc/bin/vcgencmd measure_temp',
|
|
1313
|
+
exec('/opt/vc/bin/vcgencmd measure_temp', (error, stdout) => {
|
|
1308
1314
|
if (!error) {
|
|
1309
|
-
|
|
1315
|
+
const lines = stdout.toString().split('\n');
|
|
1310
1316
|
if (lines.length > 0 && lines[0].indexOf('=')) {
|
|
1311
1317
|
result.main = parseFloat(lines[0].split('=')[1]);
|
|
1312
1318
|
result.max = result.main;
|
|
@@ -1329,11 +1335,11 @@ function cpuTemperature(callback) {
|
|
|
1329
1335
|
}
|
|
1330
1336
|
}
|
|
1331
1337
|
if (_freebsd || _openbsd || _netbsd) {
|
|
1332
|
-
exec('sysctl dev.cpu | grep temp',
|
|
1338
|
+
exec('sysctl dev.cpu | grep temp', (error, stdout) => {
|
|
1333
1339
|
if (!error) {
|
|
1334
1340
|
let lines = stdout.toString().split('\n');
|
|
1335
1341
|
let sum = 0;
|
|
1336
|
-
lines.forEach(
|
|
1342
|
+
lines.forEach((line) => {
|
|
1337
1343
|
const parts = line.split(':');
|
|
1338
1344
|
if (parts.length > 1) {
|
|
1339
1345
|
const temp = parseFloat(parts[1].replace(',', '.'));
|
|
@@ -1355,27 +1361,25 @@ function cpuTemperature(callback) {
|
|
|
1355
1361
|
});
|
|
1356
1362
|
}
|
|
1357
1363
|
if (_darwin) {
|
|
1358
|
-
let osxTemp = null;
|
|
1359
1364
|
try {
|
|
1360
|
-
osxTemp = require('osx-temperature-sensor');
|
|
1361
|
-
} catch (er) {
|
|
1362
|
-
osxTemp = null;
|
|
1363
|
-
}
|
|
1364
|
-
if (osxTemp) {
|
|
1365
|
+
const osxTemp = require('osx-temperature-sensor');
|
|
1365
1366
|
result = osxTemp.cpuTemperature();
|
|
1366
|
-
// round to 2 digits
|
|
1367
1367
|
if (result.main) {
|
|
1368
|
+
// round to 2 digits
|
|
1368
1369
|
result.main = Math.round(result.main * 100) / 100;
|
|
1369
1370
|
}
|
|
1370
1371
|
if (result.max) {
|
|
1371
1372
|
result.max = Math.round(result.max * 100) / 100;
|
|
1372
1373
|
}
|
|
1373
|
-
if (result
|
|
1374
|
+
if (result?.cores.length) {
|
|
1374
1375
|
for (let i = 0; i < result.cores.length; i++) {
|
|
1375
1376
|
result.cores[i] = Math.round(result.cores[i] * 100) / 100;
|
|
1376
1377
|
}
|
|
1377
1378
|
}
|
|
1379
|
+
} catch {
|
|
1380
|
+
util.noop();
|
|
1378
1381
|
}
|
|
1382
|
+
// add new macOS temperature library here
|
|
1379
1383
|
|
|
1380
1384
|
if (callback) {
|
|
1381
1385
|
callback(result);
|
|
@@ -1438,7 +1442,7 @@ function cpuFlags(callback) {
|
|
|
1438
1442
|
let result = '';
|
|
1439
1443
|
if (_windows) {
|
|
1440
1444
|
try {
|
|
1441
|
-
exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin,
|
|
1445
|
+
exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin, (error, stdout) => {
|
|
1442
1446
|
if (!error) {
|
|
1443
1447
|
let flag_hex = stdout.split('0x').pop().trim();
|
|
1444
1448
|
let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2);
|
|
@@ -1492,7 +1496,7 @@ function cpuFlags(callback) {
|
|
|
1492
1496
|
}
|
|
1493
1497
|
resolve(result);
|
|
1494
1498
|
});
|
|
1495
|
-
} catch
|
|
1499
|
+
} catch {
|
|
1496
1500
|
if (callback) {
|
|
1497
1501
|
callback(result);
|
|
1498
1502
|
}
|
|
@@ -1501,7 +1505,7 @@ function cpuFlags(callback) {
|
|
|
1501
1505
|
}
|
|
1502
1506
|
if (_linux) {
|
|
1503
1507
|
try {
|
|
1504
|
-
exec('export LC_ALL=C; lscpu; unset LC_ALL',
|
|
1508
|
+
exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => {
|
|
1505
1509
|
if (!error) {
|
|
1506
1510
|
let lines = stdout.toString().split('\n');
|
|
1507
1511
|
lines.forEach(function (line) {
|
|
@@ -1536,7 +1540,7 @@ function cpuFlags(callback) {
|
|
|
1536
1540
|
}
|
|
1537
1541
|
}
|
|
1538
1542
|
if (_freebsd || _openbsd || _netbsd) {
|
|
1539
|
-
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL',
|
|
1543
|
+
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', (error, stdout) => {
|
|
1540
1544
|
let flags = [];
|
|
1541
1545
|
if (!error) {
|
|
1542
1546
|
let parts = stdout.toString().split('\tFlags:');
|
|
@@ -1556,7 +1560,7 @@ function cpuFlags(callback) {
|
|
|
1556
1560
|
});
|
|
1557
1561
|
}
|
|
1558
1562
|
if (_darwin) {
|
|
1559
|
-
exec('sysctl machdep.cpu.features',
|
|
1563
|
+
exec('sysctl machdep.cpu.features', (error, stdout) => {
|
|
1560
1564
|
if (!error) {
|
|
1561
1565
|
let lines = stdout.toString().split('\n');
|
|
1562
1566
|
if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) {
|
|
@@ -1595,7 +1599,7 @@ function cpuCache(callback) {
|
|
|
1595
1599
|
};
|
|
1596
1600
|
if (_linux) {
|
|
1597
1601
|
try {
|
|
1598
|
-
exec('export LC_ALL=C; lscpu; unset LC_ALL',
|
|
1602
|
+
exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => {
|
|
1599
1603
|
if (!error) {
|
|
1600
1604
|
let lines = stdout.toString().split('\n');
|
|
1601
1605
|
lines.forEach(function (line) {
|
|
@@ -1627,7 +1631,7 @@ function cpuCache(callback) {
|
|
|
1627
1631
|
}
|
|
1628
1632
|
}
|
|
1629
1633
|
if (_freebsd || _openbsd || _netbsd) {
|
|
1630
|
-
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL',
|
|
1634
|
+
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', (error, stdout) => {
|
|
1631
1635
|
let cache = [];
|
|
1632
1636
|
if (!error) {
|
|
1633
1637
|
const data = stdout.toString();
|
|
@@ -1658,7 +1662,7 @@ function cpuCache(callback) {
|
|
|
1658
1662
|
});
|
|
1659
1663
|
}
|
|
1660
1664
|
if (_darwin) {
|
|
1661
|
-
exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize',
|
|
1665
|
+
exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', (error, stdout) => {
|
|
1662
1666
|
if (!error) {
|
|
1663
1667
|
let lines = stdout.toString().split('\n');
|
|
1664
1668
|
lines.forEach(function (line) {
|
|
@@ -1785,7 +1789,7 @@ exports.cpuCache = cpuCache;
|
|
|
1785
1789
|
function getLoad() {
|
|
1786
1790
|
return new Promise((resolve) => {
|
|
1787
1791
|
process.nextTick(() => {
|
|
1788
|
-
let loads = os.loadavg().map(
|
|
1792
|
+
let loads = os.loadavg().map( (x) => {
|
|
1789
1793
|
return x / util.cores();
|
|
1790
1794
|
});
|
|
1791
1795
|
let avgLoad = parseFloat(Math.max.apply(Math, loads).toFixed(2));
|
|
@@ -1880,9 +1884,9 @@ function getLoad() {
|
|
|
1880
1884
|
cores[i].rawLoadSteal = _cpus[i].loadSteal;
|
|
1881
1885
|
cores[i].rawLoadGuest = _cpus[i].loadGuest;
|
|
1882
1886
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1887
|
+
const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle;
|
|
1888
|
+
const totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest;
|
|
1889
|
+
const currentTick = totalTick - _current_cpu.tick;
|
|
1886
1890
|
result = {
|
|
1887
1891
|
avgLoad: avgLoad,
|
|
1888
1892
|
currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
|
|
@@ -1932,7 +1936,7 @@ function getLoad() {
|
|
|
1932
1936
|
rawCurrentLoadGuest: result.rawCurrentLoadGuest
|
|
1933
1937
|
};
|
|
1934
1938
|
} else {
|
|
1935
|
-
|
|
1939
|
+
const cores = [];
|
|
1936
1940
|
for (let i = 0; i < _corecount; i++) {
|
|
1937
1941
|
cores[i] = {};
|
|
1938
1942
|
cores[i].load = (_cpus[i].load / _cpus[i].currentTick) * 100;
|
|
@@ -2007,7 +2011,7 @@ function getFullLoad() {
|
|
|
2007
2011
|
|
|
2008
2012
|
let result = 0;
|
|
2009
2013
|
|
|
2010
|
-
if (cpus
|
|
2014
|
+
if (cpus?.length) {
|
|
2011
2015
|
for (let i = 0, len = cpus.length; i < len; i++) {
|
|
2012
2016
|
const cpu = cpus[i].times;
|
|
2013
2017
|
totalUser += cpu.user;
|
|
@@ -2016,7 +2020,7 @@ function getFullLoad() {
|
|
|
2016
2020
|
totalIrq += cpu.irq;
|
|
2017
2021
|
totalIdle += cpu.idle;
|
|
2018
2022
|
}
|
|
2019
|
-
|
|
2023
|
+
const totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
|
|
2020
2024
|
result = ((totalTicks - totalIdle) / totalTicks) * 100.0;
|
|
2021
2025
|
}
|
|
2022
2026
|
resolve(result);
|