summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-02 21:25:47 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-02 21:25:47 +1000
commit20547084067b6c420d21031fe7c9176a188e4dcf (patch)
treef0b95b6a1dd21398a4c2a447fffb1497029e3039 /services
parentdashboard: invert scroll direction (diff)
downloadcaelestia-shell-20547084067b6c420d21031fe7c9176a188e4dcf.tar.gz
caelestia-shell-20547084067b6c420d21031fe7c9176a188e4dcf.tar.bz2
caelestia-shell-20547084067b6c420d21031fe7c9176a188e4dcf.zip
dashboard: fix performance gpu stats
Diffstat (limited to 'services')
-rw-r--r--services/SystemUsage.qml19
1 files changed, 12 insertions, 7 deletions
diff --git a/services/SystemUsage.qml b/services/SystemUsage.qml
index b2ac381..3b74db4 100644
--- a/services/SystemUsage.qml
+++ b/services/SystemUsage.qml
@@ -135,7 +135,11 @@ Singleton {
command: ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"]
stdout: SplitParser {
splitMarker: ""
- onRead: data => root.gpuPerc = data.trim().split("\n").reduce((acc, d) => acc + parseInt(d, 10), 0)
+ onRead: data => {
+ const percs = data.trim().split("\n");
+ const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
+ root.gpuPerc = sum / percs.length / 100;
+ }
}
}
@@ -145,20 +149,21 @@ Singleton {
running: true
command: ["sh", "-c", "sensors | jq -nRc '[inputs]'"]
stdout: SplitParser {
- readonly property var tempTest: new RegExp("^temp[0-9]+:")
-
onRead: data => {
let eligible = false;
let sum = 0;
let count = 0;
for (const line of JSON.parse(data)) {
- if (line === "Adapter: PCI Adapter")
+ if (line === "Adapter: PCI adapter")
eligible = true;
else if (line === "")
eligible = false;
- else if (eligible && (line.startsWith("GPU core:") || tempTest.test(line))) {
- sum += parseFloat(line).split(" ")[1];
- count++;
+ else if (eligible) {
+ const match = line.match(/^\w+:\s+\+([0-9]+\.[0-9]+)°C/);
+ if (match) {
+ sum += parseFloat(match[1]);
+ count++;
+ }
}
}
root.gpuTemp = count > 0 ? sum / count : 0;