Skip to content

Commit f68a086

Browse files
nordic-krchfabiobaltieri
authored andcommitted
doc: debugging: Add section about CPU load
Add documentation for CPU load module. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 688b561 commit f68a086

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

doc/services/debugging/cpu_load.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. _cpu_load:
2+
3+
CPU load
4+
########
5+
6+
Module can be used to track how much time is spent in idle. It is using tracing hooks
7+
which are called before and after CPU goes to idle. Compared to :ref:`thread_analyzer`
8+
it is more accurate since it takes into account time spent in the interrupt context as well.
9+
10+
Function :c:func:`cpu_load_get` is used to get the latest value. It is also used to reset
11+
the measurement. By default, module is using :c:func:`k_cycle_get_32` but in cases when higher
12+
precision is needed a :ref:`counter_api` device can be used.
13+
14+
Load can also be reported periodically using a logging message. Period is configured using :kconfig:option:`CONFIG_CPU_LOAD_LOG_PERIODICALLY`.
15+
16+
Using counter device
17+
********************
18+
19+
In order to use :ref:`counter_api` device :kconfig:option:`CONFIG_CPU_LOAD_USE_COUNTER` must be
20+
enabled and chosen in devicetree must be set.
21+
22+
.. code-block:: devicetree
23+
24+
chosen {
25+
zephyr,cpu-load-counter = &counter_device;
26+
};

doc/services/debugging/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Debugging
77
:maxdepth: 1
88

99
thread-analyzer.rst
10+
cpu_load.rst
1011
coredump.rst
1112
gdbstub.rst
1213
debugmon.rst

0 commit comments

Comments
 (0)