cpuTemperature() improved parsing for AMD (linux)

This commit is contained in:
Sebastian Hildebrandt 2023-08-31 14:54:16 +02:00
parent ce7ad7ec1c
commit 8e84cf4f58
4 changed files with 15 additions and 2 deletions

View File

@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.21.3 | 2023-08-31 | `cpuTemperature()` improved parsing for AMD (linux) |
| 5.21.2 | 2023-08-30 | `cpuTemperature()` improved parsing for AMD (linux) |
| 5.21.1 | 2023-08-28 | `graphics()` subVendor fix (linux) |
| 5.21.0 | 2023-08-28 | `graphics()` added subVendor (linux) `memLayout()` DDR5 detection (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.21.3</th>
<td>2023-08-31</td>
<td><span class="code">cpuTemperature()</span> improved parsing for AMD (linux)</td>
</tr>
<tr>
<th scope="row">5.21.2</th>
<td>2023-08-30</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.21.2</span></div>
<div class="version">New Version: <span id="version">5.21.3</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

@ -1061,16 +1061,23 @@ function cpuTemperature(callback) {
stdout = stdout.substring(tdiePos);
}
let lines = stdout.split('\n');
let tctl = 0;
lines.forEach(line => {
const parts = line.split('___');
const label = parts[0];
const value = parts.length > 1 && parts[1] ? parts[1] : '0';
if (value && label && label.toLowerCase() === 'tctl') {
tctl = result.main = Math.round(parseInt(value, 10) / 100) / 10;
}
if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) {
result.cores.push(Math.round(parseInt(value, 10) / 100) / 10);
} else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0 || label.toLowerCase() === 'tctl')) {
} else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0 || label.toLowerCase() === 'tccd1')) {
result.main = Math.round(parseInt(value, 10) / 100) / 10;
}
});
if (tctl && result.main === null) {
result.main = tctl;
}
if (result.cores.length > 0) {
if (result.main === null) {