[U-Boot] [RFC PATCH 0/15] RFC: Add tracing functionality to U-Boot

Simon Glass sjg at chromium.org
Sun Apr 28 04:17:37 CEST 2013


This series adds a tracing feature to U-Boot which is useful for
profiling boot time and other purposes.

The core trace library relies on standard gcc function instrumentation
and a microsecond timer which should work correctly on almost any
architecture. Generic board is used to avoid the need to add the same
code in multiple places (CONFIG_SYS_GENERIC_BOARD).

Tracing must be built into the U-Boot image at build time, but can be
paused and resumed while running. A trace buffer is used to collect
trace information. This buffer can then be transmitted to a host for
processing. A host-based processing tool is provided which converts the
data to the same format used by Linux, and that can be read by the
pytimechart GUI tool.

A U-Boot 'trace' command provides access to the trace information,
including support for writing it to memory in a few forms.

Support is provided for stopping tracing at the last possible moment in
the bootm process (just before U-Boot jumps to the OS). This is done with
a new 'fake go' command, which allows bootm to go through the motions of
an OS boot without actually committing to it. Once the 'fake go' is
complete, U-Boot can stop tracing and continue execution to transmit the
trace information to the host, before jumping to the OS for real.

The system is tested on sandbox and has previously worked on ARM Tegra
and Exynos machines. A simple test script is provided for sandbox, along
with documentation on how to use the feature.

This feature has been successfully used alongside bootstage to locate
bottlenecks and reduce overall boot time.

Because of the bootm changes this series sits on top of the image
improvements that were done for verified boot. This series is available
at:

   http://git.denx.de/u-boot-x86.git

in branch 'trace'.


Simon Glass (15):
  bootstage; Correct printf types
  Add function to print a number with grouped digits
  Add trace library
  Add a trace command
  Support tracing in config.mk when enabled
  Add trace support to generic board
  Add proftool to decode profile data
  sandbox: Support trace feature
  Add a simple test for sandbox trace
  Clarify bootm OS arguments
  Refactor the bootm command to reduce code duplication
  Add a 'fake' go command to the bootm command
  arm: Implement the 'fake' go command
  Show stdout on error in fit-test
  exynos: Avoid function instrumentation for microsecond timer

 Makefile                               |   3 +-
 arch/arm/cpu/armv7/s5p-common/timer.c  |   2 +-
 arch/arm/include/asm/arch-exynos/cpu.h |  10 +-
 arch/arm/lib/bootm.c                   |  33 +-
 arch/microblaze/lib/bootm.c            |   4 +-
 arch/nios2/lib/bootm.c                 |   4 +-
 arch/openrisc/lib/bootm.c              |   4 +-
 arch/sandbox/cpu/cpu.c                 |   2 +-
 arch/sandbox/cpu/os.c                  |   2 +-
 common/Makefile                        |   1 +
 common/board_f.c                       |  15 +
 common/board_r.c                       |  11 +
 common/bootstage.c                     |  26 +-
 common/cmd_bootm.c                     | 517 ++++++++++++++--------------
 common/cmd_trace.c                     | 133 +++++++
 common/image-fdt.c                     |  13 +-
 common/image.c                         |  22 +-
 config.mk                              |  11 +-
 doc/README.trace                       | 361 +++++++++++++++++++
 include/asm-generic/global_data.h      |   3 +
 include/common.h                       |   4 +
 include/configs/sandbox.h              |  13 +
 include/image.h                        |  17 +-
 include/trace.h                        | 125 +++++++
 include/vsprintf.h                     |  11 +
 lib/Makefile                           |   1 +
 lib/trace.c                            | 378 ++++++++++++++++++++
 lib/vsprintf.c                         |  16 +
 test/image/test-fit.py                 |  19 +-
 test/trace/test-trace.sh               |  88 +++++
 tools/.gitignore                       |   1 +
 tools/Makefile                         |   6 +
 tools/proftool.c                       | 611 +++++++++++++++++++++++++++++++++
 33 files changed, 2133 insertions(+), 334 deletions(-)
 create mode 100644 common/cmd_trace.c
 create mode 100644 doc/README.trace
 create mode 100644 include/trace.h
 create mode 100644 lib/trace.c
 create mode 100755 test/trace/test-trace.sh
 create mode 100644 tools/proftool.c

-- 
1.8.2.1



More information about the U-Boot mailing list