blob: 8dc47c1eb98d27b3e4801920aac5b0ce03405bb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls
import QtApplicationManager.SystemUI
/*
This file shows how to use ProcessStatus alongside a Timer (instead of putting it inside a MonitorModel)
when all that is needed is the latest information on a given application process.
*/
Grid {
id: root
spacing: 10
columns: 2
rows: 5
property var application
property var status: ProcessStatus {
id: processStatus
applicationId: root.application.id
}
property var timer: Timer {
id: updateTimer
interval: 500
repeat: true
running: root.visible && root.application.runState === Am.Running
onTriggered: processStatus.update()
}
Label { text: "processId: " + processStatus.processId; font.pixelSize: 15 }
Label {
property string loadPercent: Number(processStatus.cpuLoad * 100).toLocaleString(Qt.locale("en_US"), 'f', 1)
text: "cpuLoad: " + loadPercent + "%"
font.pixelSize: 15
}
MemoryText { name: "PSS.total"; value: processStatus.memoryPss.total }
MemoryText { name: "PSS.text"; value: processStatus.memoryPss.text }
MemoryText { name: "PSS.heap"; value: processStatus.memoryPss.heap }
MemoryText { name: "RSS.total"; value: processStatus.memoryRss.total }
MemoryText { name: "RSS.text"; value: processStatus.memoryRss.text }
MemoryText { name: "RSS.heap"; value: processStatus.memoryRss.heap }
MemoryText { name: "Virtual.total"; value: processStatus.memoryVirtual.total }
}
|