cpu() handled speed parsing error (Apple Silicon)

This commit is contained in:
Sebastian Hildebrandt 2020-12-01 14:10:08 +01:00
parent 6629c80788
commit 87602fa42c
5 changed files with 21 additions and 13 deletions

View File

@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.30.9 | 2020-11-30 | `cpu()` corrected processor names (Raspberry Pi) |
| 4.30.10 | 2020-12-01 | `cpu()` handled speed parsing error (Apple Silicon) |
| 4.30.9 | 2020-12-01 | `cpu()` corrected processor names (Raspberry Pi) |
| 4.30.8 | 2020-11-30 | `fsSize()` catch error (mac OS) |
| 4.30.7 | 2020-11-29 | `cpuTemperature()` rewrite hwmon parsing |
| 4.30.6 | 2020-11-27 | wmic added default windows path (windows) |

View File

@ -30,7 +30,13 @@
[![Sponsoring][sponsor-badge]][sponsor-url]
[![MIT license][license-img]][license-url]
This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 350 versions published, up to 2 mio downloads per month, > 20 mio downloads overall. Thank you to all who contributed to this project!
This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 350 versions published, up to 2.5 mio downloads per month, > 20 mio downloads overall. Thank you to all who contributed to this project!
## Upcoming
**MacOS on ARM (Apple silicon support), Windows on ARM**: November 11th 2020 - We will have a closer look on that! As soon as we have the new hardware here, will work on support for those platforms!
**Version 5**: we are planning a new major version with some minor breaking changes and some additional features. Will try to make this available Q1 of 2021.
## New Version 4.0
@ -49,12 +55,6 @@ This next major version release 4.0 comes with several optimizations and changes
Breaking Changes in version 4: you will see some minor breaking changes. Read the [detailed changelog][changelog-url].
## Upcoming
**MacOS on ARM, Windows on ARM**: November 11th 2020 - We will have a closer look on that! As soon as we have the new hardware here, will definitely work on support for those platforms.
**Version 5**: we are planning a new major version with some minor breaking changes and some additional features. Will try to make this available Q1 of 2021.
## Quick Start
Lightweight collection of 40+ functions to retrieve detailed hardware, system and OS information.

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.30.10</th>
<td>2020-12-01</td>
<td><span class="code">cpu()</span> handled speed parsing error (Apple Silicon)</td>
</tr>
<tr>
<th scope="row">4.30.9</th>
<td>2020-12-01</td>

View File

@ -169,7 +169,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.30.9</span></div>
<div class="version">Current Version: <span id="version">4.30.10</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>
</div>
<div class="down">

View File

@ -413,8 +413,9 @@ function getCpu() {
// if (!error) {
let lines = stdout.toString().split('\n');
const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
result.brand = modelline.split('@')[0].trim();
result.speed = modelline.split('@')[1].trim();
const modellineParts = modelline.split('@');
result.brand = modellineParts[0].trim();
result.speed = modellineParts[1] ? modellineParts.trim() : '0';
result.speed = parseFloat(result.speed.replace(/GHz+/g, '')).toFixed(2);
_cpu_speed = result.speed;
result = cpuBrandManufacturer(result);
@ -450,8 +451,9 @@ function getCpu() {
lines = stdout.toString().split('\n');
}
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';
const modellineParts = modelline.split('@');
result.brand = modellineParts[0].trim();
result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()).toFixed(2) : '0.00';
if (result.speed === '0.00' && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
result.speed = getAMDSpeed(result.brand);
}