blob: 7f647ef1c47f0ae68fe147c65d1753a6ed45d0c7 [file] [log] [blame]
Alex Lorenzbf4508b2014-07-30 20:30:11 +00001llvm-profdata - Profile data tool
2=================================
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +00003
4SYNOPSIS
5--------
6
Alex Lorenzbf4508b2014-07-30 20:30:11 +00007:program:`llvm-profdata` *command* [*args...*]
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +00008
9DESCRIPTION
10-----------
11
Alex Lorenzbf4508b2014-07-30 20:30:11 +000012The :program:`llvm-profdata` tool is a small utility for working with profile
13data files.
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +000014
Alex Lorenzbf4508b2014-07-30 20:30:11 +000015COMMANDS
16--------
17
Justin Bogner22b9f6a2015-03-12 01:38:50 +000018* :ref:`merge <profdata-merge>`
19* :ref:`show <profdata-show>`
Alex Lorenzbf4508b2014-07-30 20:30:11 +000020
21.. program:: llvm-profdata merge
22
Justin Bogner22b9f6a2015-03-12 01:38:50 +000023.. _profdata-merge:
Alex Lorenzbf4508b2014-07-30 20:30:11 +000024
25MERGE
26-----
27
28SYNOPSIS
29^^^^^^^^
30
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000031:program:`llvm-profdata merge` [*options*] [*filename...*]
Alex Lorenzbf4508b2014-07-30 20:30:11 +000032
33DESCRIPTION
34^^^^^^^^^^^
35
36:program:`llvm-profdata merge` takes several profile data files
37generated by PGO instrumentation and merges them together into a single
38indexed profile data file.
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +000039
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000040By default profile data is merged without modification. This means that the
41relative importance of each input file is proportional to the number of samples
42or counts it contains. In general, the input from a longer training run will be
43interpreted as relatively more important than a shorter run. Depending on the
44nature of the training runs it may be useful to adjust the weight given to each
45input file by using the ``-weighted-input`` option.
46
47
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +000048OPTIONS
Alex Lorenzbf4508b2014-07-30 20:30:11 +000049^^^^^^^
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +000050
Alex Lorenzbf4508b2014-07-30 20:30:11 +000051.. option:: -help
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +000052
Alex Lorenzbf4508b2014-07-30 20:30:11 +000053 Print a summary of command line options.
54
55.. option:: -output=output, -o=output
56
57 Specify the output file name. *Output* cannot be ``-`` as the resulting
58 indexed profile data can't be written to standard output.
59
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000060.. option:: -weighted-input=weight,filename
61
62 Specify an input file name along with a weight. The profile counts of the input
63 file will be scaled (multiplied) by the supplied ``weight``, where where ``weight``
64 is a decimal integer >= 1. Input files specified without using this option are
65 assigned a default weight of 1. Examples are shown below.
66
Diego Novillo6555adb2015-05-28 21:57:17 +000067.. option:: -instr (default)
68
Xinliang David Li2fc25152015-11-24 20:48:25 +000069 Specify that the input profile is an instrumentation-based profile.
Diego Novillo6555adb2015-05-28 21:57:17 +000070
71.. option:: -sample
72
Xinliang David Li2fc25152015-11-24 20:48:25 +000073 Specify that the input profile is a sample-based profile.
74
75 The format of the generated file can be generated in one of three ways:
Diego Novillo6555adb2015-05-28 21:57:17 +000076
77 .. option:: -binary (default)
78
Xinliang David Li2fc25152015-11-24 20:48:25 +000079 Emit the profile using a binary encoding. For instrumentation-based profile
80 the output format is the indexed binary format.
Diego Novillo6555adb2015-05-28 21:57:17 +000081
82 .. option:: -text
83
Xinliang David Li2fc25152015-11-24 20:48:25 +000084 Emit the profile in text mode. This option can also be used with both
85 sample-based and instrumentation-based profile. When this option is used
86 the profile will be dumped in the text format that is parsable by the profile
87 reader.
Diego Novillo6555adb2015-05-28 21:57:17 +000088
89 .. option:: -gcc
90
91 Emit the profile using GCC's gcov format (Not yet supported).
92
Vedant Kumar00dab222016-01-29 22:54:45 +000093 .. option:: -sparse[=true|false]
94
95 Do not emit function records with 0 execution count. Can only be used in
96 conjunction with -instr. Defaults to false, since it can inhibit compiler
97 optimization during PGO.
98
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000099EXAMPLES
100^^^^^^^^
101Basic Usage
102+++++++++++
103Merge three profiles:
104
105::
106
107 llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
108
109Weighted Input
110++++++++++++++
111The input file `foo.profdata` is especially important, multiply its counts by 10:
112
113::
114
115 llvm-profdata merge -weighted-input=10,foo.profdata bar.profdata baz.profdata -output merged.profdata
116
117Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
118
119::
120
121 llvm-profdata merge -weighted-input=10,foo.profdata -weighted-input=1,bar.profdata -weighted-input=1,baz.profdata -output merged.profdata
122
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000123.. program:: llvm-profdata show
124
Justin Bogner22b9f6a2015-03-12 01:38:50 +0000125.. _profdata-show:
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000126
127SHOW
128----
129
130SYNOPSIS
131^^^^^^^^
132
133:program:`llvm-profdata show` [*options*] [*filename*]
134
135DESCRIPTION
136^^^^^^^^^^^
137
138:program:`llvm-profdata show` takes a profile data file and displays the
139information about the profile counters for this file and
140for any of the specified function(s).
141
142If *filename* is omitted or is ``-``, then **llvm-profdata show** reads its
143input from standard input.
144
145OPTIONS
146^^^^^^^
147
148.. option:: -all-functions
149
150 Print details for every function.
151
152.. option:: -counts
153
154 Print the counter values for the displayed functions.
155
156.. option:: -function=string
157
158 Print details for a function if the function's name contains the given string.
159
160.. option:: -help
161
162 Print a summary of command line options.
163
164.. option:: -output=output, -o=output
165
166 Specify the output file name. If *output* is ``-`` or it isn't specified,
167 then the output is sent to standard output.
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000168
Diego Novillo6555adb2015-05-28 21:57:17 +0000169.. option:: -instr (default)
170
171 Specify that the input profile is an instrumentation-based profile.
172
Xinliang David Li6f7c19a2015-11-23 20:47:38 +0000173.. option:: -text
174
175 Instruct the profile dumper to show profile counts in the text format of the
176 instrumentation-based profile data representation. By default, the profile
177 information is dumped in a more human readable form (also in text) with
178 annotations.
179
Diego Novillo6555adb2015-05-28 21:57:17 +0000180.. option:: -sample
181
182 Specify that the input profile is a sample-based profile.
183
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000184EXIT STATUS
185-----------
186
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000187:program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
188if it cannot read input files, or if there is a mismatch between their data.