feat(gpu): add gpu monitor module (amd sysfs + nvidia-smi, usage/vram/temp)

This commit is contained in:
Damocles 2026-04-17 11:15:55 +02:00
parent a2966f51ab
commit ff1644c0bd
6 changed files with 301 additions and 2 deletions

View file

@ -34,6 +34,15 @@ QtObject {
property int tempCelsius: 0
property var tempHistory: [] // 150 samples @ 4s each 10 min
// GPU
property bool gpuAvailable: false
property string gpuVendor: ""
property int gpuUsage: 0
property real gpuVramUsedGb: 0
property real gpuVramTotalGb: 0
property int gpuTempC: 0
property var gpuHistory: [] // 60 samples @ ~4-8s each 4-8 min
// Memory
property int memPercent: 0
property real memUsedGb: 0
@ -86,6 +95,15 @@ QtObject {
root.tempCelsius = ev.celsius;
const th = root.tempHistory.concat([ev.celsius]);
root.tempHistory = th.length > 150 ? th.slice(th.length - 150) : th;
} else if (ev.type === "gpu") {
root.gpuAvailable = true;
root.gpuVendor = ev.vendor;
root.gpuUsage = ev.usage;
root.gpuVramUsedGb = ev.vram_used_gb;
root.gpuVramTotalGb = ev.vram_total_gb;
root.gpuTempC = ev.temp_c;
const gh = root.gpuHistory.concat([ev.usage]);
root.gpuHistory = gh.length > 60 ? gh.slice(gh.length - 60) : gh;
} else if (ev.type === "mem") {
root.memPercent = ev.percent;
root.memUsedGb = ev.used_gb;