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
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "CPU-Temperatur"
},
"thresholds-section": {
"description": "Setzen Sie Schwellenwerte für Systemmetriken; Werte darüber werden hervorgehoben.",
"description": "Passe die Warn-/Kritisch-Schwellen und die Abfrageintervalle für jede Systemmetrik an.",
"label": "Schwellenwerte"
},
"title": "Systemmonitor",
+7 -1
View File
@@ -1814,6 +1814,9 @@
"disk-warning-threshold": {
"label": "Warning threshold"
},
"network-section": {
"label": "Network"
},
"general": {
"section": {
"description": "Configure the system monitor behavior and appearance.",
@@ -1835,6 +1838,9 @@
"temp-critical-threshold": {
"label": "Critical threshold"
},
"polling-interval": {
"label": "Polling interval"
},
"temp-warning-threshold": {
"label": "Warning threshold"
},
@@ -1842,7 +1848,7 @@
"label": "CPU temperature"
},
"thresholds-section": {
"description": "Set thresholds for system metrics, values above these will be highlighted.",
"description": "Adjust warning/critical thresholds and polling intervals for each system metric.",
"label": "Thresholds"
},
"title": "System Monitor",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "Temperatura de la CPU"
},
"thresholds-section": {
"description": "Establece umbrales para métricas del sistema; los valores por encima se resaltarán.",
"description": "Ajusta los umbrales de advertencia/crítico y los intervalos de sondeo para cada métrica del sistema.",
"label": "Umbrales"
},
"title": "Monitor del sistema",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "Température CPU"
},
"thresholds-section": {
"description": "Définir des seuils pour les métriques système ; les valeurs supérieures à ces seuils seront mises en évidence.",
"description": "Ajustez les seuils davertissement/critiques et les intervalles dinterrogation pour chaque métrique système.",
"label": "Seuils"
},
"title": "Moniteur système",
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "CPU-temperatuur"
},
"thresholds-section": {
"description": "Stel drempelwaarden in voor systeemstatistieken; waarden die hierboven liggen worden gemarkeerd.",
"description": "Pas de waarschuwing/kritieke drempels en de pollingsintervallen voor elke systeemmetriek aan.",
"label": "Drempels"
},
"title": "Systeemmonitor",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "Temperatura da CPU"
},
"thresholds-section": {
"description": "Defina limiares para métricas do sistema; valores acima serão destacados.",
"description": "Ajuste os limites de aviso/crítico e os intervalos de consulta para cada métrica do sistema.",
"label": "Limiares"
},
"title": "Monitor do Sistema",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "Температура ЦП"
},
"thresholds-section": {
"description": "Установите пороги для системных метрик; значения выше будут выделены.",
"description": "Настройте пороги предупреждения/критические пороги и интервалы опроса для каждой системной метрики.",
"label": "Пороги"
},
"title": "Системный монитор",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "CPU Sıcaklığı"
},
"thresholds-section": {
"description": "Sistem metrikleri için eşikler ayarlayın; bu değerlerin üzerindekiler vurgulanacaktır.",
"description": "Her sistem metriği için uyarı/kritik eşiklerini ve yoklama aralıklarını ayarlayın.",
"label": "Eşikler"
},
"title": "Sistem İzleme",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "Температура ЦП"
},
"thresholds-section": {
"description": "Встановіть пороги для системних метрик; значення вище будуть підсвічені.",
"description": "Налаштуйте пороги попередження/критичні пороги та інтервали опитування для кожного системного показника.",
"label": "Пороги"
},
"title": "Системний монітор",
+1 -1
View File
@@ -1842,7 +1842,7 @@
"label": "CPU 温度"
},
"thresholds-section": {
"description": "设置各项系统测量指标的阈值,超过该值将以高亮色进行提示。",
"description": "为每个系统指标调整警告/严重阈值和轮询间隔。",
"label": "阈值"
},
"title": "系统监视器",
+4
View File
@@ -234,6 +234,10 @@
"memCriticalThreshold": 90,
"diskWarningThreshold": 80,
"diskCriticalThreshold": 90,
"cpuPollingInterval": 3000,
"tempPollingInterval": 3000,
"memPollingInterval": 3000,
"diskPollingInterval": 3000,
"useCustomColors": false,
"warningColor": "",
"criticalColor": ""
+4
View File
@@ -410,6 +410,10 @@ Singleton {
property int memCriticalThreshold: 90
property int diskWarningThreshold: 80
property int diskCriticalThreshold: 90
property int cpuPollingInterval: 3000
property int tempPollingInterval: 3000
property int memPollingInterval: 3000
property int diskPollingInterval: 3000
property bool useCustomColors: false
property string warningColor: ""
property string criticalColor: ""
@@ -114,11 +114,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.cpu-warning-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 0
to: 100
stepSize: 5
@@ -139,11 +142,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.cpu-critical-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: Settings.data.systemMonitor.cpuWarningThreshold
to: 100
stepSize: 5
@@ -152,6 +158,28 @@ ColumnLayout {
suffix: "%"
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.polling-interval.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 250
to: 10000
stepSize: 250
value: Settings.data.systemMonitor.cpuPollingInterval
onValueChanged: Settings.data.systemMonitor.cpuPollingInterval = value
suffix: " ms"
}
}
}
// Temperature
@@ -171,11 +199,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.temp-warning-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 0
to: 100
stepSize: 5
@@ -195,11 +226,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.temp-critical-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: Settings.data.systemMonitor.tempWarningThreshold
to: 100
stepSize: 5
@@ -208,6 +242,28 @@ ColumnLayout {
suffix: "°C"
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.polling-interval.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 250
to: 10000
stepSize: 250
value: Settings.data.systemMonitor.tempPollingInterval
onValueChanged: Settings.data.systemMonitor.tempPollingInterval = value
suffix: " ms"
}
}
}
// Memory Usage
@@ -227,11 +283,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.mem-warning-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 0
to: 100
stepSize: 5
@@ -251,11 +310,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.mem-critical-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: Settings.data.systemMonitor.memWarningThreshold
to: 100
stepSize: 5
@@ -264,6 +326,28 @@ ColumnLayout {
suffix: "%"
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.polling-interval.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 250
to: 10000
stepSize: 250
value: Settings.data.systemMonitor.memPollingInterval
onValueChanged: Settings.data.systemMonitor.memPollingInterval = value
suffix: " ms"
}
}
}
// Disk Usage
@@ -283,11 +367,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.disk-warning-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 0
to: 100
stepSize: 5
@@ -307,11 +394,14 @@ ColumnLayout {
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.disk-critical-threshold.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: Settings.data.systemMonitor.diskWarningThreshold
to: 100
stepSize: 5
@@ -320,5 +410,27 @@ ColumnLayout {
suffix: "%"
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginM
NText {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: I18n.tr("settings.system-monitor.polling-interval.label")
pointSize: Style.fontSizeS
}
NSpinBox {
Layout.alignment: Qt.AlignHCenter
from: 250
to: 10000
stepSize: 250
value: Settings.data.systemMonitor.diskPollingInterval
onValueChanged: Settings.data.systemMonitor.diskPollingInterval = value
suffix: " ms"
}
}
}
}
+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()
}
// --------------------------------------------