SystemMonitorTab: add polling option

This commit is contained in:
Ly-sec
2025-11-27 15:06:17 +01:00
parent 72263f198e
commit 7cb293733c
15 changed files with 2620 additions and 25 deletions
+70 -15
View File
@@ -10,7 +10,12 @@ Singleton {
id: root
// Configuration
property int sleepDuration: 3000
readonly property int minimumIntervalMs: 250
readonly property int defaultIntervalMs: 3000
function normalizeInterval(value) {
return Math.max(minimumIntervalMs, value || defaultIntervalMs);
}
// Public values
property real cpuUsage: 0
@@ -42,31 +47,81 @@ Singleton {
// --------------------------------------------
Component.onCompleted: {
Logger.i("SystemStat", "Service started with interval:", root.sleepDuration, "ms");
Logger.i("SystemStat", "Service started with custom polling intervals");
// Kickoff the cpu name detection for temperature
cpuTempNameReader.checkNext();
}
// --------------------------------------------
// Timer for periodic updates
// Timer for CPU usage
Timer {
id: updateTimer
interval: root.sleepDuration
id: cpuUsageTimer
interval: root.normalizeInterval(Settings.data.systemMonitor.cpuPollingInterval)
repeat: true
running: true
triggeredOnStart: true
onTriggered: {
// Trigger all direct system files reads
memInfoFile.reload();
cpuStatFile.reload();
netDevFile.reload();
// Run df (disk free) one time
dfProcess.running = true;
updateCpuTemperature();
onIntervalChanged: {
if (running) {
restart();
}
}
onTriggered: cpuStatFile.reload()
}
// Timer for CPU temperature
Timer {
id: cpuTempTimer
interval: root.normalizeInterval(Settings.data.systemMonitor.tempPollingInterval)
repeat: true
running: true
triggeredOnStart: true
onIntervalChanged: {
if (running) {
restart();
}
}
onTriggered: updateCpuTemperature()
}
// Timer for memory stats
Timer {
id: memoryTimer
interval: root.normalizeInterval(Settings.data.systemMonitor.memPollingInterval)
repeat: true
running: true
triggeredOnStart: true
onIntervalChanged: {
if (running) {
restart();
}
}
onTriggered: memInfoFile.reload()
}
// Timer for disk usage
Timer {
id: diskTimer
interval: root.normalizeInterval(Settings.data.systemMonitor.diskPollingInterval)
repeat: true
running: true
triggeredOnStart: true
onIntervalChanged: {
if (running) {
restart();
}
}
onTriggered: dfProcess.running = true
}
// Timer for network speeds
Timer {
id: networkTimer
interval: root.defaultIntervalMs
repeat: true
running: true
triggeredOnStart: true
onTriggered: netDevFile.reload()
}
// --------------------------------------------