1 llvm-profdata - Profile data tool
2 =================================
7 :program:`llvm-profdata` *command* [*args...*]
12 The :program:`llvm-profdata` tool is a small utility for working with profile
18 * :ref:`merge <profdata-merge>`
19 * :ref:`show <profdata-show>`
21 .. program:: llvm-profdata merge
31 :program:`llvm-profdata merge` [*options*] [*filename...*]
36 :program:`llvm-profdata merge` takes several profile data files
37 generated by PGO instrumentation and merges them together into a single
38 indexed profile data file.
40 By default profile data is merged without modification. This means that the
41 relative importance of each input file is proportional to the number of samples
42 or counts it contains. In general, the input from a longer training run will be
43 interpreted as relatively more important than a shorter run. Depending on the
44 nature of the training runs it may be useful to adjust the weight given to each
45 input file by using the ``-weighted-input`` option.
47 Profiles passed in via ``-weighted-input``, ``-input-files``, or via positional
48 arguments are processed once for each time they are seen.
56 Print a summary of command line options.
58 .. option:: -output=output, -o=output
60 Specify the output file name. *Output* cannot be ``-`` as the resulting
61 indexed profile data can't be written to standard output.
63 .. option:: -weighted-input=weight,filename
65 Specify an input file name along with a weight. The profile counts of the
66 supplied ``filename`` will be scaled (multiplied) by the supplied
67 ``weight``, where where ``weight`` is a decimal integer >= 1.
68 Input files specified without using this option are assigned a default
69 weight of 1. Examples are shown below.
71 .. option:: -input-files=path, -f=path
73 Specify a file which contains a list of files to merge. The entries in this
74 file are newline-separated. Lines starting with '#' are skipped. Entries may
75 be of the form <filename> or <weight>,<filename>.
77 .. option:: -remapping-file=path, -r=path
79 Specify a file which contains a remapping from symbol names in the input
80 profile to the symbol names that should be used in the output profile. The
81 file should consist of lines of the form ``<input-symbol> <output-symbol>``.
82 Blank lines and lines starting with ``#`` are skipped.
84 The :doc:`llvm-cxxmap <llvm-cxxmap>` tool can be used to generate the symbol
87 .. option:: -instr (default)
89 Specify that the input profile is an instrumentation-based profile.
93 Specify that the input profile is a sample-based profile.
95 The format of the generated file can be generated in one of three ways:
97 .. option:: -binary (default)
99 Emit the profile using a binary encoding. For instrumentation-based profile
100 the output format is the indexed binary format.
104 Emit the profile in text mode. This option can also be used with both
105 sample-based and instrumentation-based profile. When this option is used
106 the profile will be dumped in the text format that is parsable by the profile
111 Emit the profile using GCC's gcov format (Not yet supported).
113 .. option:: -sparse[=true|false]
115 Do not emit function records with 0 execution count. Can only be used in
116 conjunction with -instr. Defaults to false, since it can inhibit compiler
117 optimization during PGO.
119 .. option:: -num-threads=N, -j=N
121 Use N threads to perform profile merging. When N=0, llvm-profdata auto-detects
122 an appropriate number of threads to use. This is the default.
128 Merge three profiles:
132 llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
136 The input file `foo.profdata` is especially important, multiply its counts by 10:
140 llvm-profdata merge -weighted-input=10,foo.profdata bar.profdata baz.profdata -output merged.profdata
142 Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
146 llvm-profdata merge -weighted-input=10,foo.profdata -weighted-input=1,bar.profdata -weighted-input=1,baz.profdata -output merged.profdata
148 .. program:: llvm-profdata show
158 :program:`llvm-profdata show` [*options*] [*filename*]
163 :program:`llvm-profdata show` takes a profile data file and displays the
164 information about the profile counters for this file and
165 for any of the specified function(s).
167 If *filename* is omitted or is ``-``, then **llvm-profdata show** reads its
168 input from standard input.
173 .. option:: -all-functions
175 Print details for every function.
179 Print the counter values for the displayed functions.
181 .. option:: -function=string
183 Print details for a function if the function's name contains the given string.
187 Print a summary of command line options.
189 .. option:: -output=output, -o=output
191 Specify the output file name. If *output* is ``-`` or it isn't specified,
192 then the output is sent to standard output.
194 .. option:: -instr (default)
196 Specify that the input profile is an instrumentation-based profile.
200 Instruct the profile dumper to show profile counts in the text format of the
201 instrumentation-based profile data representation. By default, the profile
202 information is dumped in a more human readable form (also in text) with
207 Instruct the profile dumper to show the top ``n`` functions with the
208 hottest basic blocks in the summary section. By default, the topn functions
213 Specify that the input profile is a sample-based profile.
215 .. option:: -memop-sizes
217 Show the profiled sizes of the memory intrinsic calls for shown functions.
222 :program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
223 if it cannot read input files, or if there is a mismatch between their data.