blob: 74fe4ee9d21941e56d7654a21c4da507b633052b [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
Nathan Slingerland7f5b47d2015-12-15 17:37:09 +000093EXAMPLES
94^^^^^^^^
95Basic Usage
96+++++++++++
97Merge three profiles:
98
99::
100
101 llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
102
103Weighted Input
104++++++++++++++
105The input file `foo.profdata` is especially important, multiply its counts by 10:
106
107::
108
109 llvm-profdata merge -weighted-input=10,foo.profdata bar.profdata baz.profdata -output merged.profdata
110
111Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
112
113::
114
115 llvm-profdata merge -weighted-input=10,foo.profdata -weighted-input=1,bar.profdata -weighted-input=1,baz.profdata -output merged.profdata
116
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000117.. program:: llvm-profdata show
118
Justin Bogner22b9f6a2015-03-12 01:38:50 +0000119.. _profdata-show:
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000120
121SHOW
122----
123
124SYNOPSIS
125^^^^^^^^
126
127:program:`llvm-profdata show` [*options*] [*filename*]
128
129DESCRIPTION
130^^^^^^^^^^^
131
132:program:`llvm-profdata show` takes a profile data file and displays the
133information about the profile counters for this file and
134for any of the specified function(s).
135
136If *filename* is omitted or is ``-``, then **llvm-profdata show** reads its
137input from standard input.
138
139OPTIONS
140^^^^^^^
141
142.. option:: -all-functions
143
144 Print details for every function.
145
146.. option:: -counts
147
148 Print the counter values for the displayed functions.
149
150.. option:: -function=string
151
152 Print details for a function if the function's name contains the given string.
153
154.. option:: -help
155
156 Print a summary of command line options.
157
158.. option:: -output=output, -o=output
159
160 Specify the output file name. If *output* is ``-`` or it isn't specified,
161 then the output is sent to standard output.
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000162
Diego Novillo6555adb2015-05-28 21:57:17 +0000163.. option:: -instr (default)
164
165 Specify that the input profile is an instrumentation-based profile.
166
Xinliang David Li6f7c19a2015-11-23 20:47:38 +0000167.. option:: -text
168
169 Instruct the profile dumper to show profile counts in the text format of the
170 instrumentation-based profile data representation. By default, the profile
171 information is dumped in a more human readable form (also in text) with
172 annotations.
173
Diego Novillo6555adb2015-05-28 21:57:17 +0000174.. option:: -sample
175
176 Specify that the input profile is a sample-based profile.
177
Duncan P. N. Exon Smith846a6272014-02-17 23:22:49 +0000178EXIT STATUS
179-----------
180
Alex Lorenzbf4508b2014-07-30 20:30:11 +0000181:program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
182if it cannot read input files, or if there is a mismatch between their data.