
Since U-Boot's tracing feature was originally written, quite a few changes have taken place in this domain. The original text format used by tracing is still emitted by Linux, but a new trace-cmd tool has invented a binary format which is now used by new tools, such as kernelshark.
With recent distributions and the move to Python 3, the old pybootchart tool does not build or run. Unfortunately there is no 1:1 replacement for the features that were provided by pybootchart, or at least it is not obvious. Still, it makes sense to keep with the times.
This series updates proftool to use the new binary format, adding support for function and funcgraph tracing, so that U-Boot's trace records can be examined by trace-cmd and kernelshark.
This series also adds support for a flamegraph, which provides a visual way to see which functions are called a lot, as well as which ones consume the most time.
Some minor updates to the trace implementation within U-Boot are included, to provide a little more information and to fix a few problems.
No unit tests are provided by proftool, but a functional test ensures that sandbox can emit traces which can be processed by proftool, then parsed by trace-cmd and that the timing of the various formats looks consistent.
Simon Glass (24): .gitignore: Ignore the moveconfig database sandbox: Expand the space for sandbox_vpl sandbox: Bring back setting mon_len in global_data dm: Allow serial output during the relocation process timer: Tidy up use of notrace time: Tidy up some unnecessary #ifdefs trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT abuf: Support use from tools trace: Update the file header trace: Reduce the number of function sites trace: Track the minimum stack depth trace: Show a few more stats about tracing trace: Correct the relocation handover with buffer overflow trace: Detect an infinite loop trace: Rename prof to trace and improve comments trace: Update proftool to use new binary format trace: Drop use of objsection trace: Use text_base from the trace header trace: Support output of funcgraph records trace: Support output of a flamegraph trace: Provide a flamegraph that uses timing Docker: Support trace-cmd trace: Add a test trace: Update documentation
.azure-pipelines.yml | 8 + .gitattributes | 1 + .gitignore | 3 + .gitlab-ci.yml | 12 + arch/sandbox/dts/sandbox_vpl.dtsi | 4 +- common/board_f.c | 3 + common/board_r.c | 9 + doc/develop/pics/flamegraph.png | Bin 0 -> 48224 bytes doc/develop/pics/flamegraph_timing.png | Bin 0 -> 31305 bytes doc/develop/pics/flamegraph_zoom.png | Bin 0 -> 25465 bytes doc/develop/pics/kernelshark.png | Bin 0 -> 29617 bytes doc/develop/pics/kernelshark_fg.png | Bin 0 -> 28899 bytes doc/develop/trace.rst | 281 ++++- doc/usage/cmd/trace.rst | 163 +++ doc/usage/index.rst | 1 + drivers/core/device.c | 3 +- drivers/timer/timer-uclass.c | 2 +- include/timer.h | 13 +- include/trace.h | 18 +- lib/Kconfig | 2 +- lib/abuf.c | 21 +- lib/time.c | 14 +- lib/trace.c | 93 +- test/py/tests/test_trace.py | 304 +++++ tools/Makefile | 3 + tools/docker/Dockerfile | 16 + tools/proftool.c | 1598 ++++++++++++++++++++++-- 27 files changed, 2345 insertions(+), 227 deletions(-) create mode 100644 doc/develop/pics/flamegraph.png create mode 100644 doc/develop/pics/flamegraph_timing.png create mode 100644 doc/develop/pics/flamegraph_zoom.png create mode 100644 doc/develop/pics/kernelshark.png create mode 100644 doc/develop/pics/kernelshark_fg.png create mode 100644 doc/usage/cmd/trace.rst create mode 100644 test/py/tests/test_trace.py