ProcessMonitor QML Type

A type for monitoring process resource usage More...

Import Statement: import QtApplicationManager 1.0

Properties

Signals

Methods

  • object get(int index)

Detailed Description

The ProcessMonitor type provides statistics about the resource usage and performance for a process known to the application-manager. Currently, CPU load, memory usage and frame rate can be monitored. This type is available in the System-UI only.

The ProcessMonitor is dedicated to Linux in particular, since this is currently the only OS that supports multi-process mode. Other OS's are supported only rudimenatary.

Here is an example, how the ProcessMonitor can be used:

import QtApplicationManager 1.0

ProcessMonitor {
    applicationId: ""
    reportingInterval: 1000
    memoryReportingEnabled: true

    onMemoryReportingChanged: {
        console.log("Total PSS: " + (memoryPss.total / 1e6).toFixed(0) + " MB");
    }
}

The type is derived from QAbstractListModel, so it can be used directly as a model in an appropriate view.

Here is the list of roles that the model provides:

Role nameTypeDescription
cpuLoad realThe process's CPU utilization during the last reporting interval. 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).
memoryVirtual varA map of the process's virtual memory usage. See below for a list of supported keys. The total amount of virtual memory is provided through memoryVirtual.total for example.
memoryRssvarA 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 below for a list of supported keys.
memoryPssvarA 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 below for a list of supported keys.
frameRate varA list of frame rate measurements where each entry corresponds to a window and is a map with the following keys: average, maximum, minimum and jitter. See below for a list of supported keys.

These are the supported keys in the memory maps:

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).

These are the supported keys in each entry of the frameRate list:

KeyDescription
averageThe average frame rate within the reporting interval.
maximumThe maximum frame rate within the reporting interval.
minimumThe minimum frame rate within the reporting interval.
jitterThe jitter within the reporting interval.

Note: The model will be updated each reportingInterval milliseconds. Note that the roles will only be populated, if the corresponding reporting parts have been enabled.

See also monitoredWindows.

Property Documentation

applicationId : string

The ID of the application that will be monitored. It must be one of the ID's known to the application-manager (ApplicationManager::applicationIds provides a list of valid IDs). There is one exception: if the ID is set to an empty string, the System-UI process will be monitored. Setting a new value will reset the model.


count : int

This property holds the number of reading points that will be kept in the model. The minimum value that can be set is 2 and the default value is 10.


cpuLoadReportingEnabled : bool

A boolean value that determines whether periodic CPU load reporting is enabled.


frameRateReportingEnabled : bool

A boolean value that determines whether periodic frame rate reporting is enabled.

Note: In order to receive measurements, the monitoredWindows property needs to be set to windows which are going to be monitored.

See also monitoredWindows.


memoryReportingEnabled : bool

A boolean value that determines whether periodic memory reporting is enabled.


monitoredWindows : var

This property holds a list of windows for which frame rate monitoring will be performed. Mapped windows are advertised through the WindowManager::windowReady() signal and the WindowManager type is itself a model which holds all windows of all application processes.

Note: It is possible to monitor server side (System-UI) views, as well, if the applicationId is empty (hence the System-UI process will be monitored). Those windows are available from QML since they need to be registered with WindowManager and can be assigned to monitoredWindows.

See also frameRateReportingEnabled.


[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.


reportingInterval : int

This property holds the interval in milliseconds between reporting updates. Note, that reporting will only start once this property is set. Setting a new value will reset the model. Valid values must be greater than zero.

At least one of the reporting parts must be enabled to start the reporting.

See also cpuLoadReportingEnabled and memoryReportingEnabled.


Signal Documentation

cpuLoadReportingChanged(real load)

This signal is emitted periodically when CPU load reporting is enabled. The frequency is defined by reportingInterval. The load parameter indicates the CPU utilization. Details can be found in the description of the cpuLoad model role above.

See also cpuLoadReportingEnabled and reportingInterval.


frameRateReportingChanged(var frameRate)

This signal is emitted periodically when frame rate reporting is enabled and monitoredWindows is set. The frequency is defined by reportingInterval. The frameRate parameter provides the same information as described above.

See also frameRateReportingEnabled and reportingInterval.


memoryReportingChanged(var memoryVritual, var memoryRss, var memoryPss)

This signal is emitted periodically when memory reporting is enabled. The frequency is defined by reportingInterval. The parameters provide the same information as the model roles with the same name described above.

See also memoryReportingEnabled and reportingInterval.


Method Documentation

object get(int index)

Returns the model data for the reading point identified by index as a JavaScript object. See the role-names for the expected object elements. The index must be in the range [0, count), returns an empty object if it is invalid.


© 2018 Pelagicore AG. 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.