blob: 12f2771bd00422e60e552d95b1113f82303e31fd [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
Sean Silva84d19222016-05-28 01:03:36 +000062 Specify an input file name along with a weight. The profile counts of the
63 supplied ``filename`` will be scaled (multiplied) by the supplied
64 ``weight``, where where ``weight`` is a decimal integer >= 1.
65 Input files specified without using this option are assigned a default
66 weight of 1. Examples are shown below.
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000067
Diego Novillo6555adb2015-05-28 21:57:17 +000068.. option:: -instr (default)
69
Xinliang David Li2fc25152015-11-24 20:48:25 +000070 Specify that the input profile is an instrumentation-based profile.
Diego Novillo6555adb2015-05-28 21:57:17 +000071
72.. option:: -sample
73
Xinliang David Li2fc25152015-11-24 20:48:25 +000074 Specify that the input profile is a sample-based profile.
75
76 The format of the generated file can be generated in one of three ways:
Diego Novillo6555adb2015-05-28 21:57:17 +000077
78 .. option:: -binary (default)
79
Xinliang David Li2fc25152015-11-24 20:48:25 +000080 Emit the profile using a binary encoding. For instrumentation-based profile
81 the output format is the indexed binary format.
Diego Novillo6555adb2015-05-28 21:57:17 +000082
83 .. option:: -text
84
Xinliang David Li2fc25152015-11-24 20:48:25 +000085 Emit the profile in text mode. This option can also be used with both
86 sample-based and instrumentation-based profile. When this option is used
87 the profile will be dumped in the text format that is parsable by the profile
88 reader.
Diego Novillo6555adb2015-05-28 21:57:17 +000089
90 .. option:: -gcc
91
92 Emit the profile using GCC's gcov format (Not yet supported).
93
Vedant Kumar00dab222016-01-29 22:54:45 +000094 .. option:: -sparse[=true|false]
95
96 Do not emit function records with 0 execution count. Can only be used in
97 conjunction with -instr. Defaults to false, since it can inhibit compiler
98 optimization during PGO.
99
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +0000100EXAMPLES
101^^^^^^^^
102Basic Usage
103+++++++++++
104Merge three profiles:
105
106::
107
108 llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
109
110Weighted Input
111++++++++++++++
112The input file `foo.profdata` is especially important, multiply its counts by 10:
113
114::
115
116 llvm-profdata merge -weighted-input=10,foo.profdata bar.profdata baz.profdata -output merged.profdata
117
118Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
119
120::
121
122 llvm-profdata merge -weighted-input=10,foo.profdata -weighted-input=1,bar.profdata -weighted-input=1,baz.profdata -output merged.profdata
123
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000124.. program:: llvm-profdata show
125
Justin Bogner22b9f6a2015-03-12 01:38:50 +0000126.. _profdata-show:
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000127
128SHOW
129----
130
131SYNOPSIS
132^^^^^^^^
133
134:program:`llvm-profdata show` [*options*] [*filename*]
135
136DESCRIPTION
137^^^^^^^^^^^
138
139:program:`llvm-profdata show` takes a profile data file and displays the
140information about the profile counters for this file and
141for any of the specified function(s).
142
143If *filename* is omitted or is ``-``, then **llvm-profdata show** reads its
144input from standard input.
145
146OPTIONS
147^^^^^^^
148
149.. option:: -all-functions
150
151 Print details for every function.
152
153.. option:: -counts
154
155 Print the counter values for the displayed functions.
156
157.. option:: -function=string
158
159 Print details for a function if the function's name contains the given string.
160
161.. option:: -help
162
163 Print a summary of command line options.
164
165.. option:: -output=output, -o=output
166
167 Specify the output file name. If *output* is ``-`` or it isn't specified,
168 then the output is sent to standard output.
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000169
Diego Novillo6555adb2015-05-28 21:57:17 +0000170.. option:: -instr (default)
171
172 Specify that the input profile is an instrumentation-based profile.
173
Xinliang David Li6f7c19a2015-11-23 20:47:38 +0000174.. option:: -text
175
176 Instruct the profile dumper to show profile counts in the text format of the
177 instrumentation-based profile data representation. By default, the profile
178 information is dumped in a more human readable form (also in text) with
179 annotations.
180
Diego Novillo6555adb2015-05-28 21:57:17 +0000181.. option:: -sample
182
183 Specify that the input profile is a sample-based profile.
184
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000185EXIT STATUS
186-----------
187
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000188:program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
189if it cannot read input files, or if there is a mismatch between their data.