source: rtems-docs/user/tracing/introduction.rst @ 21c4a44

5
Last change on this file since 21c4a44 was 21c4a44, checked in by Sebastian Huber <sebastian.huber@…>, on 01/30/19 at 10:40:05

user: Add basic event recording documentation

Update #3665.

  • Property mode set to 100644
File size: 4.4 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2016 Chris Johns <chrisj@rtems.org>
4
5.. _introduction:
6
7Introduction to Tracing
8***********************
9
10Tracing is an important function which has several applications including
11identification of complex threading, detection of deadlocks, tracing
12functions along with their argument values, and return values through
13progression of several function calls and audit the performance of an
14application according to required specifications.
15
16RTEMS tracing framework is under development and welcomes contribution by users.
17
18RTEMS has the following trace components:
19
20- :ref:`RTEMS Trace Linker <TraceLinker>`
21- :ref:`RTEMS Capture Engine <CaptureEngine>`
22- :ref:`RTEMS Event Recording <EventRecording>`
23- Common Trace Format Integration
24
25RTEMS trace framework can currently function using the following methods. Both
26of the methods make use of the :ref:`tracelinker` :
27
28.. _tracebuffering:
29
30RTEMS Trace Using Trace Buffering
31=================================
32
33This scheme of tracing goes through the flow of events described in a
34subsequent flowchart:
35
36Step 1: The user creates an application and user configuration file. The
37configuration file specifies the use of the trace buffer generator and other
38standard initializations. The user then configures their BSP and invokes the
39trace linker using a command to link the application executable. The trace
40linker uses the application files in compiled format (ELF) and the libraries
41used to build the application for performing this link.
42
43Step 2: The RTEMS Trace Linker reads the user's configuration file and that
44results in it reading the standard Trace Buffering Configuration files
45installed with the RTEMS Trace Linker. The trace linker uses the target
46compiler and linker to create the trace enabled application executable. It
47wraps the functions defined in the user's configuration with code that captures
48trace records into the statically allocated buffer. The trace wrapper code is
49compiled with the target compiler and the resulting ELF object file is added to
50the standard link command line used to link the application and the application
51is re-linked using the wrapping option of the GNU linker.
52
53Step 3: The trace linker creates an executable which is capable of running on
54the target hardware or simulator.
55
56Step 4: RTEMS shell provides the "rtrace" command to display and save trace
57buffers.
58
59.. comment: taken from https://devel.rtems.org/wiki/Developer/Tracing
60.. figure:: ../../images/user/rtems-trace-buffering.png
61  :align: center
62  :width: 75%
63
64.. _printk:
65
66RTEMS Trace Using Printk
67========================
68
69This scheme of tracing goes through the flow of events described in a subsequent
70flowchart:
71
72Step 1: The user creates an RTEMS application in the normal manner as well as a
73Trace Linker configuration file. The configuration file specifies using the
74Printk trace mode and the functions to trace. The user invokes the Trace Linker
75with the configuration and the normal link command line used to the link the
76application executable. The application ELF object files and libraries,
77including the RTEMS libraries are standard and do not need to be built
78specially.
79
80Step 2: The RTEMS Trace Linker reads the user's configuration file and that
81results in it reading the standard Printk Trace Configuration files installed
82with the RTEMS Trace Linker. The trace linker uses the target compiler and
83linker to create the trace enabled application executable. It wraps the
84functions defined in the user's configuration with code that prints the entry
85with arguments and exit and return value if any. The trace wrapper code is
86compiled with the target compiler and the resulting ELF object file is added to
87the standard link command line used to link the application and the application
88is relinked using the wrapping option of the GNU linker.
89
90Step 3: The trace linker creates and RTEMS ELF executable that can be run on the
91target hardware or simulator.
92
93Step 4: The application is run in the hardware directly or using a debugger. The
94printk() output appears on the target console and the user can save that to a
95file.
96
97.. comment: taken from https://devel.rtems.org/wiki/Developer/Tracing
98.. figure:: ../../images/user/rtems-trace-printk.png
99  :align: center
100  :width: 75%
101
102The :ref:`examples` section describes generation of traces using Trace Buffering
103technique for the `fileio` testsuite available with RTEMS installation.
Note: See TracBrowser for help on using the repository browser.