cpu() fix manufacturer
This commit is contained in:
+20
-3
@@ -515,12 +515,29 @@ const socketTypes = {
|
||||
63: 'LGA4677',
|
||||
};
|
||||
|
||||
function cpuManufacturer(str) {
|
||||
let result = str;
|
||||
str = str.toLowerCase();
|
||||
|
||||
if (str.indexOf('intel') >= 0) { result = 'Intel'; }
|
||||
if (str.indexOf('amd') >= 0) { result = 'AMD'; }
|
||||
if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
|
||||
if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
|
||||
if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
|
||||
if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
|
||||
if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
|
||||
if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
|
||||
if (str.indexOf('apple') >= 0) { result = 'Apple'; }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function cpuBrandManufacturer(res) {
|
||||
res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
|
||||
res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim();
|
||||
res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
|
||||
res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
|
||||
res.manufacturer = res.brand.split(' ')[0];
|
||||
res.manufacturer = cpuManufacturer(res.brand);
|
||||
|
||||
let parts = res.brand.split(' ');
|
||||
parts.shift();
|
||||
@@ -655,7 +672,7 @@ function getCpu() {
|
||||
result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
|
||||
|
||||
result = cpuBrandManufacturer(result);
|
||||
result.vendor = util.getValue(lines, 'vendor id');
|
||||
result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
|
||||
// if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
|
||||
|
||||
result.family = util.getValue(lines, 'cpu family');
|
||||
@@ -733,7 +750,7 @@ function getCpu() {
|
||||
result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
|
||||
|
||||
result = cpuBrandManufacturer(result);
|
||||
result.vendor = util.getValue(lines, 'manufacturer');
|
||||
result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
|
||||
let sig = util.getValue(lines, 'signature');
|
||||
sig = sig.split(',');
|
||||
for (var i = 0; i < sig.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user