summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/dashboard/Performance.qml4
-rw-r--r--modules/dashboard/dash/Resources.qml5
-rw-r--r--services/SystemUsage.qml13
3 files changed, 13 insertions, 9 deletions
diff --git a/modules/dashboard/Performance.qml b/modules/dashboard/Performance.qml
index 0bc29d4..5c6361d 100644
--- a/modules/dashboard/Performance.qml
+++ b/modules/dashboard/Performance.qml
@@ -11,6 +11,10 @@ RowLayout {
spacing: Appearance.spacing.large * 3
+ Ref {
+ service: SystemUsage
+ }
+
Resource {
Layout.alignment: Qt.AlignVCenter
Layout.topMargin: root.padding
diff --git a/modules/dashboard/dash/Resources.qml b/modules/dashboard/dash/Resources.qml
index 9a1f07a..a27cce5 100644
--- a/modules/dashboard/dash/Resources.qml
+++ b/modules/dashboard/dash/Resources.qml
@@ -2,7 +2,6 @@ import "root:/widgets"
import "root:/services"
import "root:/config"
import QtQuick
-import QtQuick.Controls
Row {
id: root
@@ -13,6 +12,10 @@ Row {
padding: Appearance.padding.large
spacing: Appearance.spacing.normal
+ Ref {
+ service: SystemUsage
+ }
+
Resource {
icon: "memory"
value: SystemUsage.cpuPerc
diff --git a/services/SystemUsage.qml b/services/SystemUsage.qml
index 0eed3ef..4d80dc9 100644
--- a/services/SystemUsage.qml
+++ b/services/SystemUsage.qml
@@ -22,6 +22,8 @@ Singleton {
property real lastCpuIdle
property real lastCpuTotal
+ property int refCount
+
function formatKib(kib: real): var {
const mib = 1024;
const gib = 1024 ** 2;
@@ -49,9 +51,10 @@ Singleton {
}
Timer {
- running: true
+ running: root.refCount
interval: 3000
repeat: true
+ triggeredOnStart: true
onTriggered: {
stat.reload();
meminfo.reload();
@@ -96,7 +99,6 @@ Singleton {
Process {
id: storage
- running: true
command: ["sh", "-c", "df | grep '^/dev/' | awk '{print $1, $3, $4}'"]
stdout: StdioCollector {
onStreamFinished: {
@@ -142,17 +144,13 @@ Singleton {
running: true
command: ["sh", "-c", "if ls /sys/class/drm/card*/device/gpu_busy_percent 2>/dev/null | grep -q .; then echo GENERIC; elif command -v nvidia-smi >/dev/null; then echo NVIDIA; else echo NONE; fi"]
stdout: StdioCollector {
- onStreamFinished: {
- root.gpuType = text.trim();
- gpuUsage.running = true;
- }
+ onStreamFinished: root.gpuType = text.trim()
}
}
Process {
id: gpuUsage
- running: true
command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu", "--format=csv,noheader,nounits"] : ["echo"]
stdout: StdioCollector {
onStreamFinished: {
@@ -175,7 +173,6 @@ Singleton {
Process {
id: sensors
- running: true
command: ["sensors"]
environment: ({
LANG: "C",