trace.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. trace command
  3. =============
  4. Synopis
  5. -------
  6. ::
  7. trace stats
  8. trace pause
  9. trace resume
  10. trace funclist [<addr> <size>]
  11. trace calls [<addr> <size>]
  12. Description
  13. -----------
  14. The *trace* command is used to control the U-Boot tracing system. It allows
  15. tracing to be paused and resumed, shows statistics for traces and provides a
  16. way to dump out the trace information.
  17. trace stats
  18. ~~~~~~~~~~~
  19. This display tracing statistics, as follows:
  20. function sites
  21. Functions are binned as a way of reducing the amount of space needed to
  22. hold all the function information. This is controlled by FUNC_SITE_SIZE in
  23. the trace.h header file. The usual value is 4, which provides the finest
  24. granularity (assuming a minimum instruction size of 4 bytes) which means
  25. that every function can be resolved individually.
  26. function calls
  27. Total number of function calls, including those which were not traced due
  28. to buffer space. This count does not include functions which exceeded the
  29. depth limit.
  30. untracked function calls
  31. Total number of function calls which did not appear in the U-Boot image.
  32. This can happen if a function is called outside the normal code area.
  33. traced function calls
  34. Total number of function calls which were actually traced, i.e. are included
  35. in the recorded trace data.
  36. dropped due to overflow
  37. If the trace buffer was exhausted then this shows the number of records that
  38. were dropped. Try reducing the depth limit or expanding the buffer size.
  39. maximum observed call depth
  40. Maximum observed call depth while tracing.
  41. calls not traced due to depth
  42. Counts the number of function calls that were not recorded because they
  43. exceeded the maximum call depth.
  44. max function calls
  45. Maximum number of function calls which can be recorded in the trace buffer,
  46. given its size. Once `function calls` hits this value, recording stops.
  47. trace buffer
  48. Address of trace buffer
  49. call records
  50. Address of first trace record. This is near the start of the trace buffer,
  51. after the function-call counts.
  52. trace pause
  53. ~~~~~~~~~~~
  54. Pauses tracing, so that no more data is added to the trace buffer.
  55. trace resume
  56. ~~~~~~~~~~~~
  57. Resumes tracing, so that new function calls are added to the trace buffer if
  58. there is sufficient space.
  59. trace funclist [<addr> <size>]
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. Dumps a list of functions into the provided buffer. The file uses a format
  62. specific to U-Boot: a header, following by the function offset and call count.
  63. If the address and size are not given, these are obtained from
  64. :ref:`develop/trace:environment variables`. In any case the environment
  65. variables are updated after the command runs.
  66. The resulting data should be written out to the host, e.g. using Ethernet or
  67. a filesystem. There are no tools provided to read this sdata.
  68. trace calls [<addr> <size>]
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. Dumps a list of function calls into the provided buffer. The file uses a format
  71. specific to U-Boot: a header, following by the list of calls. The proftool
  72. tool can be used to convert this information ready for further analysis.
  73. Example
  74. -------
  75. ::
  76. => trace stats
  77. 269,252 function sites
  78. 38,025,059 function calls
  79. 3 untracked function calls
  80. 7,382,690 traced function calls
  81. 17 maximum observed call depth
  82. 15 call depth limit
  83. 68,667,432 calls not traced due to depth
  84. 22,190,112 max function calls
  85. trace buffer 6c000000 call records 6c20de78
  86. => trace resume
  87. => trace pause
  88. This shows that resuming the trace causes the buffer to overflow::
  89. => trace stats
  90. 269,252 function sites
  91. 49,573,694 function calls
  92. 3 untracked function calls
  93. 22,190,112 traced function calls (8289848 dropped due to overflow)
  94. 17 maximum observed call depth
  95. 15 call depth limit
  96. 68,667,432 calls not traced due to depth
  97. 22,190,112 max function calls
  98. trace buffer 6c000000 call records 6c20de78
  99. => trace funcs 30000000 0x100000
  100. Function trace dumped to 30000000, size 0x1e70
  101. This shows collecting and writing out the result trace data:
  102. ::
  103. => trace calls 20000000 0x10000000
  104. Call list dumped to 20000000, size 0xfdf21a0
  105. => save mmc 1:1 20000000 /trace ${profoffset}
  106. File System is consistent
  107. file found, deleting
  108. update journal finished
  109. File System is consistent
  110. update journal finished
  111. 266281376 bytes written in 18584 ms (13.7 MiB/s)
  112. From here you can use proftool to convert it:
  113. .. code-block:: bash
  114. tools/proftool -m System.map -t trace -o asc.fg dump-ftrace
  115. .. _`ACPI specification`: https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf