From cebb6270e483411cdbfe1deec97d202bc65845b6 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 25 Jun 2025 00:54:38 +1000 Subject: systemusage: add fallback for amd gpus If they dont have edge, try use junction/mem --- services/SystemUsage.qml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'services') diff --git a/services/SystemUsage.qml b/services/SystemUsage.qml index f4cbc4f..1a21cd5 100644 --- a/services/SystemUsage.qml +++ b/services/SystemUsage.qml @@ -184,10 +184,10 @@ Singleton { stdout: StdioCollector { onStreamFinished: { 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 cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/); - } + if (cpuTemp) root.cpuTemp = parseFloat(cpuTemp[1]); @@ -204,7 +204,11 @@ Singleton { else if (line === "") eligible = false; 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) { sum += parseFloat(match[2]); count++; -- cgit v1.2.3-freya