ProcessStatus QML Type
Provides information about the status of an application process. More...
Import Statement: | import QtApplicationManager.SystemUI 2.0 |
Properties
- applicationId : string
- cpuLoad : real
- memoryPss : var
- memoryReportingEnabled : bool
- memoryRss : var
- memoryVirtual : var
- processId : int
- roleNames : list<string>
Signals
- memoryReportingChanged(var memoryVirtual, var memoryRss, var memoryPss)
Methods
- update()
Detailed Description
ProcessStatus provides information about the process of a given application.
You can use it alongside a Timer, for instance, to periodically query the status of an application process.
import QtQuick 2.11 import QtApplicationManager 2.0 import QtApplicationManager.SystemUI 2.0 Item { id: root property var application: ApplicationManager.get(0) ... ProcessStatus { id: processStatus applicationId: root.application.id } Timer { interval: 1000 running: root.visible && root.application.runState === Am.Running repeat: true onTriggered: processStatus.update() } Text { text: "PSS.total: " + (processStatus.memoryPss.total / 1e6).toFixed(0) + " MB" } }
You can also use this type as a data source for MonitorModel, if you want to plot its previous values over time:
import QtQuick 2.11 import QtApplicationManager 2.0 import QtApplicationManager.SystemUI 2.0 ... MonitorModel { running: true ProcessStatus { applicationId: "some.app.id" } }
The following are the keys supported in the memory properties (memoryVirtual
, memoryRss
, and memoryPss
):
Key | Description |
---|---|
total | The total amount of memory used, in bytes. |
text | The amount of memory used by the code section, in bytes. |
heap | The amount of memory used by the heap, in bytes. The heap is private, dynamically allocated memory, for example through malloc or mmap on Linux. |
Property Documentation
applicationId : string |
Holds the ID of the application whose process is to be monitored. This ID must be one that is known to the application manager (applicationIds() provides a list of valid IDs). There is one exception: if you want to monitor the System UI's process, set the ID to an empty string. In single-process mode, the System UI process is the only valid process, since all applications run within this process.
See also ApplicationObject.
cpuLoad : real |
This property holds the process' CPU utilization during the previous measurement interval, when update() was last called. A value of 0 means the process was idle; a value of 1 means the process used the equivalent of one core, which may be split across several cores.
See also ProcessStatus::update.
memoryPss : var |
A map of the process' Proportional Set Size (PSS) memory usage. This is the proportional share of the RSS value in ProcessStatus::memoryRss. For instance, if two processes share 2 MB, then the RSS value is 2 MB for each process; the PSS value is 1 MB for each process. As the name implies, the code section of shared libraries is generally shared between processes. Memory may also be shared by other means provided by the OS, for example, through mmap
on Linux. For more information, see the table of supported keys.
Calling ProcessStatus::update() updates the value of this property.
See also ProcessStatus::update().
memoryReportingEnabled : bool |
A boolean value that determines whether the memory properties are refreshed each time update() is called. The default value is true
. In your System UI, the process of determining memory consumption adds additional load to the CPU, affecting the cpuLoad
value. If cpuLoad
needs to be kept accurate, consider disabling memory reporting.
memoryRss : var |
A map of the process' Resident Set Size (RSS) memory usage. This is the amount of memory that is actually mapped to physical RAM. For more information, see the table of supported keys.
Calling ProcessStatus::update() updates the value of this property.
See also ProcessStatus::update().
memoryVirtual : var |
A map of the process's virtual memory usage. For example, the total amount of virtual memory is provided through memoryVirtual.total
. For more information, see the table of supported keys.
Calling ProcessStatus::update() updates the value of this property.
See also ProcessStatus::update().
processId : int |
This property holds the OS-specific process identifier (PID) that is monitored. It can be used by external tools, for example. The property is 0, if there is no process associated with the applicationId. In particular, if the application manager runs in single-process mode, only the System UI has an associated process. The System UI is always identified by an empty applicationId.
Names of the roles that ProcessStatus provides when used as a data source for MonitorModel.
See also MonitorModel.
Signal Documentation
This signal is emitted after update() has been called and the memory usage values have been refreshed. Each of the arguments memoryVirtual, memoryRss and memoryPss is an JavaScript object with the available properties listed in the table above.
Note: The corresponding handler is onMemoryReportingChanged
.
Method Documentation
update() |
Updates the cpuLoad, memoryVirtual, memoryRss, and memoryPss properties.
© 2024 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.