llvm-profdata.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. llvm-profdata - Profile data tool
  2. =================================
  3. SYNOPSIS
  4. --------
  5. :program:`llvm-profdata` *command* [*args...*]
  6. DESCRIPTION
  7. -----------
  8. The :program:`llvm-profdata` tool is a small utility for working with profile
  9. data files.
  10. COMMANDS
  11. --------
  12. * :ref:`merge <profdata-merge>`
  13. * :ref:`show <profdata-show>`
  14. .. program:: llvm-profdata merge
  15. .. _profdata-merge:
  16. MERGE
  17. -----
  18. SYNOPSIS
  19. ^^^^^^^^
  20. :program:`llvm-profdata merge` [*options*] [*filename...*]
  21. DESCRIPTION
  22. ^^^^^^^^^^^
  23. :program:`llvm-profdata merge` takes several profile data files
  24. generated by PGO instrumentation and merges them together into a single
  25. indexed profile data file.
  26. By default profile data is merged without modification. This means that the
  27. relative importance of each input file is proportional to the number of samples
  28. or counts it contains. In general, the input from a longer training run will be
  29. interpreted as relatively more important than a shorter run. Depending on the
  30. nature of the training runs it may be useful to adjust the weight given to each
  31. input file by using the ``-weighted-input`` option.
  32. Profiles passed in via ``-weighted-input``, ``-input-files``, or via positional
  33. arguments are processed once for each time they are seen.
  34. OPTIONS
  35. ^^^^^^^
  36. .. option:: -help
  37. Print a summary of command line options.
  38. .. option:: -output=output, -o=output
  39. Specify the output file name. *Output* cannot be ``-`` as the resulting
  40. indexed profile data can't be written to standard output.
  41. .. option:: -weighted-input=weight,filename
  42. Specify an input file name along with a weight. The profile counts of the
  43. supplied ``filename`` will be scaled (multiplied) by the supplied
  44. ``weight``, where where ``weight`` is a decimal integer >= 1.
  45. Input files specified without using this option are assigned a default
  46. weight of 1. Examples are shown below.
  47. .. option:: -input-files=path, -f=path
  48. Specify a file which contains a list of files to merge. The entries in this
  49. file are newline-separated. Lines starting with '#' are skipped. Entries may
  50. be of the form <filename> or <weight>,<filename>.
  51. .. option:: -instr (default)
  52. Specify that the input profile is an instrumentation-based profile.
  53. .. option:: -sample
  54. Specify that the input profile is a sample-based profile.
  55. The format of the generated file can be generated in one of three ways:
  56. .. option:: -binary (default)
  57. Emit the profile using a binary encoding. For instrumentation-based profile
  58. the output format is the indexed binary format.
  59. .. option:: -text
  60. Emit the profile in text mode. This option can also be used with both
  61. sample-based and instrumentation-based profile. When this option is used
  62. the profile will be dumped in the text format that is parsable by the profile
  63. reader.
  64. .. option:: -gcc
  65. Emit the profile using GCC's gcov format (Not yet supported).
  66. .. option:: -sparse[=true|false]
  67. Do not emit function records with 0 execution count. Can only be used in
  68. conjunction with -instr. Defaults to false, since it can inhibit compiler
  69. optimization during PGO.
  70. .. option:: -num-threads=N, -j=N
  71. Use N threads to perform profile merging. When N=0, llvm-profdata auto-detects
  72. an appropriate number of threads to use. This is the default.
  73. EXAMPLES
  74. ^^^^^^^^
  75. Basic Usage
  76. +++++++++++
  77. Merge three profiles:
  78. ::
  79. llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
  80. Weighted Input
  81. ++++++++++++++
  82. The input file `foo.profdata` is especially important, multiply its counts by 10:
  83. ::
  84. llvm-profdata merge -weighted-input=10,foo.profdata bar.profdata baz.profdata -output merged.profdata
  85. Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
  86. ::
  87. llvm-profdata merge -weighted-input=10,foo.profdata -weighted-input=1,bar.profdata -weighted-input=1,baz.profdata -output merged.profdata
  88. .. program:: llvm-profdata show
  89. .. _profdata-show:
  90. SHOW
  91. ----
  92. SYNOPSIS
  93. ^^^^^^^^
  94. :program:`llvm-profdata show` [*options*] [*filename*]
  95. DESCRIPTION
  96. ^^^^^^^^^^^
  97. :program:`llvm-profdata show` takes a profile data file and displays the
  98. information about the profile counters for this file and
  99. for any of the specified function(s).
  100. If *filename* is omitted or is ``-``, then **llvm-profdata show** reads its
  101. input from standard input.
  102. OPTIONS
  103. ^^^^^^^
  104. .. option:: -all-functions
  105. Print details for every function.
  106. .. option:: -counts
  107. Print the counter values for the displayed functions.
  108. .. option:: -function=string
  109. Print details for a function if the function's name contains the given string.
  110. .. option:: -help
  111. Print a summary of command line options.
  112. .. option:: -output=output, -o=output
  113. Specify the output file name. If *output* is ``-`` or it isn't specified,
  114. then the output is sent to standard output.
  115. .. option:: -instr (default)
  116. Specify that the input profile is an instrumentation-based profile.
  117. .. option:: -text
  118. Instruct the profile dumper to show profile counts in the text format of the
  119. instrumentation-based profile data representation. By default, the profile
  120. information is dumped in a more human readable form (also in text) with
  121. annotations.
  122. .. option:: -topn=n
  123. Instruct the profile dumper to show the top ``n`` functions with the
  124. hottest basic blocks in the summary section. By default, the topn functions
  125. are not dumped.
  126. .. option:: -sample
  127. Specify that the input profile is a sample-based profile.
  128. .. option:: -memop-sizes
  129. Show the profiled sizes of the memory intrinsic calls for shown functions.
  130. EXIT STATUS
  131. -----------
  132. :program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
  133. if it cannot read input files, or if there is a mismatch between their data.