systeminformation 6.0.0-beta.24 → 6.0.0-beta.26
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 +57 -6
- package/dist/bsd/index.d.ts +3 -0
- package/dist/bsd/index.js +7 -1
- package/dist/common/darwin.d.ts +1 -0
- package/dist/common/darwin.js +15 -3
- package/dist/common/defaults.js +15 -4
- package/dist/common/disk-speed.d.ts +20 -0
- package/dist/common/disk-speed.js +142 -0
- package/dist/common/filesys.d.ts +1 -1
- package/dist/common/filesys.js +24 -4
- package/dist/common/mappings.d.ts +1 -1
- package/dist/common/mappings.js +14 -4
- package/dist/common/types.d.ts +41 -0
- package/dist/common/windows.d.ts +1 -0
- package/dist/common/windows.js +19 -5
- package/dist/cpu-current-load.js +45 -0
- package/dist/cpu-current-speed.js +6 -0
- package/dist/darwin/bluetooth.d.ts +1 -1
- package/dist/darwin/bluetooth.js +2 -2
- package/dist/darwin/cpu-current-speed.d.ts +2 -0
- package/dist/darwin/cpu-current-speed.js +30 -0
- package/dist/darwin/cpu-temperature.js +7 -13
- package/dist/darwin/disk-speed.d.ts +2 -0
- package/dist/darwin/disk-speed.js +18 -0
- package/dist/darwin/disks-io.js +3 -1
- package/dist/darwin/fans.js +11 -13
- package/dist/darwin/gpu.d.ts +1 -1
- package/dist/darwin/gpu.js +4 -4
- package/dist/darwin/index.d.ts +3 -0
- package/dist/darwin/index.js +8 -2
- package/dist/darwin/network-interfaces.js +14 -4
- package/dist/darwin/network-routes.d.ts +3 -0
- package/dist/darwin/network-routes.js +74 -0
- package/dist/darwin/wifi-connections.js +3 -2
- package/dist/disk-speed.d.ts +1 -0
- package/dist/disk-speed.js +17 -0
- package/dist/get.js +5 -5
- package/dist/index.d.ts +12 -8
- package/dist/index.js +30 -21
- package/dist/inet-speed.d.ts +11 -0
- package/dist/inet-speed.js +152 -0
- package/dist/linux/block-devices.d.ts +1 -1
- package/dist/linux/block-devices.js +21 -5
- package/dist/linux/cpu-topology.d.ts +2 -0
- package/dist/linux/cpu-topology.js +15 -0
- package/dist/linux/disk-speed.d.ts +2 -0
- package/dist/linux/disk-speed.js +16 -0
- package/dist/linux/disks-io.d.ts +1 -1
- package/dist/linux/disks-io.js +18 -7
- package/dist/linux/index.d.ts +3 -0
- package/dist/linux/index.js +8 -2
- package/dist/linux/mem.js +20 -1
- package/dist/linux/network-interfaces.js +18 -7
- package/dist/linux/network-routes.d.ts +4 -0
- package/dist/linux/network-routes.js +69 -0
- package/dist/linux/os-info.js +32 -4
- package/dist/linux/pci.d.ts +1 -1
- package/dist/linux/pci.js +4 -3
- package/dist/linux/wifi-connections.d.ts +4 -0
- package/dist/linux/wifi-connections.js +20 -2
- package/dist/network-routes.d.ts +1 -0
- package/dist/network-routes.js +17 -0
- package/dist/powershell.d.ts +2 -0
- package/dist/powershell.js +15 -0
- package/dist/sun/index.d.ts +1 -0
- package/dist/sun/index.js +3 -1
- package/dist/windows/block-devices.js +6 -1
- package/dist/windows/cpu-topology.d.ts +3 -0
- package/dist/windows/cpu-topology.js +90 -0
- package/dist/windows/disk-speed.d.ts +6 -0
- package/dist/windows/disk-speed.js +73 -0
- package/dist/windows/disks-io.js +3 -1
- package/dist/windows/index.d.ts +3 -0
- package/dist/windows/index.js +8 -2
- package/dist/windows/network-interfaces.js +6 -3
- package/dist/windows/network-routes.d.ts +3 -0
- package/dist/windows/network-routes.js +41 -0
- package/dist/windows/wifi-connections.d.ts +1 -0
- package/dist/windows/wifi-connections.js +10 -3
- package/package.json +1 -1
package/dist/linux/disks-io.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.disksIO = void 0;
|
|
4
|
-
const defaults_1 = require("../common/defaults");
|
|
5
|
-
const index_1 = require("../common/index");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const filesys_1 = require("../common/filesys");
|
|
8
4
|
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const defaults_1 = require("../common/defaults");
|
|
9
7
|
const files_1 = require("../common/files");
|
|
8
|
+
const filesys_1 = require("../common/filesys");
|
|
9
|
+
const index_1 = require("../common/index");
|
|
10
10
|
const security_1 = require("../common/security");
|
|
11
|
+
let _diskCount = -1;
|
|
11
12
|
const disksIO = async () => {
|
|
12
13
|
await (0, common_1.nextTick)();
|
|
13
14
|
if ((filesys_1._disk_io && !filesys_1._disk_io.ms) || (filesys_1._disk_io && filesys_1._disk_io.ms && Date.now() - filesys_1._disk_io.ms >= 500)) {
|
|
@@ -17,10 +18,12 @@ const disksIO = async () => {
|
|
|
17
18
|
let rWaitTime = 0;
|
|
18
19
|
let wWaitTime = 0;
|
|
19
20
|
let tWaitTime = 0;
|
|
21
|
+
let busyTime = 0;
|
|
22
|
+
let diskCount = 0;
|
|
20
23
|
try {
|
|
21
24
|
const disks = (await (0, promises_1.readdir)('/sys/block')).filter((dev) => !/^(loop|ram|zram|dm-|md|sr|fd|nbd|zd)/.test(dev) && (0, security_1.isSafePathSegment)(dev));
|
|
22
25
|
const lines = await Promise.all(disks.map((dev) => (0, files_1.readSysfs)(`/sys/block/${dev}/stat`)));
|
|
23
|
-
lines.forEach(
|
|
26
|
+
lines.forEach((line) => {
|
|
24
27
|
if (!line) {
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
@@ -30,8 +33,14 @@ const disksIO = async () => {
|
|
|
30
33
|
rWaitTime += (0, common_1.toInt)(stats[3]);
|
|
31
34
|
wWaitTime += (0, common_1.toInt)(stats[7]);
|
|
32
35
|
tWaitTime += (0, common_1.toInt)(stats[10]);
|
|
36
|
+
busyTime += (0, common_1.toInt)(stats[9]);
|
|
37
|
+
diskCount++;
|
|
33
38
|
});
|
|
34
|
-
|
|
39
|
+
if (diskCount !== _diskCount) {
|
|
40
|
+
filesys_1._disk_io.busyTime = null;
|
|
41
|
+
_diskCount = diskCount;
|
|
42
|
+
}
|
|
43
|
+
return (0, filesys_1.calcDiskIO)(rIO, wIO, rWaitTime, wWaitTime, tWaitTime, diskCount ? busyTime / diskCount : null);
|
|
35
44
|
}
|
|
36
45
|
catch {
|
|
37
46
|
return defaults;
|
|
@@ -51,7 +60,9 @@ const disksIO = async () => {
|
|
|
51
60
|
tWaitTime: filesys_1._disk_io.tWaitTimeDelta,
|
|
52
61
|
rWaitPercent: filesys_1._disk_io.rWaitPercent,
|
|
53
62
|
wWaitPercent: filesys_1._disk_io.wWaitPercent,
|
|
54
|
-
tWaitPercent: filesys_1._disk_io.tWaitPercent
|
|
63
|
+
tWaitPercent: filesys_1._disk_io.tWaitPercent,
|
|
64
|
+
busyPercent: filesys_1._disk_io.busyPercent,
|
|
65
|
+
idlePercent: filesys_1._disk_io.idlePercent
|
|
55
66
|
};
|
|
56
67
|
}
|
|
57
68
|
};
|
package/dist/linux/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { cpuTemperature } from './cpu-temperature';
|
|
|
14
14
|
export { fans } from './fans';
|
|
15
15
|
export { currentLoad } from '../cpu-current-load';
|
|
16
16
|
export { diskLayout } from './disk-layout';
|
|
17
|
+
export { diskSpeed } from './disk-speed';
|
|
17
18
|
export { disksIO } from './disks-io';
|
|
18
19
|
export { displays } from './displays';
|
|
19
20
|
export { dockerInfo, dockerImages, dockerContainers, dockerContainerStats, dockerContainerProcesses, dockerVolumes, dockerAll } from '../docker';
|
|
@@ -23,6 +24,7 @@ export { fsStats } from './fs-stats';
|
|
|
23
24
|
export { fullLoad } from '../cpu-full-load';
|
|
24
25
|
export { gpu } from './gpu';
|
|
25
26
|
export { inetChecksite } from '../inet-checksite';
|
|
27
|
+
export { inetSpeed } from '../inet-speed';
|
|
26
28
|
export { inetLatency } from './inet-latency';
|
|
27
29
|
export { keyboard } from './keyboard';
|
|
28
30
|
export { mem } from './mem';
|
|
@@ -32,6 +34,7 @@ export { networkConnections } from './network-connections';
|
|
|
32
34
|
export { networkGatewayDefault } from './network-gateway-default';
|
|
33
35
|
export { networkInterfaceDefault } from './network-interface-default';
|
|
34
36
|
export { networkInterfaces } from './network-interfaces';
|
|
37
|
+
export { networkRoutes } from './network-routes';
|
|
35
38
|
export { networkStats } from './network-stats';
|
|
36
39
|
export { npm } from './npm';
|
|
37
40
|
export { npu } from './npu';
|
package/dist/linux/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = void 0;
|
|
3
|
+
exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkRoutes = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetSpeed = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskSpeed = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processFocused = exports.processLoad = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -34,6 +34,8 @@ var cpu_current_load_1 = require("../cpu-current-load");
|
|
|
34
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
35
35
|
var disk_layout_1 = require("./disk-layout");
|
|
36
36
|
Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
|
|
37
|
+
var disk_speed_1 = require("./disk-speed");
|
|
38
|
+
Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
|
|
37
39
|
var disks_io_1 = require("./disks-io");
|
|
38
40
|
Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
|
|
39
41
|
var displays_1 = require("./displays");
|
|
@@ -58,6 +60,8 @@ var gpu_1 = require("./gpu");
|
|
|
58
60
|
Object.defineProperty(exports, "gpu", { enumerable: true, get: function () { return gpu_1.gpu; } });
|
|
59
61
|
var inet_checksite_1 = require("../inet-checksite");
|
|
60
62
|
Object.defineProperty(exports, "inetChecksite", { enumerable: true, get: function () { return inet_checksite_1.inetChecksite; } });
|
|
63
|
+
var inet_speed_1 = require("../inet-speed");
|
|
64
|
+
Object.defineProperty(exports, "inetSpeed", { enumerable: true, get: function () { return inet_speed_1.inetSpeed; } });
|
|
61
65
|
var inet_latency_1 = require("./inet-latency");
|
|
62
66
|
Object.defineProperty(exports, "inetLatency", { enumerable: true, get: function () { return inet_latency_1.inetLatency; } });
|
|
63
67
|
var keyboard_1 = require("./keyboard");
|
|
@@ -76,6 +80,8 @@ var network_interface_default_1 = require("./network-interface-default");
|
|
|
76
80
|
Object.defineProperty(exports, "networkInterfaceDefault", { enumerable: true, get: function () { return network_interface_default_1.networkInterfaceDefault; } });
|
|
77
81
|
var network_interfaces_1 = require("./network-interfaces");
|
|
78
82
|
Object.defineProperty(exports, "networkInterfaces", { enumerable: true, get: function () { return network_interfaces_1.networkInterfaces; } });
|
|
83
|
+
var network_routes_1 = require("./network-routes");
|
|
84
|
+
Object.defineProperty(exports, "networkRoutes", { enumerable: true, get: function () { return network_routes_1.networkRoutes; } });
|
|
79
85
|
var network_stats_1 = require("./network-stats");
|
|
80
86
|
Object.defineProperty(exports, "networkStats", { enumerable: true, get: function () { return network_stats_1.networkStats; } });
|
|
81
87
|
var npm_1 = require("./npm");
|
package/dist/linux/mem.js
CHANGED
|
@@ -24,6 +24,24 @@ const parseArcstats = (lines) => {
|
|
|
24
24
|
return Math.max(size - cMin, 0);
|
|
25
25
|
};
|
|
26
26
|
exports.parseArcstats = parseArcstats;
|
|
27
|
+
const _swap = { pswpin: 0, pswpout: 0, ms: 0, swapin_sec: null, swapout_sec: null };
|
|
28
|
+
const swapActivity = async () => {
|
|
29
|
+
const lines = await (0, files_1.readFileLines)('/proc/vmstat');
|
|
30
|
+
const pswpin = (0, common_1.toInt)((0, common_1.getValue)(lines, 'pswpin', ' '));
|
|
31
|
+
const pswpout = (0, common_1.toInt)((0, common_1.getValue)(lines, 'pswpout', ' '));
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (lines.length && _swap.ms && now > _swap.ms) {
|
|
34
|
+
const seconds = (now - _swap.ms) / 1000;
|
|
35
|
+
_swap.swapin_sec = Math.max(0, pswpin - _swap.pswpin) / seconds;
|
|
36
|
+
_swap.swapout_sec = Math.max(0, pswpout - _swap.pswpout) / seconds;
|
|
37
|
+
}
|
|
38
|
+
if (lines.length) {
|
|
39
|
+
_swap.pswpin = pswpin;
|
|
40
|
+
_swap.pswpout = pswpout;
|
|
41
|
+
_swap.ms = now;
|
|
42
|
+
}
|
|
43
|
+
return { swapin_sec: _swap.swapin_sec, swapout_sec: _swap.swapout_sec };
|
|
44
|
+
};
|
|
27
45
|
const mem = async () => {
|
|
28
46
|
await (0, common_1.nextTick)();
|
|
29
47
|
const defaults = (0, common_1.cloneObj)(defaults_1.initMemData);
|
|
@@ -72,7 +90,8 @@ const mem = async () => {
|
|
|
72
90
|
swapused,
|
|
73
91
|
swapfree,
|
|
74
92
|
writeback,
|
|
75
|
-
dirty
|
|
93
|
+
dirty,
|
|
94
|
+
...(await swapActivity())
|
|
76
95
|
};
|
|
77
96
|
}
|
|
78
97
|
catch { }
|
|
@@ -192,7 +192,10 @@ const getLinuxGateways = async () => {
|
|
|
192
192
|
const PCI_SLOT = /^[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]$/i;
|
|
193
193
|
const pciSlotFromPath = (path) => {
|
|
194
194
|
const segments = path.split('/');
|
|
195
|
-
return segments
|
|
195
|
+
return (segments
|
|
196
|
+
.slice(-2)
|
|
197
|
+
.reverse()
|
|
198
|
+
.find((segment) => PCI_SLOT.test(segment)) || null);
|
|
196
199
|
};
|
|
197
200
|
exports.pciSlotFromPath = pciSlotFromPath;
|
|
198
201
|
const _nicHardware = {};
|
|
@@ -241,7 +244,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
241
244
|
return (0, network_1.filterDefaultInterface)(_networkInterfaces, defaultString);
|
|
242
245
|
}
|
|
243
246
|
_interfaces = (0, index_1.cloneObj)(interfaces);
|
|
244
|
-
|
|
247
|
+
const result = [];
|
|
245
248
|
try {
|
|
246
249
|
const [_dhcpNics, defaultInterface, deviceStatus, gateways, sysfsDevices, wirelessLines] = await Promise.all([
|
|
247
250
|
getLinuxDHCPNics(),
|
|
@@ -314,19 +317,25 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
314
317
|
const ifaceSanitized = (0, security_1.sanitizeString)(ifaceDevName, true);
|
|
315
318
|
let lines = [];
|
|
316
319
|
let hasDevice = true;
|
|
320
|
+
let bridgeMembers = [];
|
|
317
321
|
try {
|
|
318
322
|
const safe = (0, security_1.isSafePathSegment)(ifaceSanitized);
|
|
319
323
|
const connectionName = getLinuxIfaceConnectionName(deviceStatus, ifaceSanitized);
|
|
320
|
-
const [sysfsLines, iwOut, details, device] = await Promise.all([
|
|
324
|
+
const [sysfsLines, iwOut, details, device, brif] = await Promise.all([
|
|
321
325
|
safe ? (0, files_1.readSysfsMany)(`/sys/class/net/${ifaceSanitized}`, ['address', 'carrier_changes', 'duplex', 'mtu', 'operstate', 'speed', 'type']) : [],
|
|
322
326
|
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/phy80211`).then((wifi) => (wifi ? (0, exec_1.execSecure)('iw', ['dev', ifaceSanitized, 'link'], EXEC_OPTS) : '')) : '',
|
|
323
327
|
getLinuxConnectionDetails(connectionName),
|
|
324
|
-
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/device`) : true
|
|
328
|
+
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/device`) : true,
|
|
329
|
+
safe ? (0, promises_1.readdir)(`/sys/class/net/${ifaceSanitized}/brif`).catch(() => []) : []
|
|
325
330
|
]);
|
|
326
331
|
hasDevice = device;
|
|
332
|
+
bridgeMembers = brif.sort();
|
|
327
333
|
lines = sysfsLines;
|
|
328
334
|
lines.push(`wireless: ${wirelessLines.find((line) => line.indexOf(ifaceSanitized) >= 0) || ''}`);
|
|
329
|
-
lines.push(...iwOut
|
|
335
|
+
lines.push(...iwOut
|
|
336
|
+
.split('\n')
|
|
337
|
+
.filter((line) => line.indexOf('bitrate') >= 0)
|
|
338
|
+
.map((line) => line.trim()));
|
|
330
339
|
dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, details, _dhcpNics);
|
|
331
340
|
dnsSuffix = getLinuxIfaceDNSsuffix(details);
|
|
332
341
|
ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(details);
|
|
@@ -347,7 +356,8 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
347
356
|
}
|
|
348
357
|
carrierChanges = (0, common_1.toInt)((0, common_1.getValue)(lines, 'carrier_changes'));
|
|
349
358
|
const operstate = (0, common_1.getValue)(lines, 'operstate');
|
|
350
|
-
|
|
359
|
+
const arphrd = (0, common_1.toInt)((0, common_1.getValue)(lines, 'type'));
|
|
360
|
+
type = (0, common_1.getValue)(lines, 'wireless').trim() ? 'wireless' : arphrd === 1 ? 'wired' : arphrd === 280 ? 'can' : 'unknown';
|
|
351
361
|
if (ifaceSanitized === 'lo' || ifaceSanitized.startsWith('bond')) {
|
|
352
362
|
type = 'virtual';
|
|
353
363
|
}
|
|
@@ -380,7 +390,8 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
380
390
|
dnsSuffix,
|
|
381
391
|
ieee8021xAuth,
|
|
382
392
|
ieee8021xState,
|
|
383
|
-
carrierChanges
|
|
393
|
+
carrierChanges,
|
|
394
|
+
bridgeMembers
|
|
384
395
|
};
|
|
385
396
|
};
|
|
386
397
|
for (let i = 0; i < devices.length; i += SCAN_CONCURRENCY) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NetworkRouteData } from '../common/types';
|
|
2
|
+
export declare const parseIpRoutes: (stdout: string, family: string) => NetworkRouteData[] | null;
|
|
3
|
+
export declare const parseProcRoutes: (lines: string[]) => NetworkRouteData[];
|
|
4
|
+
export declare const networkRoutes: () => Promise<NetworkRouteData[]>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkRoutes = exports.parseProcRoutes = exports.parseIpRoutes = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const exec_1 = require("../common/exec");
|
|
6
|
+
const files_1 = require("../common/files");
|
|
7
|
+
const EXEC_OPTS = { timeout: 5000, maxBuffer: 1024 * 1024 * 16 };
|
|
8
|
+
const toCidr = (dst, family) => {
|
|
9
|
+
if (!dst || dst === 'default') {
|
|
10
|
+
return family === 'IPv6' ? '::/0' : '0.0.0.0/0';
|
|
11
|
+
}
|
|
12
|
+
return dst.includes('/') ? dst : `${dst}/${family === 'IPv6' ? 128 : 32}`;
|
|
13
|
+
};
|
|
14
|
+
const parseIpRoutes = (stdout, family) => {
|
|
15
|
+
let routes = [];
|
|
16
|
+
try {
|
|
17
|
+
routes = JSON.parse(stdout);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (!Array.isArray(routes)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const result = [];
|
|
26
|
+
for (const route of routes) {
|
|
27
|
+
const destination = toCidr(String(route?.dst || ''), family);
|
|
28
|
+
const metric = typeof route?.metric === 'number' ? route.metric : 0;
|
|
29
|
+
const hops = Array.isArray(route?.nexthops) && route.nexthops.length ? route.nexthops : [route];
|
|
30
|
+
for (const hop of hops) {
|
|
31
|
+
result.push({ destination, gateway: String(hop?.gateway || ''), iface: String(hop?.dev || ''), metric, family });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
exports.parseIpRoutes = parseIpRoutes;
|
|
37
|
+
const hexToIp = (hex) => (hex.match(/../g) || [])
|
|
38
|
+
.reverse()
|
|
39
|
+
.map((byte) => parseInt(byte, 16))
|
|
40
|
+
.join('.');
|
|
41
|
+
const parseProcRoutes = (lines) => lines
|
|
42
|
+
.slice(1)
|
|
43
|
+
.map((line) => line.trim().split(/\s+/))
|
|
44
|
+
.filter((parts) => parts.length >= 8 && (parseInt(parts[3] || '0', 16) & 1) === 1)
|
|
45
|
+
.map((parts) => {
|
|
46
|
+
const prefix = (parseInt(parts[7] || '0', 16) >>> 0).toString(2).replace(/0/g, '').length;
|
|
47
|
+
const gateway = hexToIp(parts[2] || '');
|
|
48
|
+
return {
|
|
49
|
+
destination: `${hexToIp(parts[1] || '')}/${prefix}`,
|
|
50
|
+
gateway: gateway === '0.0.0.0' ? '' : gateway,
|
|
51
|
+
iface: parts[0] || '',
|
|
52
|
+
metric: parseInt(parts[6] || '', 10) || 0,
|
|
53
|
+
family: 'IPv4'
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
exports.parseProcRoutes = parseProcRoutes;
|
|
57
|
+
const networkRoutes = async () => {
|
|
58
|
+
await (0, common_1.nextTick)();
|
|
59
|
+
try {
|
|
60
|
+
const [v4, v6] = await Promise.all([(0, exec_1.execFile)('ip', ['-j', 'route', 'show'], EXEC_OPTS), (0, exec_1.execFile)('ip', ['-j', '-6', 'route', 'show'], EXEC_OPTS).catch(() => ({ stdout: '[]' }))]);
|
|
61
|
+
const routes = (0, exports.parseIpRoutes)(v4.stdout.toString(), 'IPv4');
|
|
62
|
+
if (routes) {
|
|
63
|
+
return [...routes, ...((0, exports.parseIpRoutes)(v6.stdout.toString(), 'IPv6') || [])];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
return (0, exports.parseProcRoutes)(await (0, files_1.readFileLines)('/proc/net/route'));
|
|
68
|
+
};
|
|
69
|
+
exports.networkRoutes = networkRoutes;
|
package/dist/linux/os-info.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.osInfo = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
4
5
|
const common_1 = require("../common");
|
|
5
6
|
const codepage_1 = require("../common/codepage");
|
|
6
7
|
const const_1 = require("../common/const");
|
|
7
8
|
const defaults_1 = require("../common/defaults");
|
|
8
9
|
const exec_1 = require("../common/exec");
|
|
9
|
-
const promises_1 = require("node:fs/promises");
|
|
10
10
|
const files_1 = require("../common/files");
|
|
11
11
|
const mappings_1 = require("../common/mappings");
|
|
12
|
-
const uuid_1 = require("./uuid");
|
|
13
12
|
const security_1 = require("../common/security");
|
|
13
|
+
const uuid_1 = require("./uuid");
|
|
14
14
|
const getInstallDate = async () => {
|
|
15
15
|
try {
|
|
16
16
|
const { stdout } = await (0, exec_1.exec)('stat -c %W / 2>/dev/null', const_1.execOptsLinux);
|
|
@@ -104,6 +104,33 @@ const getSecurity = async () => {
|
|
|
104
104
|
}
|
|
105
105
|
return { module: '', enabled: false, mode: '', policy: '' };
|
|
106
106
|
};
|
|
107
|
+
const UBUNTU_FLAVORS = [
|
|
108
|
+
['ubuntustudio-desktop', 'Ubuntu Studio'],
|
|
109
|
+
['kubuntu-desktop', 'Kubuntu'],
|
|
110
|
+
['xubuntu-desktop', 'Xubuntu'],
|
|
111
|
+
['lubuntu-desktop', 'Lubuntu'],
|
|
112
|
+
['ubuntu-mate-desktop', 'Ubuntu MATE'],
|
|
113
|
+
['ubuntu-budgie-desktop', 'Ubuntu Budgie'],
|
|
114
|
+
['ubuntucinnamon-desktop', 'Ubuntu Cinnamon'],
|
|
115
|
+
['ubuntu-unity-desktop', 'Ubuntu Unity'],
|
|
116
|
+
['ubuntukylin-desktop', 'Ubuntu Kylin']
|
|
117
|
+
];
|
|
118
|
+
const getDistroVariant = async (distro, variant) => {
|
|
119
|
+
if (distro.toLowerCase() === 'ubuntu') {
|
|
120
|
+
const installed = await Promise.all(UBUNTU_FLAVORS.map(([pkg]) => (0, files_1.fileExists)(`/var/lib/dpkg/info/${pkg}.list`)));
|
|
121
|
+
const flavor = UBUNTU_FLAVORS.find((_, i) => installed[i]);
|
|
122
|
+
if (flavor) {
|
|
123
|
+
return flavor[1];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (distro.toLowerCase().startsWith('debian') && (await (0, files_1.fileExists)('/etc/rpi-issue'))) {
|
|
127
|
+
return 'Raspberry Pi OS';
|
|
128
|
+
}
|
|
129
|
+
if (distro.toLowerCase().startsWith('fedora') && variant && !/edition|container/i.test(variant)) {
|
|
130
|
+
return `${distro} (${variant})`;
|
|
131
|
+
}
|
|
132
|
+
return distro;
|
|
133
|
+
};
|
|
107
134
|
const parseOsInfo = async (stdout, defaults) => {
|
|
108
135
|
const release = {};
|
|
109
136
|
const lines = stdout.toString().split('\n');
|
|
@@ -123,10 +150,11 @@ const parseOsInfo = async (stdout, defaults) => {
|
|
|
123
150
|
codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim();
|
|
124
151
|
releaseVersion = releaseVersion.split('(')[0].trim();
|
|
125
152
|
}
|
|
153
|
+
const distroName = await getDistroVariant(distro, (release.VARIANT || '').replace(/"/g, '').trim());
|
|
126
154
|
return {
|
|
127
155
|
...defaults,
|
|
128
|
-
distro:
|
|
129
|
-
logofile: (0, mappings_1.getLogoFile)(
|
|
156
|
+
distro: distroName,
|
|
157
|
+
logofile: (0, mappings_1.getLogoFile)(distroName),
|
|
130
158
|
release: (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, ''),
|
|
131
159
|
codename: codename,
|
|
132
160
|
codepage: (0, codepage_1.getCodepage)(),
|
package/dist/linux/pci.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PciData } from '../common/types';
|
|
1
|
+
import type { PciData } from '../common/types';
|
|
2
2
|
export declare const pci: () => Promise<PciData[]>;
|
package/dist/linux/pci.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pci = void 0;
|
|
4
|
-
const exec_1 = require("../common/exec");
|
|
5
4
|
const common_1 = require("../common");
|
|
6
|
-
const defaults_1 = require("../common/defaults");
|
|
7
5
|
const const_1 = require("../common/const");
|
|
6
|
+
const defaults_1 = require("../common/defaults");
|
|
7
|
+
const exec_1 = require("../common/exec");
|
|
8
8
|
const splitId = (value) => {
|
|
9
9
|
const match = value.match(/^(.*?)\s*\[([0-9a-fA-F]{4})\]\s*$/);
|
|
10
10
|
if (match) {
|
|
@@ -38,7 +38,8 @@ const parsePci = (stdout) => {
|
|
|
38
38
|
subVendorId: svendor.id,
|
|
39
39
|
subDeviceId: sdevice.id,
|
|
40
40
|
revision: (0, common_1.getValue)(lines, 'Rev', ':', true),
|
|
41
|
-
driver: (0, common_1.getValue)(lines, 'Driver', ':', true)
|
|
41
|
+
driver: (0, common_1.getValue)(lines, 'Driver', ':', true),
|
|
42
|
+
iommuGroup: (0, common_1.getValue)(lines, 'IOMMUGroup', ':', true)
|
|
42
43
|
});
|
|
43
44
|
});
|
|
44
45
|
return result;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wifiConnections = void 0;
|
|
3
|
+
exports.wifiConnections = exports.parseIwLinkRates = void 0;
|
|
4
4
|
const node_os_1 = require("node:os");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const const_1 = require("../common/const");
|
|
@@ -159,6 +159,22 @@ const getWifiNetworkListNmi = async () => {
|
|
|
159
159
|
return [];
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
|
+
const parseIwLinkRates = (stdout) => {
|
|
163
|
+
const rate = (direction) => {
|
|
164
|
+
const match = stdout.match(new RegExp(`${direction} bitrate:\\s*([\\d.]+)\\s*MBit/s`, 'i'));
|
|
165
|
+
return match?.[1] ? parseFloat(match[1]) : null;
|
|
166
|
+
};
|
|
167
|
+
return { txRate: rate('tx'), rxRate: rate('rx') };
|
|
168
|
+
};
|
|
169
|
+
exports.parseIwLinkRates = parseIwLinkRates;
|
|
170
|
+
const linkRatesLinux = async (networkInterface) => {
|
|
171
|
+
try {
|
|
172
|
+
return (0, exports.parseIwLinkRates)(await (0, exec_1.execSecure)('iw', ['dev', networkInterface, 'link'], { timeout: 5000 }));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return { txRate: null, rxRate: null };
|
|
176
|
+
}
|
|
177
|
+
};
|
|
162
178
|
const wifiConnections = async () => {
|
|
163
179
|
await (0, common_1.nextTick)();
|
|
164
180
|
const result = [];
|
|
@@ -175,6 +191,7 @@ const wifiConnections = async () => {
|
|
|
175
191
|
const bssid = network?.length && network[0].bssid ? network[0].bssid : wpaDetails.bssid || null;
|
|
176
192
|
const signalLevel = network && network.length && network[0].signalLevel ? network[0].signalLevel : 0;
|
|
177
193
|
if (ssid && bssid) {
|
|
194
|
+
const rates = await linkRatesLinux(networkInterface);
|
|
178
195
|
result.push({
|
|
179
196
|
id: '' + interfaceDetail.id,
|
|
180
197
|
networkInterface: interfaceDetail.networkInterface,
|
|
@@ -187,7 +204,8 @@ const wifiConnections = async () => {
|
|
|
187
204
|
security: nmiConnection.security ? nmiConnection.security : wpaDetails.security || null,
|
|
188
205
|
signalLevel,
|
|
189
206
|
quality: (0, network_1.wifiQualityFromDB)(signalLevel),
|
|
190
|
-
txRate:
|
|
207
|
+
txRate: rates.txRate,
|
|
208
|
+
rxRate: rates.rxRate
|
|
191
209
|
});
|
|
192
210
|
}
|
|
193
211
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const networkRoutes: () => Promise<import("./common/types").NetworkRouteData[] | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkRoutes = void 0;
|
|
4
|
+
const const_1 = require("./common/const");
|
|
5
|
+
const networkRoutes = async () => {
|
|
6
|
+
switch (true) {
|
|
7
|
+
case const_1.LINUX:
|
|
8
|
+
return (await import('./linux/network-routes.js')).networkRoutes();
|
|
9
|
+
case const_1.DARWIN || const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD:
|
|
10
|
+
return (await import('./darwin/network-routes.js')).networkRoutes();
|
|
11
|
+
case const_1.WINDOWS:
|
|
12
|
+
return (await import('./windows/network-routes.js')).networkRoutes();
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.networkRoutes = networkRoutes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.powerShellRelease = exports.powerShellStart = void 0;
|
|
4
|
+
const const_1 = require("./common/const");
|
|
5
|
+
const windows_1 = require("./common/windows");
|
|
6
|
+
const powerShellStart = async () => {
|
|
7
|
+
if (const_1.WINDOWS) {
|
|
8
|
+
await windows_1.ps.start();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.powerShellStart = powerShellStart;
|
|
12
|
+
const powerShellRelease = async () => {
|
|
13
|
+
await windows_1.ps.stop();
|
|
14
|
+
};
|
|
15
|
+
exports.powerShellRelease = powerShellRelease;
|
package/dist/sun/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { fullLoad } from '../cpu-full-load';
|
|
|
4
4
|
export { networkInterfaceDefault } from '../darwin/network-interface-default';
|
|
5
5
|
export { dockerAll, dockerContainerProcesses, dockerContainers, dockerContainerStats, dockerImages, dockerInfo, dockerVolumes } from '../docker';
|
|
6
6
|
export { inetChecksite } from '../inet-checksite';
|
|
7
|
+
export { inetSpeed } from '../inet-speed';
|
|
7
8
|
export { processLoad } from '../linux/process-load';
|
|
8
9
|
export { processes } from '../linux/processes';
|
|
9
10
|
export { npm } from '../npm';
|
package/dist/sun/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.users = exports.osInfo = exports.inetLatency = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.shell = exports.npm = exports.processes = exports.processLoad = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.networkInterfaceDefault = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
|
|
3
|
+
exports.users = exports.osInfo = exports.inetLatency = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.shell = exports.npm = exports.processes = exports.processLoad = exports.inetSpeed = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.networkInterfaceDefault = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
|
|
4
4
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
5
5
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
6
6
|
var cpu_current_speed_1 = require("../cpu-current-speed");
|
|
@@ -19,6 +19,8 @@ Object.defineProperty(exports, "dockerInfo", { enumerable: true, get: function (
|
|
|
19
19
|
Object.defineProperty(exports, "dockerVolumes", { enumerable: true, get: function () { return docker_1.dockerVolumes; } });
|
|
20
20
|
var inet_checksite_1 = require("../inet-checksite");
|
|
21
21
|
Object.defineProperty(exports, "inetChecksite", { enumerable: true, get: function () { return inet_checksite_1.inetChecksite; } });
|
|
22
|
+
var inet_speed_1 = require("../inet-speed");
|
|
23
|
+
Object.defineProperty(exports, "inetSpeed", { enumerable: true, get: function () { return inet_speed_1.inetSpeed; } });
|
|
22
24
|
var process_load_1 = require("../linux/process-load");
|
|
23
25
|
Object.defineProperty(exports, "processLoad", { enumerable: true, get: function () { return process_load_1.processLoad; } });
|
|
24
26
|
var processes_1 = require("../linux/processes");
|
|
@@ -33,7 +33,12 @@ const parseBlockDevices = (logicalDisks, volumes) => {
|
|
|
33
33
|
removable: drivetype === 2,
|
|
34
34
|
protocol: '',
|
|
35
35
|
group: '',
|
|
36
|
-
device: ''
|
|
36
|
+
device: '',
|
|
37
|
+
partUuid: '',
|
|
38
|
+
partLabel: '',
|
|
39
|
+
partType: '',
|
|
40
|
+
partFlags: '',
|
|
41
|
+
partStart: null
|
|
37
42
|
});
|
|
38
43
|
}
|
|
39
44
|
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cpuTopology = exports.parseCpuTopology = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const windows_1 = require("../common/windows");
|
|
6
|
+
const TOPOLOGY_SOURCE = `
|
|
7
|
+
using System;
|
|
8
|
+
using System.Runtime.InteropServices;
|
|
9
|
+
public static class SiCpuTopology {
|
|
10
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
11
|
+
static extern bool GetLogicalProcessorInformationEx(int relationship, IntPtr buffer, ref uint length);
|
|
12
|
+
[DllImport("kernel32.dll")]
|
|
13
|
+
static extern ushort GetActiveProcessorGroupCount();
|
|
14
|
+
[DllImport("kernel32.dll")]
|
|
15
|
+
static extern uint GetActiveProcessorCount(ushort group);
|
|
16
|
+
|
|
17
|
+
public static string Get() {
|
|
18
|
+
int groups = GetActiveProcessorGroupCount();
|
|
19
|
+
int[] offset = new int[groups + 1];
|
|
20
|
+
for (int g = 0; g < groups; g++) offset[g + 1] = offset[g] + (int)GetActiveProcessorCount((ushort)g);
|
|
21
|
+
int total = offset[groups];
|
|
22
|
+
int[] core = new int[total];
|
|
23
|
+
int[] socket = new int[total];
|
|
24
|
+
for (int i = 0; i < total; i++) { core[i] = -1; socket[i] = -1; }
|
|
25
|
+
|
|
26
|
+
uint len = 0;
|
|
27
|
+
GetLogicalProcessorInformationEx(0xffff, IntPtr.Zero, ref len);
|
|
28
|
+
if (len == 0) return "";
|
|
29
|
+
IntPtr buf = Marshal.AllocHGlobal((int)len);
|
|
30
|
+
try {
|
|
31
|
+
if (!GetLogicalProcessorInformationEx(0xffff, buf, ref len)) return "";
|
|
32
|
+
// PROCESSOR_RELATIONSHIP: GroupCount at 30, GROUP_AFFINITY[] at 32
|
|
33
|
+
// (KAFFINITY mask + WORD Group + WORD Reserved[3] = 16 bytes on 64 bit, 12 on 32 bit)
|
|
34
|
+
int stride = IntPtr.Size == 8 ? 16 : 12;
|
|
35
|
+
int coreIdx = 0;
|
|
36
|
+
int pkgIdx = 0;
|
|
37
|
+
long pos = 0;
|
|
38
|
+
while (pos < len) {
|
|
39
|
+
IntPtr rec = new IntPtr(buf.ToInt64() + pos);
|
|
40
|
+
int rel = Marshal.ReadInt32(rec, 0);
|
|
41
|
+
int size = Marshal.ReadInt32(rec, 4);
|
|
42
|
+
if (size <= 0) break;
|
|
43
|
+
// 0 = RelationProcessorCore, 3 = RelationProcessorPackage
|
|
44
|
+
if (rel == 0 || rel == 3) {
|
|
45
|
+
int groupCount = Marshal.ReadInt16(rec, 30);
|
|
46
|
+
for (int k = 0; k < groupCount; k++) {
|
|
47
|
+
int entry = 32 + k * stride;
|
|
48
|
+
ulong mask = IntPtr.Size == 8 ? (ulong)Marshal.ReadInt64(rec, entry) : (uint)Marshal.ReadInt32(rec, entry);
|
|
49
|
+
int group = Marshal.ReadInt16(rec, entry + IntPtr.Size);
|
|
50
|
+
if (group < 0 || group >= groups) continue;
|
|
51
|
+
for (int bit = 0; bit < IntPtr.Size * 8; bit++) {
|
|
52
|
+
if (((mask >> bit) & 1UL) == 0) continue;
|
|
53
|
+
int idx = offset[group] + bit;
|
|
54
|
+
if (idx >= total) continue;
|
|
55
|
+
if (rel == 0) core[idx] = coreIdx; else socket[idx] = pkgIdx;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (rel == 0) coreIdx++; else pkgIdx++;
|
|
59
|
+
}
|
|
60
|
+
pos += size;
|
|
61
|
+
}
|
|
62
|
+
} finally {
|
|
63
|
+
Marshal.FreeHGlobal(buf);
|
|
64
|
+
}
|
|
65
|
+
string[] parts = new string[total];
|
|
66
|
+
for (int i = 0; i < total; i++) parts[i] = core[i] + "," + socket[i];
|
|
67
|
+
return String.Join(";", parts);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const toId = (value) => (/^\d+$/.test((value || '').trim()) ? (0, common_1.toInt)(value) : null);
|
|
72
|
+
const parseCpuTopology = (stdout) => stdout
|
|
73
|
+
.trim()
|
|
74
|
+
.split(';')
|
|
75
|
+
.filter((part) => part.includes(','))
|
|
76
|
+
.map((part) => {
|
|
77
|
+
const [coreId, socketId] = part.split(',');
|
|
78
|
+
return { coreId: toId(coreId), socketId: toId(socketId) };
|
|
79
|
+
});
|
|
80
|
+
exports.parseCpuTopology = parseCpuTopology;
|
|
81
|
+
const cpuTopology = async () => {
|
|
82
|
+
try {
|
|
83
|
+
const stdout = await windows_1.ps.exec(`if (-not ('SiCpuTopology' -as [type])) { Add-Type -TypeDefinition @'${TOPOLOGY_SOURCE}'@ }; [SiCpuTopology]::Get()`);
|
|
84
|
+
return (0, exports.parseCpuTopology)(String(stdout || ''));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
exports.cpuTopology = cpuTopology;
|