added virtualHost, AMD processor list, graphics improvement

This commit is contained in:
Sebastian Hildebrandt 2021-01-07 12:59:10 +01:00
parent 53b140ea51
commit ea46cdd2d1
7 changed files with 260 additions and 38 deletions

View File

@ -844,7 +844,9 @@ Intel is a trademark of Intel Corporation, AMD is a trademark of Advanced Micro
Raspberry Pi is a trademark of the Raspberry Pi Foundation, Debian is a trademark of the Debian Project, Raspberry Pi is a trademark of the Raspberry Pi Foundation, Debian is a trademark of the Debian Project,
Ubuntu is a trademark of Canonical Ltd., FreeBSD is a registered trademark of The FreeBSD Foundation, Ubuntu is a trademark of Canonical Ltd., FreeBSD is a registered trademark of The FreeBSD Foundation,
NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark of Docker, Inc., Sun, NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark of Docker, Inc., Sun,
Solaris, OpenSolaris and registered trademarks of Sun Microsystems. Solaris, OpenSolaris and registered trademarks of Sun Microsystems, VMware is a trademark of VMware Inc,
Virtual Box is a trademark of Oracle Corporation, Xen is a registered trademark of Xen Project,
QEMU is a trademark of Fabrice Bellard, bochs is a trademark of The Bochs Project.
All other trademarks are the property of their respective owners. All other trademarks are the property of their respective owners.

View File

@ -59,7 +59,11 @@
<li><strong>Ubuntu</strong> is a trademark of Canonical Ltd.</li> <li><strong>Ubuntu</strong> is a trademark of Canonical Ltd.</li>
<li><strong>CentOS</strong> is a trademark of Read Hat Inc.</li> <li><strong>CentOS</strong> is a trademark of Read Hat Inc.</li>
<li><strong>Sun, Solaris, OpenSolaris</strong> are registered trademarks of Sun Microsystems</li> <li><strong>Sun, Solaris, OpenSolaris</strong> are registered trademarks of Sun Microsystems</li>
<li><strong>Virtual Box</strong> are registered trademarks of Oracle Corporation</li> <li><strong>Virtual Box</strong> is a registered trademark of Oracle Corporation</li>
<li><strong>Xen</strong> is a registered trademark of Xen Project, The Linux Foundation Projects</li>
<li><strong>VMware</strong> is a registered trademark of VMware, Inc.</li>
<li><strong>bochs</strong> is a trademark of The Bochs Project</li>
<li><strong>QEMU</strong> is a trademark of Fabrice Bellard.</li>
<li><strong>BSD</strong> is a registered trademark of UUnet Technologies, Inc.</li> <li><strong>BSD</strong> is a registered trademark of UUnet Technologies, Inc.</li>
<li><strong>UNIX</strong> is a registered trademark of The Open Group.</li> <li><strong>UNIX</strong> is a registered trademark of The Open Group.</li>
<li><strong>NVIDIA</strong> is a registered trademark of NVIDIA Corporation.</li> <li><strong>NVIDIA</strong> is a registered trademark of NVIDIA Corporation.</li>

View File

@ -191,80 +191,203 @@ const AMDBaseFrequencies = {
'FX|9590': '4.7', 'FX|9590': '4.7',
'FX|8320E': '3.2', 'FX|8320E': '3.2',
'FX|8370E': '3.3', 'FX|8370E': '3.3',
'1950X': '3.4',
'1920X': '3.5', // ZEN Desktop CPUs
'1920': '3.2',
'1900X': '3.8',
'1800X': '3.6',
'1700X': '3.4',
'Pro 1700X': '3.5',
'1700': '3.0',
'Pro 1700': '3.0',
'1600X': '3.6',
'1600': '3.2',
'Pro 1600': '3.2',
'1500X': '3.5',
'Pro 1500': '3.5',
'1400': '3.2',
'1300X': '3.5',
'Pro 1300': '3.5',
'1200': '3.1', '1200': '3.1',
'Pro 1200': '3.1', 'Pro 1200': '3.1',
'1300X': '3.5',
'Pro 1300': '3.5',
'1400': '3.2',
'1500X': '3.5',
'Pro 1500': '3.5',
'1600': '3.2',
'1600X': '3.6',
'Pro 1600': '3.2',
'1700': '3.0',
'Pro 1700': '3.0',
'1700X': '3.4',
'Pro 1700X': '3.4',
'1800X': '3.6',
'1900X': '3.8',
'1920': '3.2',
'1920X': '3.5',
'1950X': '3.4',
// ZEN Desktop APUs
'200GE': '3.2',
'Pro 200GE': '3.2',
'220GE': '3.4',
'240GE': '3.5',
'3000G': '3.5',
'300GE': '3.4',
'3050GE': '3.4',
'2200G': '3.5',
'Pro 2200G': '3.5',
'2200GE': '3.2',
'Pro 2200GE': '3.2',
'2400G': '3.6',
'Pro 2400G': '3.6',
'2400GE': '3.2',
'Pro 2400GE': '3.2',
// ZEN Mobile APUs
'Pro 200U': '2.3',
'300U': '2.4',
'2200U': '2.5', '2200U': '2.5',
'3200U': '2.6',
'2300U': '2.0', '2300U': '2.0',
'Pro 2300U': '2.0', 'Pro 2300U': '2.0',
'2500U': '2.0', '2500U': '2.0',
'Pro 2500U': '2.2', 'Pro 2500U': '2.2',
'2600H': '3.2',
'2700U': '2.0', '2700U': '2.0',
'Pro 2700U': '2.2', 'Pro 2700U': '2.2',
'2600H': '3.2',
'2800H': '3.3', '2800H': '3.3',
'7601': '2.2',
'7551': '2.0', // ZEN Server Processors
'7501': '2.0',
'74501': '2.3',
'7401': '2.0',
'7351': '2.4', '7351': '2.4',
'7301': '2.2',
'7281': '2.1',
'7251': '2.1',
'7551P': '2.0',
'7401P': '2.0',
'7351P': '2.4', '7351P': '2.4',
'7401': '2.0',
'7401P': '2.0',
'7551P': '2.0',
'7551': '2.0',
'7251': '2.1',
'7261': '2.5',
'7281': '2.1',
'7301': '2.2',
'7371': '3.1',
'7451': '2.3',
'7501': '2.0',
'7571': '2.2',
'7601': '2.2',
// ZEN Embedded Processors
'V1500B': '2.2',
'V1780B': '3.35',
'V1202B': '2.3',
'V1404I': '2.0',
'V1605B': '2.0',
'V1756B': '3.25',
'V1807B': '3.35',
'3101': '2.1',
'3151': '2.7',
'3201': '1.5',
'3251': '2.5',
'3255': '2.5',
'3301': '2.0',
'3351': '1.9',
'3401': '1.85',
'3451': '2.15',
// ZEN+ Desktop
'1200|AF': '3.1',
'2300X': '3.5', '2300X': '3.5',
'2500X': '3.6', '2500X': '3.6',
'2600': '3.4', '2600': '3.4',
'2600E': '3.1', '2600E': '3.1',
'1600|AF': '3.2',
'2600X': '3.6', '2600X': '3.6',
'2700': '3.2', '2700': '3.2',
'2700E': '2.8', '2700E': '2.8',
'Pro 2700': '3.2',
'2700X': '3.7', '2700X': '3.7',
'Pro 2700X': '3.6', 'Pro 2700X': '3.6',
'2920': '3.5', '2920X': '3.5',
'2950': '3.5', '2950X': '3.5',
'2970WX': '3.0', '2970WX': '3.0',
'2990WX': '3.0', '2990WX': '3.0',
'3200U': '2.6',
// ZEN+ Desktop APU
'Pro 300GE': '3.4',
'Pro 3125GE': '3.4',
'3150G': '3.5',
'Pro 3150G': '3.5',
'3150GE': '3.3',
'Pro 3150GE': '3.3',
'3200G': '3.6',
'Pro 3200G': '3.6',
'3200GE': '3.3',
'Pro 3200GE': '3.3',
'3350G': '3.6',
'Pro 3350G': '3.6',
'3350GE': '3.3',
'Pro 3350GE': '3.3',
'3400G': '3.7',
'Pro 3400G': '3.7',
'3400GE': '3.3',
'Pro 3400GE': '3.3',
// ZEN+ Mobile
'3300U': '2.1', '3300U': '2.1',
'PRO 3300U': '2.1',
'3450U': '2.1',
'3500U': '2.1', '3500U': '2.1',
'PRO 3500U': '2.1',
'3500C': '2.1',
'3550H': '2.1', '3550H': '2.1',
'3580U': '2.1', '3580U': '2.1',
'3700U': '2.3', '3700U': '2.3',
'PRO 3700U': '2.3',
'3700C': '2.3',
'3750H': '2.3', '3750H': '2.3',
'3780U': '2.3', '3780U': '2.3',
// ZEN2 Desktop CPUS
'3100': '3.6',
'3300X': '3.8',
'3500': '3.6',
'3500X': '3.6', '3500X': '3.6',
'3600': '3.6', '3600': '3.6',
'Pro 3600': '3.6', 'Pro 3600': '3.6',
'3600X': '3.8', '3600X': '3.8',
'3600XT': '3.8',
'Pro 3700': '3.6', 'Pro 3700': '3.6',
'3700X': '3.6', '3700X': '3.6',
'3800X': '3.9', '3800X': '3.9',
'3800XT': '3.9',
'3900': '3.1', '3900': '3.1',
'Pro 3900': '3.1', 'Pro 3900': '3.1',
'3900X': '3.8', '3900X': '3.8',
'3900XT': '3.8',
'3950X': '3.5', '3950X': '3.5',
'3960X': '3.8', '3960X': '3.8',
'3970X': '3.7', '3970X': '3.7',
'3990X': '2.9',
'3945WX': '4.0',
'3955WX': '3.9',
'3975WX': '3.5',
'3995WX': '2.7',
// ZEN2 Desktop APUs
'4300GE': '3.5',
'Pro 4300GE': '3.5',
'4300G': '3.8',
'Pro 4300G': '3.8',
'4600GE': '3.3',
'Pro 4650GE': '3.3',
'4600G': '3.7',
'Pro 4650G': '3.7',
'4700GE': '3.1',
'Pro 4750GE': '3.1',
'4700G': '3.6',
'Pro 4750G': '3.6',
'4300U': '2.7',
'Pro 4450U': '2.5',
'4500U': '2.3',
'4600U': '2.1',
'PRO 4650U': '2.1',
'4600HS': '3.0',
'4600H': '3.0',
'4700U': '2.0',
'PRO 4750U': '1.7',
'4800U': '1.8',
'4800HS': '2.9',
'4800H': '2.9',
'4900HS': '3.0',
'4900H': '3.3',
// ZEN2 - EPYC
'7232P': '3.1', '7232P': '3.1',
'7302P': '3.0', '7302P': '3.0',
'7402P': '2.8', '7402P': '2.8',
@ -279,12 +402,23 @@ const AMDBaseFrequencies = {
'7402': '2.8', '7402': '2.8',
'7452': '2.35', '7452': '2.35',
'7502': '2.5', '7502': '2.5',
'7532': '2.4',
'7542': '2.9', '7542': '2.9',
'7552': '2.2', '7552': '2.2',
'7642': '2.3', '7642': '2.3',
'7662': '2.0',
'7702': '2.0', '7702': '2.0',
'7742': '2.25', '7742': '2.25',
'7H12': '2.6' '7H12': '2.6',
'7F32': '3.7',
'7F52': '3.5',
'7F72': '3.2',
// ZEN3
'5600X': '3.7',
'5800X': '3.8',
'5900X': '3.7',
'5950X': '3.4'
}; };
const socketTypes = { const socketTypes = {
@ -347,7 +481,9 @@ const socketTypes = {
57: 'LGA2066', 57: 'LGA2066',
58: 'BGA1392', 58: 'BGA1392',
59: 'BGA1510', 59: 'BGA1510',
60: 'BGA1528' 60: 'BGA1528',
61: 'LGA4189',
62: 'LGA1200',
}; };
function cpuBrandManufacturer(res) { function cpuBrandManufacturer(res) {

View File

@ -59,6 +59,7 @@ function fsSize(callback) {
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0])); const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024; const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024; const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024;
const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2)); const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2));
const mount = line[line.length - 1]; const mount = line[line.length - 1];
if (!data.find(el => (el.fs === fs && el.type === fstype))) { if (!data.find(el => (el.fs === fs && el.type === fstype))) {
@ -67,6 +68,7 @@ function fsSize(callback) {
type: fstype, type: fstype,
size, size,
used, used,
available,
use, use,
mount mount
}); });

View File

@ -467,6 +467,7 @@ function graphics(callback) {
if (nvidia.memoryTotal) { if (nvidia.memoryTotal) {
controller.memoryTotal = nvidia.memoryTotal; controller.memoryTotal = nvidia.memoryTotal;
controller.vram = nvidia.memoryTotal; controller.vram = nvidia.memoryTotal;
controller.vramDynamic = false;
} }
if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; } if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; }
if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; } if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; }

1
lib/index.d.ts vendored
View File

@ -29,6 +29,7 @@ export namespace Systeminformation {
uuid: string; uuid: string;
sku: string; sku: string;
virtual: boolean; virtual: boolean;
virtualHost?: string;
raspberry?: RaspberryRevisionData; raspberry?: RaspberryRevisionData;
} }

View File

@ -79,15 +79,42 @@ function system(callback) {
// detect virtual (1) // detect virtual (1)
if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) { if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) {
result.virtual = true; result.virtual = true;
switch (result.model.toLowerCase()) {
case 'virtualbox':
result.virtualHost = 'VirtualBox';
break;
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'kvm':
result.virtualHost = 'KVM';
break;
case 'bochs':
result.virtualHost = 'bochs';
break;
}
} }
if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') { if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
result.virtual = true; result.virtual = true;
switch (result.manufacturer.toLowerCase()) {
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'xen':
result.virtualHost = 'Xen';
break;
}
} }
if (!result.virtual) { if (!result.virtual) {
try { try {
const disksById = execSync('ls -1 /dev/disk/by-id/').toString(); const disksById = execSync('ls -1 /dev/disk/by-id/').toString();
if (disksById.indexOf('_QEMU_') >= 0 || disksById.indexOf('_VBOX_') >= 0) { if (disksById.indexOf('_QEMU_') >= 0) {
result.virtual = true; result.virtual = true;
result.virtualHost = 'QEMU';
}
if (disksById.indexOf('_VBOX_') >= 0) {
result.virtual = true;
result.virtualHost = 'VirtualBox';
} }
} catch (e) { } catch (e) {
util.noop(); util.noop();
@ -105,6 +132,18 @@ function system(callback) {
if (lines.length > 0) { if (lines.length > 0) {
result.model = 'Virtual machine'; result.model = 'Virtual machine';
result.virtual = true; result.virtual = true;
if (stdout.toString().toLowerCase().indexOf('vmware') && !result.virtualHost) {
result.virtualHost = 'VMware';
}
if (stdout.toString().toLowerCase().indexOf('qemu') && !result.virtualHost) {
result.virtualHost = 'QEMU';
}
if (stdout.toString().toLowerCase().indexOf('xen') && !result.virtualHost) {
result.virtualHost = 'Xen';
}
if (stdout.toString().toLowerCase().indexOf('kvm') && !result.virtualHost) {
result.virtualHost = 'KVM';
}
} }
} }
if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') { if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') {
@ -118,7 +157,7 @@ function system(callback) {
const model = util.getValue(lines, 'model:', ':', true); const model = util.getValue(lines, 'model:', ':', true);
// reference values: https://elinux.org/RPi_HardwareHistory // reference values: https://elinux.org/RPi_HardwareHistory
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) { if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) {
const rPIRevision = util.decodePiCpuinfo(lines); const rPIRevision = util.decodePiCpuinfo(lines);
result.model = rPIRevision.model; result.model = rPIRevision.model;
result.version = rPIRevision.revisionCode; result.version = rPIRevision.revisionCode;
@ -287,9 +326,31 @@ function system(callback) {
// detect virtual (1) // detect virtual (1)
if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) { if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) {
result.virtual = true; result.virtual = true;
switch (result.model.toLowerCase()) {
case 'virtualbox':
result.virtualHost = 'VirtualBox';
break;
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'kvm':
result.virtualHost = 'KVM';
break;
case 'bochs':
result.virtualHost = 'bochs';
break;
}
} }
if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') { if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
result.virtual = true; result.virtual = true;
switch (result.manufacturer.toLowerCase()) {
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'xen':
result.virtualHost = 'Xen';
break;
}
} }
util.wmic('/namespace:\\\\root\\wmi path MS_SystemInformation get /value').then((stdout, error) => { util.wmic('/namespace:\\\\root\\wmi path MS_SystemInformation get /value').then((stdout, error) => {
if (!error) { if (!error) {
@ -299,9 +360,24 @@ function system(callback) {
if (!result.virtual) { if (!result.virtual) {
util.wmic('bios get Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => { util.wmic('bios get Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => {
if (!error) { if (!error) {
let lines = stdout.split('\r\n'); let lines = stdout.toString();
if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0) { if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0) {
result.virtual = true; result.virtual = true;
if (lines.indexOf('VirtualBox') >= 0 && !result.virtualHost) {
result.virtualHost = 'VirtualBox';
}
if (lines.indexOf('VMware') >= 0 && !result.virtualHost) {
result.virtualHost = 'VMware';
}
if (lines.indexOf('Xen') >= 0 && !result.virtualHost) {
result.virtualHost = 'Xen';
}
if (lines.indexOf('VRTUAL') >= 0 && !result.virtualHost) {
result.virtualHost = 'Hyper-V';
}
if (lines.indexOf('A M I') >= 0 && !result.virtualHost) {
result.virtualHost = 'Virtual PC';
}
} }
if (callback) { callback(result); } if (callback) { callback(result); }
resolve(result); resolve(result);