CPU measurement module

Use the CPU measurement module to monitor CPU load.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Source modules for module_state_event

module_state_event

cpu_meas

cpu_load_event

None

module_state_event

Sink modules for module_state_event

Note

See the Application overview for more information about the event-based communication in the nRF Desktop application and about how to read this table.

Configuration

To enable this module, use the CONFIG_DESKTOP_CPU_MEAS_ENABLE Kconfig option. This option selects the CONFIG_NRF_CPU_LOAD Kconfig option, which enables the CPU load measurement library that is used to perform the measurements.

Set the time between subsequent CPU load measurements, in milliseconds, using the CONFIG_DESKTOP_CPU_MEAS_PERIOD option.

Measurement results

The module can provide the measurement results in the following ways:

You must enable at least one of these options. You can enable both options at the same time.

Implementation details

The module periodically reads the CPU load, provides the result, and resets the measurement. If reading the CPU load fails, the module reports an error state and stops the measurements.

The CPU load is presented in 0.001% units. Depending on the configuration, the result is provided in the following ways:

  • Through the nRF Profiler event - The module registers the cpu_load nRF Profiler event type with a single load field. The event is emitted only if profiling of the event is enabled.

  • Through the application event - The cpu_load_event.load presents the CPU load. The event can be displayed in the logs or using the nRF Profiler.