ProcessStatus QML Type

Provides information on the status of an application process. More...

Import Statement: import QtApplicationManager.SystemUI 2.0

Properties

Signals

Methods

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 component as a MonitorModel data source 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"
    }
}

These are the supported keys in the memory properties (memoryVirtual, memoryRss and memoryPss):

KeyDescription
totalThe amount of memory used in total in bytes.
textThe amount of memory used by the code section in bytes.
heapThe amount of memory used by the heap in bytes. This is private, dynamically allocated memory (for example through malloc or mmap on Linux).

Property Documentation

applicationId : string

Id of the application whose process is to be monitored.

See also ApplicationObject.


[read-only] cpuLoad : real

The process's CPU utilization when update() was last called. A value of 0 means that the process was idle, a value of 1 means it fully used the equivalent of one core (which may be split over several ones).

See also ProcessStatus::update.


[read-only] memoryPss : var

A map of the process's PSS (Proportional Set Size) memory usage. This is the proportional share of the RSS value above. For instance if two processes share 2 MB the RSS value will be 2 MB for each process and the PSS value 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 (e.g. through mmap on Linux). See ProcessStatus description for a list of supported keys.

The value of this property is updated when ProcessStatus::update is called.

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.


[read-only] memoryRss : var

A map of the process's RSS (Resident Set Size) memory usage. This is the amount of memory that is actually mapped to physical RAM. See ProcessStatus description for a list of supported keys.

The value of this property is updated when ProcessStatus::update is called.

See also ProcessStatus::update.


[read-only] memoryVirtual : var

A map of the process's virtual memory usage. See ProcessStatus description for a list of supported keys. The total amount of virtual memory is provided through memoryVirtual.total for example.

The value of this property is updated when ProcessStatus::update is called.

See also ProcessStatus::update.


[read-only] processId : int

This property holds the OS specific process identifier (PID) that is monitored. This 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 (identified by an empty applicationId) will have an associated process.


[read-only] roleNames : list<string>

Names of the roles provided by ProcessStatus when used as a MonitorModel data source.

See also MonitorModel.


Signal Documentation

memoryReportingChanged(memoryVirtual, memoryRss, memoryPss)

This signal is emitted after update() has been called and the memory usage values have been refreshed. The arguments are key-value pairs with the keys listed in the table above.

Note: The corresponding handler is onMemoryReportingChanged.


Method Documentation

update()

Updates the properties cpuLoad, memoryVirtual, memoryRss and memoryPss.


© 2019 Luxoft Sweden AB. 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.