CPU load

Module can be used to track how much time is spent in idle. It is using tracing hooks which are called before and after CPU goes to idle. Compared to Thread analyzer it is more accurate since it takes into account time spent in the interrupt context as well.

Function is used to get the latest value. It is also used to reset the measurement. By default, module is using but in cases when higher precision is needed a Counter device can be used.

Load can also be reported periodically using a logging message. Period is configured using CONFIG_CPU_LOAD_LOG_PERIODICALLY.

Using counter device

In order to use Counter device CONFIG_CPU_LOAD_USE_COUNTER must be enabled and chosen in devicetree must be set.

chosen {
  zephyr,cpu-load-counter = &counter_device;
};