doc: debugging: Add section about CPU load

Add documentation for CPU load module.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński
2025-03-12 08:16:21 +01:00
committed by Fabio Baltieri
parent 688b561815
commit f68a086005
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
.. _cpu_load:
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 :ref:`thread_analyzer`
it is more accurate since it takes into account time spent in the interrupt context as well.
Function :c:func:`cpu_load_get` is used to get the latest value. It is also used to reset
the measurement. By default, module is using :c:func:`k_cycle_get_32` but in cases when higher
precision is needed a :ref:`counter_api` device can be used.
Load can also be reported periodically using a logging message. Period is configured using :kconfig:option:`CONFIG_CPU_LOAD_LOG_PERIODICALLY`.
Using counter device
********************
In order to use :ref:`counter_api` device :kconfig:option:`CONFIG_CPU_LOAD_USE_COUNTER` must be
enabled and chosen in devicetree must be set.
.. code-block:: devicetree
chosen {
zephyr,cpu-load-counter = &counter_device;
};

View File

@@ -7,6 +7,7 @@ Debugging
:maxdepth: 1
thread-analyzer.rst
cpu_load.rst
coredump.rst
gdbstub.rst
debugmon.rst