doc: move README.trace to HTML documentation

Convert README.trace to reStructured text and move it to develop/trace.rst.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt 2020-12-12 10:14:22 +01:00
parent d0253f7e5c
commit dce26c7d56
2 changed files with 120 additions and 110 deletions

View file

@ -12,3 +12,4 @@ Develop U-Boot
crash_dumps crash_dumps
global_data global_data
logging logging
trace

View file

@ -1,6 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+ .. SPDX-License-Identifier: GPL-2.0+
# .. Copyright (c) 2013 The Chromium OS Authors.
# Copyright (c) 2013 The Chromium OS Authors.
Tracing in U-Boot Tracing in U-Boot
================= =================
@ -33,6 +32,8 @@ this, follow these steps:
Add the following to include/configs/sandbox.h (if not already there) Add the following to include/configs/sandbox.h (if not already there)
.. code-block:: c
#define CONFIG_TRACE #define CONFIG_TRACE
#define CONFIG_CMD_TRACE #define CONFIG_CMD_TRACE
#define CONFIG_TRACE_BUFFER_SIZE (16 << 20) #define CONFIG_TRACE_BUFFER_SIZE (16 << 20)
@ -42,14 +43,17 @@ Add the following to include/configs/sandbox.h (if not already there)
Build sandbox U-Boot with tracing enabled: Build sandbox U-Boot with tracing enabled:
.. code-block:: console
$ make FTRACE=1 O=sandbox sandbox_config $ make FTRACE=1 O=sandbox sandbox_config
$ make FTRACE=1 O=sandbox $ make FTRACE=1 O=sandbox
Run sandbox, wait for a bit of trace information to appear, and then capture Run sandbox, wait for a bit of trace information to appear, and then capture
a trace: a trace:
$ ./sandbox/u-boot .. code-block:: console
$ ./sandbox/u-boot
U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24) U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24)
@ -93,11 +97,15 @@ Environment size: 117/8188 bytes
=>reset =>reset
Then run proftool to convert the trace information to ftrace format. Then run proftool to convert the trace information to ftrace format
.. code-block:: console
$ ./sandbox/tools/proftool -m sandbox/System.map -p trace dump-ftrace >trace.txt $ ./sandbox/tools/proftool -m sandbox/System.map -p trace dump-ftrace >trace.txt
Finally run pytimechart to display it: Finally run pytimechart to display it
.. code-block:: console
$ pytimechart trace.txt $ pytimechart trace.txt
@ -109,22 +117,22 @@ function.
CONFIG Options CONFIG Options
-------------- --------------
- CONFIG_TRACE CONFIG_TRACE
Enables the trace feature in U-Boot. Enables the trace feature in U-Boot.
- CONFIG_CMD_TRACE CONFIG_CMD_TRACE
Enables the trace command. Enables the trace command.
- CONFIG_TRACE_BUFFER_SIZE CONFIG_TRACE_BUFFER_SIZE
Size of trace buffer to allocate for U-Boot. This buffer is Size of trace buffer to allocate for U-Boot. This buffer is
used after relocation, as a place to put function tracing used after relocation, as a place to put function tracing
information. The address of the buffer is determined by information. The address of the buffer is determined by
the relocation code. the relocation code.
- CONFIG_TRACE_EARLY CONFIG_TRACE_EARLY
Define this to start tracing early, before relocation. Define this to start tracing early, before relocation.
- CONFIG_TRACE_EARLY_SIZE CONFIG_TRACE_EARLY_SIZE
Size of 'early' trace buffer. Before U-Boot has relocated Size of 'early' trace buffer. Before U-Boot has relocated
it doesn't have a proper trace buffer. On many boards it doesn't have a proper trace buffer. On many boards
you can define an area of memory to use for the trace you can define an area of memory to use for the trace
@ -132,7 +140,7 @@ CONFIG Options
relocation. The contents of this buffer are then copied to relocation. The contents of this buffer are then copied to
the real buffer. the real buffer.
- CONFIG_TRACE_EARLY_ADDR CONFIG_TRACE_EARLY_ADDR
Address of early trace buffer Address of early trace buffer
@ -191,19 +199,19 @@ Commands
The trace command has variable sub-commands: The trace command has variable sub-commands:
- stats stats
Display tracing statistics Display tracing statistics
- pause pause
Pause tracing Pause tracing
- resume resume
Resume tracing Resume tracing
- funclist [<addr> <size>] funclist [<addr> <size>]
Dump a list of functions into the buffer Dump a list of functions into the buffer
- calls [<addr> <size>] calls [<addr> <size>]
Dump function call trace into buffer Dump function call trace into buffer
If the address and size are not given, these are obtained from environment If the address and size are not given, these are obtained from environment
@ -216,13 +224,13 @@ Environment Variables
The following are used: The following are used:
- profbase profbase
Base address of trace output buffer Base address of trace output buffer
- profoffset profoffset
Offset of first unwritten byte in trace output buffer Offset of first unwritten byte in trace output buffer
- profsize profsize
Size of trace output buffer Size of trace output buffer
All of these are set by the 'trace calls' command. All of these are set by the 'trace calls' command.
@ -231,15 +239,15 @@ These variables keep track of the amount of data written to the trace
output buffer by the 'trace' command. The trace commands which write data output buffer by the 'trace' command. The trace commands which write data
to the output buffer can use these to specify the buffer to write to, and to the output buffer can use these to specify the buffer to write to, and
update profoffset each time. This allows successive commands to append data update profoffset each time. This allows successive commands to append data
to the same buffer, for example: to the same buffer, for example::
trace funclist 10000 e00000 => trace funclist 10000 e00000
trace calls => trace calls
(the latter command appends more data to the buffer). (the latter command appends more data to the buffer).
- fakegocmd fakegocmd
Specifies commands to run just before booting the OS. This Specifies commands to run just before booting the OS. This
is a useful time to write the trace data to the host for is a useful time to write the trace data to the host for
processing. processing.
@ -250,7 +258,7 @@ Writing Out Trace Data
Once the trace data is in an output buffer in memory there are various ways Once the trace data is in an output buffer in memory there are various ways
to transmit it to the host. Notably you can use tftput to send the data to transmit it to the host. Notably you can use tftput to send the data
over a network link: over a network link::
fakegocmd=trace pause; usb start; set autoload n; bootp; fakegocmd=trace pause; usb start; set autoload n; bootp;
trace calls 10000000 1000000; trace calls 10000000 1000000;
@ -272,6 +280,7 @@ This tool must be given the U-Boot map file and the trace data received
from running that U-Boot. It produces a text output file. from running that U-Boot. It produces a text output file.
Options Options
-m <map_file> -m <map_file>
Specify U-Boot map file Specify U-Boot map file
@ -280,7 +289,7 @@ Options
Commands: Commands:
- dump-ftrace dump-ftrace
Write a text dump of the file in Linux ftrace format to stdout Write a text dump of the file in Linux ftrace format to stdout