cpu() fixed getting base frequency for AMD Ryzen

This commit is contained in:
Sebastian Hildebrandt
2020-04-08 15:43:16 +02:00
parent 31d542dc36
commit cb57b5c090
7 changed files with 44 additions and 20 deletions
+6 -7
View File
@@ -232,7 +232,7 @@ const AMDBaseFrequencies = {
'7351P': '2.4',
'2300X': '3.5',
'2500X': '3.6',
'2600': '3.1',
'2600': '3.4',
'2600E': '3.1',
'2600X': '3.6',
'2700': '3.2',
@@ -452,7 +452,7 @@ function getCpu() {
modelline = util.getValue(lines, 'model name') || modelline;
result.brand = modelline.split('@')[0].trim();
result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()).toFixed(2) : '0.00';
if (result.speed === '0.00' && result.brand.indexOf('AMD') > -1) {
if (result.speed === '0.00' && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
result.speed = getAMDSpeed(result.brand);
}
if (result.speed === '0.00') {
@@ -517,7 +517,7 @@ function getCpu() {
}
result.brand = modelline.split('@')[0].trim();
result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()).toFixed(2) : '0.00';
if (result.speed === '0.00' && result.brand.indexOf('AMD') > -1) {
if (result.speed === '0.00' && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
result.speed = getAMDSpeed(result.brand);
}
if (result.speed === '0.00') {
@@ -582,12 +582,11 @@ function getCpu() {
let name = util.getValue(lines, 'name', '=') || '';
if (name.indexOf('@') >= 0) {
result.brand = name.split('@')[0].trim();
result.speed = name.split('@')[1].trim();
result.speed = parseFloat(result.speed.replace(/GHz+/g, '').trim()).toFixed(2);
result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()).toFixed(2) : '0.00';
_cpu_speed = result.speed;
} else {
result.brand = name.trim();
result.speed = 0;
result.speed = '0.00';
}
result = cpuBrandManufacturer(result);
result.revision = util.getValue(lines, 'revision', '=');
@@ -600,7 +599,7 @@ function getCpu() {
result.vendor = util.getValue(lines, 'manufacturer', '=');
result.speedmax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', '=').replace(/,/g, '.')) / 10.0) / 100;
result.speedmax = result.speedmax ? parseFloat(result.speedmax).toFixed(2) : '';
if (!result.speed && result.brand.indexOf('AMD') > -1) {
if (result.speed === '0.00' && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
result.speed = getAMDSpeed(result.brand);
}
if (result.speed === '0.00') {
+25 -7
View File
@@ -198,7 +198,7 @@ function parseLinesWindowsNics(sections, nconfigsections) {
let linesNicConfig = nconfigsections[i].trim().split('\r\n');
let netEnabled = util.getValue(lines, 'NetEnabled', '=');
if (netEnabled) {
if (netEnabled !== '') {
const speed = parseInt(util.getValue(lines, 'speed', '=').trim(), 10) / 1000000;
nics.push({
mac: util.getValue(lines, 'MACAddress', '=').toLowerCase(),
@@ -560,13 +560,13 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
let dhcStatus = resultFormat.split(' ').slice(1).toString();
switch (dhcStatus) {
case 'auto':
result = true;
break;
case 'auto':
result = true;
break;
default:
result = false;
break;
default:
result = false;
break;
}
return result;
} catch (e) {
@@ -656,6 +656,24 @@ function networkInterfaces(callback) {
return new Promise((resolve) => {
process.nextTick(() => {
let ifaces = os.networkInterfaces();
if (_windows) {
getWindowsNics().forEach(nic => {
let found = false;
Object.keys(ifaces).forEach(key => {
if (!found) {
ifaces[key].forEach(value => {
if (Object.keys(value).indexOf('mac') >= 0) {
found = value['mac'] === nic.mac;
}
});
}
});
if (!found) {
ifaces[nic.name] = [{ mac: nic.mac }];
}
});
}
let result = [];
let nics = [];
let dnsSuffixes = [];
+4 -4
View File
@@ -391,7 +391,7 @@ function versions(apps, callback) {
return {
versions: versionObject,
counter: 26
}
};
}
if (!Array.isArray(apps)) {
apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
@@ -399,7 +399,7 @@ function versions(apps, callback) {
const result = {
versions: {},
counter: 0
}
};
apps.forEach(el => {
if (el) {
for (let key in versionObject) {
@@ -807,8 +807,8 @@ function versions(apps, callback) {
});
}
} catch (e) {
if (callback) { callback(result); }
resolve(result);
if (callback) { callback(appsObj.versions); }
resolve(appsObj.versions);
}
});
});