LLVM-PROFDATA(1)
π LLVM-PROFDATA(1) π
okay bestie, welcome to llvm-profdata β it's part of the LLVM fam, and it's the little tool that handles your profile data files. she's small but she's mighty. let's get into it π«Ά
β¨ NAME β¨
llvm-profdata β the profile data tool. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
llvm-profdata command [argsβ¦]
π¦ DESCRIPTION π¦
so llvm-profdata is a small utility for working with profile data files. tiny tool, big responsibilities, main character energy fr fr. β¨
π COMMANDS π
here's the whole squad, pick your fighter:
mergeshowoverlap
π₯ MERGE π₯
SYNOPSIS
llvm-profdata merge [options] [filenameβ¦]
DESCRIPTION
llvm-profdata merge takes several profile data files β the ones generated by PGO instrumentation β and smooshes them together into a single indexed profile data file. like a friendship bracelet but for counters. π§
By default, profile data gets merged without modification. what does that mean bestie? it means the relative importance of each input file is proportional to the number of samples or counts it contains. so basically, input from a longer training run is read as relatively more important than a shorter run. that's just the math. π
Depending on the nature of your training runs, it may be useful to adjust the weight given to each input file β and you do that with the -weighted-input option. β¨
heads up: profiles passed in via-weighted-input,-input-files, or via positional arguments are processed once for each time they are seen. yes, she counts. she always counts. π
OPTIONS
--helpβ print a summary of command line options. your lil cheat sheet. π--output=<output>,-oβ specify the output file name. Output cannot be-β the resulting indexed profile data can't be written to standard output. so no piping to stdout, sorry bestie, the vibes say no. π--weighted-input=<weight,filename>β specify an input file name along with a weight. the profile counts of the supplied filename will be scaled (multiplied) by the supplied weight, where weight is a decimal integer >= 1. input files specified without using this option get assigned a default weight of 1. examples are down below, keep scrolling. π--input-files=<path>,-fβ specify a file which contains a list of files to merge. the entries in this file are newline-separated. lines starting with#are skipped. entries may be of the form<filename>or<weight>,<filename>. so many options, we love a flexible queen. π--remapping-file=<path>,-rβ specify a file which contains a remapping from symbol names in the input profile to the symbol names that should be used in the output profile. the file should consist of lines of the form<input-symbol> <output-symbol>. blank lines and lines starting with#are skipped. oh and fun fact: thellvm-cxxmaptool can be used to generate the symbol remapping file. iykyk. π--instr(default) β specify that the input profile is an instrumentation-based profile.--sampleβ specify that the input profile is a sample-based profile.
the format of the generated file can be generated in one of three ways:
--binary(default) β emit the profile using a binary encoding. for instrumentation-based profile the output format is the indexed binary format.--extbinaryβ emit the profile using an extensible binary encoding. this option can only be used with sample-based profile. the extensible binary encoding can be more compact with compression enabled and can be loaded faster than the default binary encoding. she's efficient AND fast, iconic. π--textβ emit the profile in text mode. this option can also be used with both sample-based and instrumentation-based profile. when this option is used the profile will be dumped in the text format that is parsable by the profile reader.--gccβ emit the profile using GCC's gcov format (Not yet supported). girl is still in her development era. π
--sparse[=true|false]β do not emit function records with0execution count. can only be used in conjunction with-instr. defaults to false, since it can inhibit compiler optimization during PGO. so like, careful, she's a little spicy. π₯--num-threads=<N>,-jβ use N threads to perform profile merging. whenN=0,llvm-profdataauto-detects an appropriate number of threads to use. and that's the default. multitasking queen fr fr. β¨--failure-mode=[any|all]β set the failure mode. there are two options:anycauses the merge command to fail if any profiles are invalid, andallcauses the merge command to fail only if all profiles are invalid. ifallis set, information from any invalid profiles is excluded from the final merged product. the default failure mode isany. β¨--prof-sym-list=<path>β specify a file which contains a list of symbols to generate profile symbol list in the profile. this option can only be used with sample-based profile in extbinary format. the entries in this file are newline-separated.--compress-all-sections=[true|false]β compress all sections when writing the profile. this option can only be used with sample-based profile in extbinary format.--use-md5=[true|false]β use MD5 to represent string in name table when writing the profile. this option can only be used with sample-based profile in extbinary format.--gen-partial-profile=[true|false]β mark the profile to be a partial profile which only provides partial profile coverage for the optimized target. this option can only be used with sample-based profile in extbinary format.--supplement-instr-with-sample=<file>β supplement an instrumentation profile with sample profile. the sample profile is the input of the flag. output will be in instrumentation format (only works with-instr). mixing and matching, we love to see it. π«Ά--zero-counter-threshold=<float>β for the function which is cold in instr profile but hot in sample profile, if the ratio of the number of zero counters divided by the total number of counters is above the threshold, the profile of the function will be regarded as being harmful for performance and will be dropped. it's giving glow-down, so we cut it. π--instr-prof-cold-threshold=<int>β user specified cold threshold for instr profile which will override the cold threshold got from profile summary.--suppl-min-size-threshold=<int>β if the size of a function is smaller than the threshold, assume it can be inlined by PGO early inliner and it will not be adjusted based on sample profile.--debug-info=<path>β specify the executable or.dSYMthat contains debug info for the raw profile. when-debug-info-correlatewas used for instrumentation, use this option to correlate the raw profile.
EXAMPLES
Basic Usage
merge three profiles:
llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata
Weighted Input
the input file foo.profdata is especially important, so multiply its counts by 10:
llvm-profdata merge --weighted-input=10,foo.profdata bar.profdata baz.profdata --output merged.profdata
exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
llvm-profdata merge --weighted-input=10,foo.profdata --weighted-input=1,bar.profdata --weighted-input=1,baz.profdata --output merged.profdata
π SHOW π
SYNOPSIS
llvm-profdata show [options] [filename]
DESCRIPTION
llvm-profdata show takes a profile data file and displays the information about the profile counters for this file and for any of the specified function(s). it's the little sister who reads everything out loud. πβ¨
if filename is omitted or is -, then llvm-profdata show reads its input from standard input. she's flexible like that. π
OPTIONS
--all-functionsβ print details for every function. all of them. no skips. π--binary-idsβ print embedded binary ids in a profile.--countsβ print the counter values for the displayed functions.--show-format=<text|json|yaml>β emit output in the selected format if supported by the provided profile type.--function=<string>β print details for a function if the function's name contains the given string.--helpβ print a summary of command line options.--output=<output>,-oβ specify the output file name. if output is-or it isn't specified, then the output is sent to standard output. π--instr(default) β specify that the input profile is an instrumentation-based profile.--textβ instruct the profile dumper to show profile counts in the text format of the instrumentation-based profile data representation. by default, the profile information is dumped in a more human readable form (also in text) with annotations.--topn=<n>β instruct the profile dumper to show the top n functions with the hottest basic blocks in the summary section. by default, the topn functions are not dumped. π--sampleβ specify that the input profile is a sample-based profile.--memop-sizesβ show the profiled sizes of the memory intrinsic calls for shown functions.--value-cutoff=<n>β show only those functions whose max count values are greater or equal to n. by default, the value-cutoff is set to0.--list-below-cutoffβ only output names of functions whose max count value are below the cutoff value.--profile-versionβ print profile version.--showcsβ only show context sensitive profile counts. the default is to filter all context sensitive profile counts.--show-prof-sym-list=[true|false]β show profile symbol list if it exists in the profile. this option is only meaningful for sample-based profile in extbinary format.--show-sec-info-only=[true|false]β show basic information about each section in the profile. this option is only meaningful for sample-based profile in extbinary format.--debug-info=<path>β specify the executable or.dSYMthat contains debug info for the raw profile. when-debug-info-correlatewas used for instrumentation, use this option to show the correlated functions from the raw profile.--coveredβ show only the functions that have been executed, i.e., functions with non-zero counts.
π OVERLAP π
β¨ SYNOPSIS β¨
llvm-profdata overlap [options] [base profile file] [test profile file]
πΈ DESCRIPTION πΈ
okay so llvm-profdata overlap is the nosy bestie of the subcommands β it takes two profile data files and spills the tea on the overlap of counter distribution, both for the whole files and for any functions you specifically point at. π
And bestie, what even is overlap here? Buckle up, because the definition is a whole math moment:
Suppose the base profile file has these counts:
{c1_1, c1_2, β¦, c1_n, c1_u_1, c2_u_2, β¦, c2_u_s}
and the test profile file has:
{c2_1, c2_2, β¦, c2_n, c2_v_1, c2_v_2, β¦, c2_v_t}
Here c{1|2}_i (i = 1 .. n) are the matched counters, while c1_u_i (i = 1 .. s) and c2_v_i (i = 1 .. v) are the unmatched counters β as in, counters that only exist in the base profile file and the test profile file respectively. π
Then, let:
sum_1 = c1_1 + c1_2 + β¦ + c1_n + c1_u_1 + c2_u_2 + β¦ + c2_u_s
sum_2 = c2_1 + c2_2 + β¦ + c2_n + c2_v_1 + c2_v_2 + β¦ + c2_v_t
and the overlap is:
overlap = min(c1_1/sum_1, c2_1/sum_2) + min(c1_2/sum_1, c2_2/sum_2) + β¦ + min(c1_n/sum_1, c2_n/sum_2)
The result overlap distribution is a percentage number, ranging from 0.0% to 100.0%, where 0.0% means there is no overlap and 100.0% means a perfect overlap. β¨
And here's the little example, bestie β if the base profile file has counts of {400, 600} and the test profile file has matched counts of {60000, 40000}, the overlap is 80%. ate. π₯
π OPTIONS π
--function=<string>β prints the details for a function if that function's name contains the given string. π--helpβ prints a summary of the command line options. standard icon behaviour. π--output=<output>,-oβ names the output file. ifoutputis-, or you just... don't specify it at all, then the output goes to standard output. π--value-cutoff=<n>β only shows the functions whose max count values are greater than or equal ton. by default, the value-cutoff is set to the max ofunsigned long long. that's the absolute ceiling, no cap fr fr. π--csβ only shows overlap for the context sensitive profile counts. the default is to show the non-context sensitive profile counts. so flip this flag if you want the cs flavour. π¦
π«Ά EXIT STATUS π«Ά
llvm-profdata returns 1 if the command is omitted or is invalid, if it can't read the input files, or if there's a mismatch between their data. basically: bad vibes = exit 1. π
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). π
β COPYRIGHT β
2003-2024, LLVM Project
and that's the whole page bestie, we did it π this one's from LLVM-PROFDATA(1), volume 15, dated 2024-04-14 β screenshot it, cite it, live laugh love it. mwah. πβ¨
π¦ where this page comes from
- ubuntu noble: llvm-16 1:16.0.6-23ubuntu4 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms