Lines Matching full:profile
1 //===- llvm-profdata.cpp - LLVM profile data tool -------------------------===//
55 "Takes a profile data file and displays the profiles. See detailed "
60 "Reads temporal profiling traces from a profile and outputs a function "
105 cl::desc("Profile kind:"), cl::sub(MergeSubcommand),
107 cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
108 clEnumVal(sample, "Sample profile")));
115 "profile from debug info (0 = no limit)"),
119 cl::desc("Path to binary from which the profile was collected."),
124 "For show, read and extract profile metadata from debug info and show "
126 "correlate the raw profile."),
131 "correlate the raw profile."),
152 cl::desc("Format of output profile"), cl::sub(MergeSubcommand),
184 cl::desc("Compress all sections when writing the profile (only "
199 cl::desc("Keep the last K frames while merging cold profile. 1 means the "
200 "context-less base profile"));
203 cl::desc("Trim cold functions until profile size is below specified "
207 "gen-partial-profile", cl::init(false), cl::Hidden,
209 cl::desc("Generate a partial profile (only meaningful for -extbinary)"));
213 cl::desc("Supplement an instr profile with sample profile, to correct "
214 "the profile unrepresentativeness issue. The sample "
215 "profile is the input of the flag. Output will be in instr "
220 cl::desc("For the function which is cold in instr profile but hot in "
221 "sample profile, if the ratio of the number of zero counters "
223 "threshold, the profile of the function will be regarded as "
230 "be adjusted based on sample profile."));
234 cl::desc("User specified cold threshold for instr profile which will "
235 "override the cold threshold got from profile summary. "));
240 "temporal-profile-trace-reservoir-size", cl::init(100),
242 cl::desc("The maximum number of stored temporal profile traces (default: "
245 "temporal-profile-max-trace-length", cl::init(10000),
247 cl::desc("The maximum length of a single temporal profile trace "
260 "Fail if any profile is invalid."),
266 cl::desc("Generate a sparse profile (only meaningful for -instr)"));
276 "used to populate profile symbol list"));
279 "convert-sample-profile-layout",
280 cl::desc("Convert the generated profile to a profile with a new layout"),
284 "Nested profile, the input should be CS flat profile"),
286 "Profile with nested inlinee flatten out")));
289 "drop-profile-symbol-list", cl::init(false), cl::Hidden,
291 cl::desc("Drop the profile symbol list when merging AutoFDO profiles "
323 cl::desc("<base profile file>"),
326 cl::desc("<test profile file>"),
346 "profile with max count value greater then the parameter value"),
364 cl::desc("Show instr profile data in text dump format"),
368 cl::desc("Show sample profile data in the JSON format "
384 cl::desc("Show detailed profile summary"),
393 cl::desc("Show profile summary of a list of hot functions"),
402 cl::desc("Profile kind supported by show:"), cl::sub(ShowSubcommand),
404 cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
405 clEnumVal(sample, "Sample profile"),
406 clEnumVal(memory, "MemProf memory access profile")));
423 cl::desc("Show profile symbol list if it exists in the profile. "),
427 cl::desc("Show the information of each section in the sample profile. "
428 "The flag is only usable when the sample profile is in "
432 cl::desc("Show binary ids in the profile. "),
435 "temporal-profile-traces",
436 cl::desc("Show temporal profile traces in the profile."),
444 cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
445 cl::desc("Show profile version. "),
452 "the profile when computing the function order and "
494 // Hint in case user missed specifying the profile type. in exitWithError()
540 Hint = "Make sure that all profile data to be merged is generated " in handleMergeWriterError()
624 /// Computer the overlap b/w profile BaseFilename and TestFileName,
670 // Check if the profile types can be merged, e.g. clang frontend profiles in loadInput()
676 "Cannot merge MemProf profile with Clang generated profile.", in loadInput()
694 // to try to add the records from this profile. in loadInput()
705 // to try to add the records from this profile. in loadInput()
749 "Merge IR generated profile with Clang generated profile.", in loadInput()
862 // Handle MD5 profile, so it is still able to match using the original name. in filterFunctions()
880 << "in the original profile are filtered.\n"; in filterFunctions()
898 exitWithError("cannot write a non-text format profile to the terminal"); in writeInstrProfile()
1000 exitWithError("no profile can be merged"); in mergeInstrProfile()
1007 /// The profile entry for a function in instrumentation profile.
1029 /// Either set all the counters in the instr profile entry \p IFE to
1030 /// -1 / -2 /in order to drop the profile or scale up the
1032 /// the ratio of zero counters in the profile of a function to
1033 /// decide the profile is helpful or harmful for performance,
1042 // profile is unaccountable and should be dropped. Reset all the in updateInstrProfileEntry()
1043 // counters to be -1 / -2 and PGO profile-use will drop the profile. in updateInstrProfileEntry()
1045 // PGO profile-use will also set the entry count metadata to be in updateInstrProfileEntry()
1048 // PGO profile-use will also set the entry count metadata to be in updateInstrProfileEntry()
1096 /// Adjust the instr profile in \p WC based on the sample profile in
1103 // Function to its entry in instr profile. in adjustInstrProfile()
1148 // If sample profile and instrumented profile do not agree on symbol in adjustInstrProfile()
1151 // If instrumented profile uses -funique-internal-linkage-symbols, in adjustInstrProfile()
1156 // If sample profile uses -funique-internal-linkage-symbols, in adjustInstrProfile()
1173 // We need to flatten the SampleFDO profile as the InstrFDO in adjustInstrProfile()
1174 // profile does not have inlined callsite profiles. in adjustInstrProfile()
1177 // Here we do a DFS traversal to get the flatten profile in adjustInstrProfile()
1275 // If a function has multiple entries in instr profile, skip it. in adjustInstrProfile()
1295 // Compute cold thresholds for instr profile and sample profile. in adjustInstrProfile()
1319 // Find hot/warm functions in sample profile which is cold in instr profile in adjustInstrProfile()
1320 // and adjust the profiles of those functions in the instr profile. in adjustInstrProfile()
1334 << " has multiple promoted names, cannot adjust profile.\n"; in adjustInstrProfile()
1348 /// The main function to supplement instr profile with sample profile.
1349 /// \Inputs contains the instr profile. \p SampleFilename specifies the
1350 /// sample profile. \p OutputFilename specifies the output profile name.
1351 /// \p OutputFormat specifies the output profile format. \p OutputSparse
1352 /// specifies whether to generate sparse profile. \p SupplMinSizeThreshold
1353 /// specifies the minimal size for the functions whose profile will be
1355 /// a function contains too many zero counters and whether its profile
1358 /// instr profile summary.
1367 exitWithError("expect one input to be an instr profile"); in supplementInstrProfile()
1369 exitWithError("expect instr profile doesn't have weight"); in supplementInstrProfile()
1373 // Read sample profile. in supplementInstrProfile()
1384 // Read instr profile. in supplementInstrProfile()
1472 warn("Profile Symbol list is not empty but the output format is not " in handleExtBinaryWriter()
1491 warn("-gen-partial-profile is ignored. Specify -extbinary to enable it"); in handleExtBinaryWriter()
1520 // merged profile map. in mergeSampleProfile()
1533 "cannot merge probe-based profile with non-probe-based profile"); in mergeSampleProfile()
1536 exitWithError("cannot merge CS profile with non-CS profile"); in mergeSampleProfile()
1564 // Use threshold calculated from profile summary unless specified. in mergeSampleProfile()
1571 // Trim and merge cold context profile using cold threshold above; in mergeSampleProfile()
1665 // If there's no comma, it's an unweighted profile. in parseInputFilenamesFile()
1718 /// Computer the overlap b/w profile BaseFilename and profile TestFilename.
1730 exitWithError(std::move(E), "error in getting profile count sums"); in overlapInstrProfile()
1732 OS << "Sum of edge counts for profile " << BaseFilename << " is 0.\n"; in overlapInstrProfile()
1736 OS << "Sum of edge counts for profile " << TestFilename << " is 0.\n"; in overlapInstrProfile()
1754 // profile
1759 // Number of units and total samples in base or test profile
1764 // Number of and total samples of units that present in at least one profile
1906 /// Detect 0-sample input profile and report to output stream. This interface
1922 /// least one profile HUnion, HO = HCommon / HUnion.
1927 /// similarity into a profile-level similarity. It also dump function-level
1932 /// weight of function A in base profile WB(A), and the weight of function
1933 /// A in test profile WT(A), compute PS(base_profile, test_profile) =
1989 /// For an offsets i, given the sample count at i in base profile BB(i),
1990 /// the sample count at i in test profile BT(i), the sum of sample counts
1991 /// in this function in base profile SB, and the sum of sample counts in
1992 /// this function in test profile ST, compute BS(i) = 1.0 - fabs(BB(i)/SB -
2015 /// Difference for unmatched callees that only present in one profile in a
2022 /// base and test profile. It also calculates a function-internal similarity
2024 /// For offsets i that have samples in at least one profile in this
2043 /// function A in base profile WB(A), and the weight of function A in test
2044 /// profile WT(A), compute FS(A) = FIS(A) * (1.0 - fabs(WB(A) - WT(A)))
2053 /// Profile-level similarity (PS) is a weighted aggregate over function-level
2065 OS << "Sum of sample counts for profile " << BaseFilename << " is 0.\n"; in detectZeroSampleProfile()
2069 OS << "Sum of sample counts for profile " << TestFilename << " is 0.\n"; in detectZeroSampleProfile()
2273 "Total samples in base profile should be greater than 0"); in weightForFuncSimilarity()
2276 "Total samples in test profile should be greater than 0"); in weightForFuncSimilarity()
2292 "Total samples in base profile should be greater than 0"); in weightByImportance()
2295 "Total samples in test profile should be greater than 0"); in weightByImportance()
2350 "TestStats should have records for all functions in test profile " in computeSampleProfileOverlap()
2375 // aggregate them into profile-level overlap. in computeSampleProfileOverlap()
2378 "BaseStats should have records for all functions in base profile " in computeSampleProfileOverlap()
2397 // in test profile. in computeSampleProfileOverlap()
2404 "TestStats should have records for all functions in test profile " in computeSampleProfileOverlap()
2412 "Total samples in base profile should be greater than 0"); in computeSampleProfileOverlap()
2416 "Total samples in test profile should be greater than 0"); in computeSampleProfileOverlap()
2423 // Traverse through functions in base profile but not in test profile. in computeSampleProfileOverlap()
2426 "BaseStats should have records for all functions in base profile " in computeSampleProfileOverlap()
2537 OS << "Profile overlap infomation for base_profile: " in dumpProgramSummary()
2542 OS << " Whole program profile similarity: " in dumpProgramSummary()
2546 "Total samples in two profile should be greater than 0"); in dumpProgramSummary()
2550 "Total samples in base profile should be greater than 0"); in dumpProgramSummary()
2554 "Total samples in test profile should be greater than 0"); in dumpProgramSummary()
2560 OS << " percentage of samples unique in base profile: " in dumpProgramSummary()
2562 OS << " percentage of samples unique in test profile: " in dumpProgramSummary()
2564 OS << " total samples in base profile: " << ProfOverlap.BaseSample << "\n" in dumpProgramSummary()
2565 << " total samples in test profile: " << ProfOverlap.TestSample << "\n"; in dumpProgramSummary()
2574 OS << " functions unique in base profile: " << ProfOverlap.BaseUniqueCount in dumpProgramSummary()
2576 OS << " functions unique in test profile: " << ProfOverlap.TestUniqueCount in dumpProgramSummary()
2589 OS << " hot functions unique in base profile: " in dumpHotFuncAndBlockOverlap()
2591 OS << " hot functions unique in test profile: " in dumpHotFuncAndBlockOverlap()
2601 OS << " hot blocks unique in base profile: " in dumpHotFuncAndBlockOverlap()
2603 OS << " hot blocks unique in test profile: " in dumpHotFuncAndBlockOverlap()
2631 "cannot compare probe-based profile with non-probe-based profile"); in loadProfiles()
2633 exitWithError("cannot compare CS profile with non-CS profile"); in loadProfiles()
2636 // profile summary. in loadProfiles()
2954 OS << "Statistics for indirect call sites profile:\n"; in showInstrProfile()
2960 OS << "Statistics for vtable profile:\n"; in showInstrProfile()
2965 OS << "Statistics for memory intrinsic calls sizes profile:\n"; in showInstrProfile()
2980 OS << "Profile version: " << Reader->getVersion() << "\n"; in showInstrProfile()
2984 OS << "Temporal Profile Traces (samples=" << Traces.size() in showInstrProfile()
2987 OS << " Temporal Profile Trace " << i << " (weight=" << Traces[i].Weight in showInstrProfile()
3001 << "sample profile in extbinary format and is " in showSectionInfo()
3040 "There should be at least one function in the profile"); in dumpHotFunctionList()
3047 << " functions with profile (" in dumpHotFunctionList()
3054 FOS << HotProfCount << " out of " << TotalProfCount << " profile counts (" in dumpHotFunctionList()
3093 // Traverse all functions in the profile and keep only hot functions. in showHotFunctionList()
3202 // Since the error can be related to the profile or the binary we do not in showMemProfProfile()
3239 // TODO: Read "Profile Data Type" from debug info to compute and show how many in showDebugInfoCorrelation()
3359 cl::ParseCommandLineOptions(argc, argv, "LLVM profile data\n"); in llvm_profdata_main()