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

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 4.23.2 | 2020-04-08 | `cpu()` fixed getting base frequency for AMD Ryzen |
| 4.23.1 | 2020-03-11 | `diskLayout()` optimized detection linux | | 4.23.1 | 2020-03-11 | `diskLayout()` optimized detection linux |
| 4.23.0 | 2020-03-08 | `versions()` added param to specify which program/lib versions to detect | | 4.23.0 | 2020-03-08 | `versions()` added param to specify which program/lib versions to detect |
| 4.22.7 | 2020-03-08 | `diskLayout()` fixed linux | | 4.22.7 | 2020-03-08 | `diskLayout()` fixed linux |

View File

@ -83,6 +83,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">4.23.2</th>
<td>2020-04-08</td>
<td><span class="code">cpu()</span> fixed getting base speed Ryzen CPUs</td>
</tr>
<tr> <tr>
<th scope="row">4.23.1</th> <th scope="row">4.23.1</th>
<td>2020-03-11</td> <td>2020-03-11</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png"> <img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div> <div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.23.1</span></div> <div class="version">Current Version: <span id="version">4.23.2</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button> <button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div> </div>
<div class="down"> <div class="down">
@ -207,7 +207,7 @@
<div class="title">Downloads last month</div> <div class="title">Downloads last month</div>
</div> </div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12"> <div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">255</div> <div class="numbers">261</div>
<div class="title">Dependends</div> <div class="title">Dependends</div>
</div> </div>
</div> </div>

View File

@ -50,6 +50,7 @@
<li><strong>Windows</strong> is a registered trademark of Microsoft Corporation</li> <li><strong>Windows</strong> is a registered trademark of Microsoft Corporation</li>
<li><strong>Intel</strong> is a trademark of Intel Corporation</li> <li><strong>Intel</strong> is a trademark of Intel Corporation</li>
<li><strong>AMD</strong> is a trademark of Advanced Micro Devices Inc.</li> <li><strong>AMD</strong> is a trademark of Advanced Micro Devices Inc.</li>
<li><strong>Ryzen</strong> is a trademark of Advanced Micro Devices Inc.</li>
<li><strong>Raspberry Pi</strong> is a trademark of the Raspberry Pi Foundation</li> <li><strong>Raspberry Pi</strong> is a trademark of the Raspberry Pi Foundation</li>
<li><strong>Debian</strong> is a trademark of the Debian Project</li> <li><strong>Debian</strong> is a trademark of the Debian Project</li>
<li><strong>FreeBSD</strong> is a registered trademark of The FreeBSD Foundation</li> <li><strong>FreeBSD</strong> is a registered trademark of The FreeBSD Foundation</li>

View File

@ -232,7 +232,7 @@ const AMDBaseFrequencies = {
'7351P': '2.4', '7351P': '2.4',
'2300X': '3.5', '2300X': '3.5',
'2500X': '3.6', '2500X': '3.6',
'2600': '3.1', '2600': '3.4',
'2600E': '3.1', '2600E': '3.1',
'2600X': '3.6', '2600X': '3.6',
'2700': '3.2', '2700': '3.2',
@ -452,7 +452,7 @@ function getCpu() {
modelline = util.getValue(lines, 'model name') || modelline; modelline = util.getValue(lines, 'model name') || modelline;
result.brand = modelline.split('@')[0].trim(); result.brand = modelline.split('@')[0].trim();
result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()).toFixed(2) : '0.00'; 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); result.speed = getAMDSpeed(result.brand);
} }
if (result.speed === '0.00') { if (result.speed === '0.00') {
@ -517,7 +517,7 @@ function getCpu() {
} }
result.brand = modelline.split('@')[0].trim(); result.brand = modelline.split('@')[0].trim();
result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()).toFixed(2) : '0.00'; 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); result.speed = getAMDSpeed(result.brand);
} }
if (result.speed === '0.00') { if (result.speed === '0.00') {
@ -582,12 +582,11 @@ function getCpu() {
let name = util.getValue(lines, 'name', '=') || ''; let name = util.getValue(lines, 'name', '=') || '';
if (name.indexOf('@') >= 0) { if (name.indexOf('@') >= 0) {
result.brand = name.split('@')[0].trim(); result.brand = name.split('@')[0].trim();
result.speed = name.split('@')[1].trim(); result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()).toFixed(2) : '0.00';
result.speed = parseFloat(result.speed.replace(/GHz+/g, '').trim()).toFixed(2);
_cpu_speed = result.speed; _cpu_speed = result.speed;
} else { } else {
result.brand = name.trim(); result.brand = name.trim();
result.speed = 0; result.speed = '0.00';
} }
result = cpuBrandManufacturer(result); result = cpuBrandManufacturer(result);
result.revision = util.getValue(lines, 'revision', '='); result.revision = util.getValue(lines, 'revision', '=');
@ -600,7 +599,7 @@ function getCpu() {
result.vendor = util.getValue(lines, 'manufacturer', '='); result.vendor = util.getValue(lines, 'manufacturer', '=');
result.speedmax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', '=').replace(/,/g, '.')) / 10.0) / 100; result.speedmax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', '=').replace(/,/g, '.')) / 10.0) / 100;
result.speedmax = result.speedmax ? parseFloat(result.speedmax).toFixed(2) : ''; 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); result.speed = getAMDSpeed(result.brand);
} }
if (result.speed === '0.00') { if (result.speed === '0.00') {

View File

@ -198,7 +198,7 @@ function parseLinesWindowsNics(sections, nconfigsections) {
let linesNicConfig = nconfigsections[i].trim().split('\r\n'); let linesNicConfig = nconfigsections[i].trim().split('\r\n');
let netEnabled = util.getValue(lines, 'NetEnabled', '='); let netEnabled = util.getValue(lines, 'NetEnabled', '=');
if (netEnabled) { if (netEnabled !== '') {
const speed = parseInt(util.getValue(lines, 'speed', '=').trim(), 10) / 1000000; const speed = parseInt(util.getValue(lines, 'speed', '=').trim(), 10) / 1000000;
nics.push({ nics.push({
mac: util.getValue(lines, 'MACAddress', '=').toLowerCase(), mac: util.getValue(lines, 'MACAddress', '=').toLowerCase(),
@ -560,13 +560,13 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
let dhcStatus = resultFormat.split(' ').slice(1).toString(); let dhcStatus = resultFormat.split(' ').slice(1).toString();
switch (dhcStatus) { switch (dhcStatus) {
case 'auto': case 'auto':
result = true; result = true;
break; break;
default: default:
result = false; result = false;
break; break;
} }
return result; return result;
} catch (e) { } catch (e) {
@ -656,6 +656,24 @@ function networkInterfaces(callback) {
return new Promise((resolve) => { return new Promise((resolve) => {
process.nextTick(() => { process.nextTick(() => {
let ifaces = os.networkInterfaces(); 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 result = [];
let nics = []; let nics = [];
let dnsSuffixes = []; let dnsSuffixes = [];

View File

@ -391,7 +391,7 @@ function versions(apps, callback) {
return { return {
versions: versionObject, versions: versionObject,
counter: 26 counter: 26
} };
} }
if (!Array.isArray(apps)) { if (!Array.isArray(apps)) {
apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|'); apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
@ -399,7 +399,7 @@ function versions(apps, callback) {
const result = { const result = {
versions: {}, versions: {},
counter: 0 counter: 0
} };
apps.forEach(el => { apps.forEach(el => {
if (el) { if (el) {
for (let key in versionObject) { for (let key in versionObject) {
@ -807,8 +807,8 @@ function versions(apps, callback) {
}); });
} }
} catch (e) { } catch (e) {
if (callback) { callback(result); } if (callback) { callback(appsObj.versions); }
resolve(result); resolve(appsObj.versions);
} }
}); });
}); });