CGroupStatus QML Type
Provides information on the status of a Linux cgroup. More...
| Import Statement: | import QtApplicationManager |
Properties
- cpuPSI : PressureStallInformation
- ioPSI : PressureStallInformation
- max : int
- memoryHigh : int
- memoryMax : int
- memoryPSI : PressureStallInformation
- memoryUsed : int
- path : string
- roleNames : list<string>
Methods
- void update()
Detailed Description
CGroupStatus monitors a Linux cgroup v2 control group, providing both memory statistics and pressure stall information (PSI). It defaults to the cgroup of the current process, but you can point it at any other cgroup by setting the path property.
Note: This type only works on Linux systems running cgroup v2. All properties return 0 or are non-functional on other platforms or when running under cgroup v1.
Memory monitoring
The memoryHigh and memoryMax limits are read once when path is set. The current memory usage is available via memoryUsed, which is updated on every call to update().
You can use this type as a MonitorModel data source to record memory usage over time:
import QtQuick
import QtApplicationManager
MonitorModel {
CGroupStatus {}
}Alternatively, drive updates yourself with a Timer:
import QtQuick
import QtApplicationManager
CGroupStatus { id: cgroupStatus }
Timer {
interval: 1000
running: true
repeat: true
onTriggered: cgroupStatus.update()
}Pressure stall monitoring
The cpuPSI, memoryPSI, and ioPSI properties each expose a PressureStallInformation object for event-driven pressure monitoring. Configure the desired mode, timeWindow, and stallTime, then connect to the triggered signal to react when the threshold is exceeded:
import QtQuick
import QtApplicationManager
CGroupStatus {
id: cgroupStatus
Component.onCompleted: {
memoryPSI.timeWindow = 2000 // 2 second observation window
memoryPSI.stallTime = 100 // fire if stalled for 100ms within that window
memoryPSI.mode = PressureStallInformation.Some
}
}
Connections {
target: cgroupStatus.memoryPSI
function onTriggered() { console.log("Memory pressure detected") }
}See also MemoryStatus, MonitorModel, and PressureStallInformation.
Property Documentation
cpuPSI : PressureStallInformation [read-only]
Provides access to CPU pressure stall monitoring for this cgroup. Monitors situations where tasks are delayed waiting for CPU time.
Only functional when running under cgroup v2.
See also PressureStallInformation, memoryPSI, and ioPSI.
ioPSI : PressureStallInformation [read-only]
Provides access to I/O pressure stall monitoring for this cgroup. Monitors situations where tasks are delayed waiting for I/O operations to complete.
Only functional when running under cgroup v2.
See also PressureStallInformation, cpuPSI, and memoryPSI.
max : int [read-only]
This property always returns the largest unsigned 64-bit integer value, which is used to express the max value in cgroup v2 files.
memoryHigh : int [read-only]
The memory.high soft limit (in bytes) of this cgroup, or 0 if not running under cgroup v2. When the cgroup file contains the string "max", this returns max.
Note: As the kernel does not have a mechanism to notify changes, this value is not updated after the initial read when path is set.
memoryMax : int [read-only]
The memory.max hard limit (in bytes) of this cgroup, or 0 if not running under cgroup v2. When the cgroup file contains the string "max", this returns max.
Note: As the kernel does not have a mechanism to notify changes, this value is not updated after the initial read when path is set.
memoryPSI : PressureStallInformation [read-only]
Provides access to memory pressure stall monitoring for this cgroup. Monitors situations where tasks are delayed waiting for memory to become available.
Only functional when running under cgroup v2.
See also PressureStallInformation, cpuPSI, and ioPSI.
memoryUsed : int [read-only]
The current memory usage (in bytes) of this cgroup, as reported by memory.current. Updated on every call to update(). Returns 0 if not running under cgroup v2.
See also update().
path : string
The path of the cgroup this CGroupStatus instance is monitoring. This is only relevant on Linux systems when running cgroup v2, and will be an empty string otherwise.
This defaults to the cgroup of the current process, but you can set it to another cgroup valid cgroup identifier (eg: user.slice/user-1000.slice/session-2.scope).
roleNames : list<string> [read-only]
Names of the roles provided by CGroupStatus when used as a MonitorModel data source.
See also MonitorModel.
Method Documentation
void update()
Updates the memoryUsed property.
See also memoryUsed.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.