SystemMonitor QML Type

The SystemMonitor singleton. More...

Import Statement: import QtApplicationManager 1.0

Properties

Signals

Methods

Detailed Description

The SystemMonitor singleton type provides information about system resources and performance, like CPU and memory usage, I/O load and frame rate.

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

The following roles are available in this model:

Role nameTypeDescription
cpuLoadrealThe current CPU utilization in the range 0 (completely idle) to 1 (fully busy).
memoryUsedintThe amount of physical system memory used in bytes.
ioLoadvarA map of devices registered with addIoLoadReporting() and their I/O load in the range [0, 1]. For instance the load of a registered device "sda" can be accessed through ioLoad.sda.
averageFpsrealThe average frame rate during the last reportingInterval in frames per second.
minimumFpsrealThe minimum frame rate during the last reportingInterval in frames per second.
maximumFpsrealThe maximum frame rate during the last reportingInterval in frames per second.
fpsJitterrealA measure for the average deviation from the ideal frame rate of 60 fps during the last reportingInterval.

Note: The model will be updated each reportingInterval milliseconds. The roles will only be populated, if the corresponding reporting parts (memory, CPU, etc.) have been enabled.

After importing QtApplicationManager you could use the SystemMonitor singleton as follows:

import QtQuick 2.4
import QtApplicationManager 1.0

ListView {
    width: 200; height: 200

    model: SystemMonitor
    delegate: Text { text: averageFps }

    Component.onCompleted: {
        SystemMonitor.reportingInterval = 1000;
        SystemMonitor.fpsReportingEnabled = true;
    }
}

Property Documentation

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.


[read-only] cpuCores : int

This property holds the number of physical CPU cores that are installed on the system.


[read-only] cpuLoad : int

This property holds the current CPU utilization as a value ranging from 0 (inclusive, completely idle) to 1 (inclusive, fully busy).


cpuLoadReportingEnabled : bool

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


fpsReportingEnabled : bool

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


[read-only] idle : bool

A boolean value that defines, whether the system is idle. If the CPU load is greater than idleLoadThreshold, this property will be set to false, otherwise to true. The value is evaluated every second and reflects whether the average load during the last second was below or above the threshold.

See also idleLoadThreshold.


idleLoadThreshold : real

A value in the range [0, 1]. If the CPU load is greater than this threshold the idle property will be false, otherwise true. This property also influences when the application manager quick-launches application processes.

The default value is read from the configuration YAML file (quicklaunch/idleLoad), respectively 0.1, if this configuration option is not provided.

See also idle.


memoryReportingEnabled : bool

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


[read-only] memoryUsed : int

This property holds the amount of physical memory (RAM) used in bytes.


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 (memory, CPU load etc.) must be enabled, respectively registered to start the reporting.


[read-only] totalMemory : int

This property holds the total amount of physical memory (RAM) installed on the system in bytes.


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 in the range 0 (completely idle) to 1 (fully busy).

See also cpuLoadReportingEnabled and reportingInterval.


fpsReportingChanged(real average, real minimum, real maximum, real jitter)

This signal is emitted periodically when frame rate reporting is enabled. The update frequency is defined by reportingInterval. The arguments denote the average, minimum and maximum frame rate during the last reportingInterval in frames per second. Additionally, jitter is a measure for the average deviation from the ideal frame rate of 60 fps.


ioLoadReportingChanged(string device, real load)

This signal is emitted periodically for each I/O device that has been registered with addIoLoadReporting. The frequency is defined by reportingInterval. The string device holds the name of the device that is monitored. The load parameter indicates the utilization of the device in the range 0 (completely idle) to 1 (fully busy).

See also addIoLoadReporting, removeIoLoadReporting, ioLoadReportingDevices, and reportingInterval.


memoryReportingChanged(int used)

This signal is emitted periodically when memory reporting is enabled. The frequency is defined by reportingInterval. The used physical system memory in bytes is provided as argument.

See also memoryReportingEnabled and reportingInterval.


Method Documentation

bool addIoLoadReporting(string deviceName)

Registers the device with the name deviceName for periodically reporting its I/O load.

Note: Currently this is only supported on Linux: the deviceName has to match one of the devices in the /sys/block directory.

Returns true, if the device could be added, otherwise false (e.g. if it does not exist).


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.


list<string> ioLoadReportingDevices()

Returns a list of registered device names, that will report their I/O load.


real memoryCriticalWarningThreshold()

Returns the current threshold in percent, when a critical memory warning will be sent to applications.

See also setMemoryWarningThresholds().


real memoryLowWarningThreshold()

Returns the current threshold in percent, when a low memory warning will be sent to applications.

See also setMemoryWarningThresholds().


removeIoLoadReporting(string deviceName)

Remove the device with the name deviceName from the list of monitored devices.


bool setMemoryWarningThresholds(real lowWarning, real criticalWarning)

Activates monitoring of available system memory. The arguments must define percent values (in the range [0, 100]) of the totalMemory available. The lowWarning argument defines the threshold in percent, when applications get the ApplicationInterface::memoryLowWarning() signal. The criticalWarning argument defines the threshold, when applications get the ApplicationInterface::memoryCriticalWarning() signal.

Returns true, if monitoring could be started, otherwise false (e.g. if arguments are out of range).

Note: This is only supported on Linux with the cgroups memory subsystem enabled.

See also totalMemory, ApplicationInterface::memoryLowWarning(), and ApplicationInterface::memoryCriticalWarning().


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