From ea46cdd2d12acf83c208693496fb1c3b3b5b5597 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 7 Jan 2021 12:59:10 +0100 Subject: [PATCH] added virtualHost, AMD processor list, graphics improvement --- README.md | 4 +- docs/trademarks.html | 6 +- lib/cpu.js | 202 ++++++++++++++++++++++++++++++++++++------- lib/filesystem.js | 2 + lib/graphics.js | 1 + lib/index.d.ts | 1 + lib/system.js | 82 +++++++++++++++++- 7 files changed, 260 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index c689212..0942742 100644 --- a/README.md +++ b/README.md @@ -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, 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, -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. diff --git a/docs/trademarks.html b/docs/trademarks.html index fa78ff1..7b5ebcc 100644 --- a/docs/trademarks.html +++ b/docs/trademarks.html @@ -59,7 +59,11 @@
  • Ubuntu is a trademark of Canonical Ltd.
  • CentOS is a trademark of Read Hat Inc.
  • Sun, Solaris, OpenSolaris are registered trademarks of Sun Microsystems
  • -
  • Virtual Box are registered trademarks of Oracle Corporation
  • +
  • Virtual Box is a registered trademark of Oracle Corporation
  • +
  • Xen is a registered trademark of Xen Project, The Linux Foundation Projects
  • +
  • VMware is a registered trademark of VMware, Inc.
  • +
  • bochs is a trademark of The Bochs Project
  • +
  • QEMU is a trademark of Fabrice Bellard.
  • BSD is a registered trademark of UUnet Technologies, Inc.
  • UNIX is a registered trademark of The Open Group.
  • NVIDIA is a registered trademark of NVIDIA Corporation.
  • diff --git a/lib/cpu.js b/lib/cpu.js index 345d1ae..e3996aa 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -191,80 +191,203 @@ const AMDBaseFrequencies = { 'FX|9590': '4.7', 'FX|8320E': '3.2', 'FX|8370E': '3.3', - '1950X': '3.4', - '1920X': '3.5', - '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', + + // ZEN Desktop CPUs '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', + '3200U': '2.6', '2300U': '2.0', 'Pro 2300U': '2.0', '2500U': '2.0', 'Pro 2500U': '2.2', + '2600H': '3.2', '2700U': '2.0', 'Pro 2700U': '2.2', - '2600H': '3.2', '2800H': '3.3', - '7601': '2.2', - '7551': '2.0', - '7501': '2.0', - '74501': '2.3', - '7401': '2.0', + + // ZEN Server Processors '7351': '2.4', - '7301': '2.2', - '7281': '2.1', - '7251': '2.1', - '7551P': '2.0', - '7401P': '2.0', '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', '2500X': '3.6', '2600': '3.4', '2600E': '3.1', + '1600|AF': '3.2', '2600X': '3.6', '2700': '3.2', '2700E': '2.8', + 'Pro 2700': '3.2', '2700X': '3.7', 'Pro 2700X': '3.6', - '2920': '3.5', - '2950': '3.5', + '2920X': '3.5', + '2950X': '3.5', '2970WX': '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', + 'PRO 3300U': '2.1', + '3450U': '2.1', '3500U': '2.1', + 'PRO 3500U': '2.1', + '3500C': '2.1', '3550H': '2.1', '3580U': '2.1', '3700U': '2.3', + 'PRO 3700U': '2.3', + '3700C': '2.3', '3750H': '2.3', '3780U': '2.3', + + // ZEN2 Desktop CPUS + '3100': '3.6', + '3300X': '3.8', + '3500': '3.6', '3500X': '3.6', '3600': '3.6', 'Pro 3600': '3.6', '3600X': '3.8', + '3600XT': '3.8', 'Pro 3700': '3.6', '3700X': '3.6', '3800X': '3.9', + '3800XT': '3.9', '3900': '3.1', 'Pro 3900': '3.1', '3900X': '3.8', + '3900XT': '3.8', '3950X': '3.5', '3960X': '3.8', '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', '7302P': '3.0', '7402P': '2.8', @@ -279,12 +402,23 @@ const AMDBaseFrequencies = { '7402': '2.8', '7452': '2.35', '7502': '2.5', + '7532': '2.4', '7542': '2.9', '7552': '2.2', '7642': '2.3', + '7662': '2.0', '7702': '2.0', '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 = { @@ -347,7 +481,9 @@ const socketTypes = { 57: 'LGA2066', 58: 'BGA1392', 59: 'BGA1510', - 60: 'BGA1528' + 60: 'BGA1528', + 61: 'LGA4189', + 62: 'LGA1200', }; function cpuBrandManufacturer(res) { diff --git a/lib/filesystem.js b/lib/filesystem.js index 8e1cbdf..ea861e8 100755 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -59,6 +59,7 @@ function fsSize(callback) { const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0])); 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 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 mount = line[line.length - 1]; if (!data.find(el => (el.fs === fs && el.type === fstype))) { @@ -67,6 +68,7 @@ function fsSize(callback) { type: fstype, size, used, + available, use, mount }); diff --git a/lib/graphics.js b/lib/graphics.js index 0d7ea64..275929e 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -467,6 +467,7 @@ function graphics(callback) { if (nvidia.memoryTotal) { controller.memoryTotal = nvidia.memoryTotal; controller.vram = nvidia.memoryTotal; + controller.vramDynamic = false; } if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; } if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; } diff --git a/lib/index.d.ts b/lib/index.d.ts index eace582..c5852eb 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -29,6 +29,7 @@ export namespace Systeminformation { uuid: string; sku: string; virtual: boolean; + virtualHost?: string; raspberry?: RaspberryRevisionData; } diff --git a/lib/system.js b/lib/system.js index 9e053d2..770eef9 100644 --- a/lib/system.js +++ b/lib/system.js @@ -79,15 +79,42 @@ function system(callback) { // 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')) { 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') { result.virtual = true; + switch (result.manufacturer.toLowerCase()) { + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'xen': + result.virtualHost = 'Xen'; + break; + } } if (!result.virtual) { try { 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.virtualHost = 'QEMU'; + } + if (disksById.indexOf('_VBOX_') >= 0) { + result.virtual = true; + result.virtualHost = 'VirtualBox'; } } catch (e) { util.noop(); @@ -105,6 +132,18 @@ function system(callback) { if (lines.length > 0) { result.model = 'Virtual machine'; 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 === '') { @@ -118,7 +157,7 @@ function system(callback) { const model = util.getValue(lines, 'model:', ':', true); // reference values: https://elinux.org/RPi_HardwareHistory // 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); result.model = rPIRevision.model; result.version = rPIRevision.revisionCode; @@ -287,9 +326,31 @@ function system(callback) { // 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')) { 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') { 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) => { if (!error) { @@ -299,9 +360,24 @@ function system(callback) { if (!result.virtual) { util.wmic('bios get Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, 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) { 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); } resolve(result);