Commit graph

32 commits

Author SHA1 Message Date
Jukka Rissanen 7bb4013d8e net: tracing: Add socket tracing support
If network socket tracing is enabled, then the system will track
various socket API calls for usage.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-10 15:03:20 -05:00
Marcin Szkudlinski 3fde2c50c6 tracing: add intel ADSP memory window backend
This commits adds a tracing backend based on
Intel ADSP debug memory window

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-03-25 09:33:41 +01:00
Aron Lander 89c866ab68 modules: Add DFM and move Tracerecorder into percepio module
This commit adds the DFM (DevAlert target side code) module and
moves the TraceRecorder module into the percepio module, which
results in the TraceRecorder module definition being removed
from the west manufest and module definition within zephyr.

Signed-off-by: Aron Lander <aron.lander@percepio.com>
2023-09-12 10:19:37 -04:00
Florian Grandel d218b20643 tracing: make API tracing configurable
So far only object tracing/tracking could be individually disabled (e.g.
CONFIG_TRACING_SEMAPHORE=n). Now tracing of any API may be disabled
(e.g. CONFIG_TRACING_PM=n).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 06:10:14 -04:00
Kumar Gala dcfcd05ed3 tracing: Move to DTS for uart device
Move from using Kconfig TRACING_BACKEND_UART_NAME to a devicetree
chosen property ("zephyr,tracing-uart").  This is similar to a number
of other functions like "zephyr,shell-uart" or "zephyr,bt-uart".

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 16:00:47 -07:00
Bartosz Bilas 306f92e646 tracing: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Anas Nashif 68670d71b8 tracing: kconfig: move RAM_TRACING_BUFFER_SIZE out of choice
This kconfig is not a choice, it is an option needed by one of the
choices, so move it out.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-12 11:39:11 -04:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Ederson de Souza bdaac354f4 kernel: Bring back object tracking
When CONFIG_TRACING_OBJECT_TRACKING is enabled, the kernel will keep
lists of some objects (detailed below), so that debuggers or other tools
can keep track of them.

The lists of objects are:

struct k_timer *_track_list_k_timer;
struct k_mem_slab *_track_list_k_mem_slab;
struct k_sem *_track_list_k_sem;
struct k_mutex *_track_list_k_mutex;
struct k_stack *_track_list_k_stack;
struct k_msgq *_track_list_k_msgq;
struct k_mbox *_track_list_k_mbox;
struct k_pipe *_track_list_k_pipe;
struct k_queue *_track_list_k_queue;

Note that while CONFIG_TRACING is needed, one can always use
CONFIG_TRACE_NONE=y. Also, tracking will only be done for objects that
are also being traced (so, to prevent tracking of some type of object,
such as k_timer, just make CONFIG_TRACING_TIMER=n).

Some simple "sanity checking" tests are also added in this patch.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2021-12-14 07:42:31 -05:00
Tom Burdick 97dc88bb6d tracing: Automatic syscall tracing
When generating syscall wrappers, call a tracing macro with the id,
name, and all parameters of the syscall as params when entering and
leaving the syscall. This can be disabled in certain call sites
by defining DISABLE_SYSCALL_TRACING which is useful for certain
tracing implementations which require syscalls themselves to work.

Notably some syscalls *cannot* be automatically traced this way and
headers where exclusions are set are in the gen_syscall.py as notracing.

Includes a systemview and test format implementation.

Tested with systemview, usb, and uart backends with the string
formatter using the tracing sample app.

Debugging the trace wrapper can be aided by setting the TRACE_DIAGNOSTIC
env var and rebuilding from scratch, a warning is issued for every
instance a syscall is traced.

Automatically generating a name mapping for SYSVIEW_Zephyr.txt is a
future item as is documenting how to capture and use the tracing data
generated.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-10-23 20:45:17 -04:00
Peter Mitsis ae394bff7c kernel: add support for event objects
Threads may wait on an event object such that any events posted to
that event object may wake a waiting thread if the posting satisfies
the waiting threads' event conditions.

The configuration option CONFIG_EVENTS is used to control the inclusion
of events in a system as their use increases the size of
'struct k_thread'.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-10-16 06:27:10 -04:00
Nicholas Lowell cc8ab95760 tracing: Add user-definable tracing interface
Create a new tracing option TRACING_USER that allows
the user to define certain user_sys_trace_... functions
to perform whatever work desired for tracing when
tasks are swiched in/out, during isr enter/exit, and when
cpu is idle.

This infrastructure can be useful for plugging into
locally defined tracing tools or any user-specific
debugging environment.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2021-09-02 06:54:35 -04:00
Johann Fischer ae074e81d4 usb: remove Kconfig option CONFIG_USB
The USB configuration option is actually a global switch
to enable USB drivers in general, but currently only
the device controller drivers are meant.

USB device controller drivers also have USB_DEVICE_DRIVER option.
Thus the option USB is actually redundant and can be replaced
by the self-explanatory option USB_DEVICE_DRIVER.
The name USB itself is not unique and should not be used as an
configuration option.

With these changes the option USB_DEVICE_DRIVER generally
enables USB device controller drivers. The option USB_DEVICE_STACK
enables USB device support. It is sufficient to enable only option
USB_DEVICE_STACK because it selects USB_DEVICE_DRIVER.

CONFIG_USB Kconfig option is temporary added to subsys/usb/Kconfig.
This is necessary to pass CI and will be removed again
when the USB configuration has been adapted in modules.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Anas Nashif 108129cf7d tracing: fix conflict with RTT locking
Make custom RTT locking configurable and select it where it is needed.
When using RTT for tracing we want to use the default locking.

Update both segger and tracerecorder modules to support that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-25 07:36:38 -05:00
Anas Nashif acee43a176 tracing: fix indentation of config entries
Fix indentation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-25 07:36:38 -05:00
Anas Nashif 1af037f477 modules: enable percepio tracerecorder for tracing
Add support for percepio tracealyzer.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-07 22:10:21 -04:00
Torbjörn Leksell 16bbb8ef34 Tracing: Trace hook support macros
Adds generic trace hook macros for inserting trace hook for
function entry, exit, blocking, and object initialization
with a variable number of arguments (objects, return values,
etc.). Utilizing macro concatenation these macros produce
trace hooks of a similar format to the old trace system
with SYS_TRACING_OBJ_FUNC(k_thread, switched_in) being
turned into sys_trace_k_thread_switched_in() by the
preprocessor. Although these macros still rely on the manual
definition of each unique trace hook in tracing.h, the benefit
of not directly calling those is that we can enable/disable
trace hooks based on object type (k_thread, k_sem, etc.)
through the preprocessor while providing the ability of adding
type specific runtime trace processing similar to
SYS_TRACING_OBJ_INIT.

Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-07 22:10:21 -04:00
Anas Nashif bc747e7167 tracing: remove cpu_stats in favor of thread runtime stats
Removing CONFIG_TRACING_CPU_STATS in favor of
CONFIG_THREAD_RUNTIME_STATS which provides per thread stats. The same
functionality is also available when Thread analyzer is enabled with the
runtime stats enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-16 15:31:24 -04:00
Julien Massot 80402f7f8b tracing: add RAM backend
If Zephyr is running on a coprocessor we might lack I/O
such as uart or usb to output tracing datas but we might
have gigabytes of RAM available.

This patch allows to output trace datas to a ram buffer, which then
may be retrieved using gdb.

e.g:
(gdb) dump binary memory channel0_0 <ram_tracing_start> \
<ram_tracing_end>

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-03-06 07:33:59 -05:00
Rubin Gerritsen 5d121a95e9 systemview: SystemView tracing requires THREAD_MONITOR
Otherwise it will not be able to send its thread list.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-11-21 08:29:26 -05:00
Daniel Leung 11e6b43090 tracing: roll thread switch in/out into thread stats functions
Since the tracing of thread being switched in/out has the same
instrumentation points, we can roll the tracing function calls
into the one for thread stats gathering functions.
This avoids duplicating code to call another function.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-11-11 23:55:49 -05:00
Anas Nashif 6e3d1fbd3c tracing: make uart backend sync capable
This works just fine, no need to make this backend async only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif f5d606ef72 Kconfig: cleanup subsystems
Sort entries alphabetically and cleanup top level menu for each
subsystem. Move stats subsystem Kconfig from debug into its own Kconfig.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 10:24:30 +02:00
Kumar Gala d62dfe8d0e tracing: usb: Fix build issues.
1. Remove usb_descriptor.h as tracing_backend_usb.c doesn't have access
   to that include file.
2. Make TRACING_BACKEND_USB depend on USB being enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-07 20:06:17 -05:00
Anas Nashif f05dbf9f6a tracing: avoid building tracing code when not applicable
Do not build tracing system if provided otherwise, for example right now
systemview does not need any of the zephyr interfaces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif d9be19e40e tracing: move cpu stats to tracing formatting choice in Kconfig
This is another tracing format we support and belongs in the same
choice.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif fad8701748 tracing: cleanup and split segger/rtt configuration options
Move rtt configuration options to drivers/debug and split the
systemview configuration.

drivers/debug will service for this class of drivers that are enabled in
debug mode only and provide a hardware interface to the system.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif 6684dce772 tracing: Kconfig cleanup and reorg
Cleanup tracing Kconfig and add a format choice.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif ad4e7f2db3 tracing: TRACING implies THREAD_NAME, STACK_INFO
Tracing now implies THREAD_NAME and STACK_INFO.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif 6aadf45032 tracing: enable TRACING_ISR by default
This should be enabled by default and if not needed, disabled by the
application.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Anas Nashif 41abcc57c1 tracing: move tracing under subsys/
Tracing subsystem is growing and although related to debugging, it does
deserve to belong into its own subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00