systemusage: add fallback for amd gpus
If they dont have edge, try use junction/mem
This commit is contained in:
parent
9c4cab53b8
commit
cebb6270e4
1 changed files with 7 additions and 3 deletions
|
|
@ -184,10 +184,10 @@ Singleton {
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
let cpuTemp = text.match(/(?:Package id [0-9]+|Tdie):\s+((\+|-)[0-9.]+)(°| )C/);
|
let cpuTemp = text.match(/(?:Package id [0-9]+|Tdie):\s+((\+|-)[0-9.]+)(°| )C/);
|
||||||
if (!cpuTemp) {
|
if (!cpuTemp)
|
||||||
// If AMD Tdie pattern failed, try fallback on Tctl
|
// If AMD Tdie pattern failed, try fallback on Tctl
|
||||||
cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/);
|
cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/);
|
||||||
}
|
|
||||||
if (cpuTemp)
|
if (cpuTemp)
|
||||||
root.cpuTemp = parseFloat(cpuTemp[1]);
|
root.cpuTemp = parseFloat(cpuTemp[1]);
|
||||||
|
|
||||||
|
|
@ -204,7 +204,11 @@ Singleton {
|
||||||
else if (line === "")
|
else if (line === "")
|
||||||
eligible = false;
|
eligible = false;
|
||||||
else if (eligible) {
|
else if (eligible) {
|
||||||
const match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
|
let match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
|
||||||
|
if (!match)
|
||||||
|
// Fall back to junction/mem if GPU doesn't have edge temp (for AMD GPUs)
|
||||||
|
match = line.match(/^(junction|mem)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
sum += parseFloat(match[2]);
|
sum += parseFloat(match[2]);
|
||||||
count++;
|
count++;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue