Lines Matching +full:merge +full:- +full:base
1 //===- llvm-profdata.cpp - LLVM profile data tool -------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // llvm-profdata merges .profdata files.
11 //===----------------------------------------------------------------------===//
51 // https://llvm.org/docs/CommandGuide/llvm-profdata.html has documentations
57 "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-show");
63 "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-order");
68 "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-overlap");
70 "merge",
71 "Takes several profiles and merge them together. See detailed "
73 "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-merge");
93 cl::init("-"), cl::desc("Output file"),
100 cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
109 cl::opt<std::string> Filename(cl::Positional, cl::desc("<profdata-file>"),
113 "max-debug-info-correlation-warnings",
118 "profiled-binary", cl::init(""),
122 "debug-info", cl::init(""),
125 "the functions it found. For merge, use the provided debug info to "
129 BinaryFilename("binary-file", cl::init(""),
130 cl::desc("For merge, use the provided unstripped bianry to "
142 // factor out the common cl::sub in cl::opt constructor for subcommand-specific
145 // Options specific to merge subcommand.
148 cl::list<std::string> WeightedInputFilenames("weighted-input",
160 "GCC encoding (only meaningful for -sample)")));
162 InputFilenamesFile("input-files", cl::init(""), cl::sub(MergeSubcommand),
163 cl::desc("Path to file containing newline-separated "
165 cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"),
168 "dump-input-file-list", cl::init(false), cl::Hidden,
171 cl::opt<std::string> RemappingFile("remapping-file", cl::value_desc("file"),
174 cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"),
177 UseMD5("use-md5", cl::init(false), cl::Hidden,
179 "meaningful for -extbinary)"),
182 "compress-all-sections", cl::init(false), cl::Hidden,
185 "meaningful for -extbinary)"));
187 "sample-merge-cold-context", cl::init(false), cl::Hidden,
190 "Merge context sample profiles whose count is below cold threshold"));
192 "sample-trim-cold-context", cl::init(false), cl::Hidden,
197 "sample-frame-depth-for-cold-context", cl::init(1),
200 "context-less base profile"));
202 "output-size-limit", cl::init(0), cl::Hidden, cl::sub(MergeSubcommand),
207 "gen-partial-profile", cl::init(false), cl::Hidden,
209 cl::desc("Generate a partial profile (only meaningful for -extbinary)"));
211 "supplement-instr-with-sample", cl::init(""), cl::Hidden,
216 "format (The flag only works with -instr)"));
218 "zero-counter-threshold", cl::init(0.7), cl::Hidden,
226 "suppl-min-size-threshold", cl::init(10), cl::Hidden,
232 "instr-prof-cold-threshold", cl::init(0), cl::Hidden,
240 "temporal-profile-trace-reservoir-size", cl::init(100),
245 "temporal-profile-max-trace-length", cl::init(10000),
250 "no-function", cl::init(""),
255 FailMode("failure-mode", cl::init(failIfAnyAreInvalid),
266 cl::desc("Generate a sparse profile (only meaningful for -instr)"));
268 "num-threads", cl::init(0), cl::sub(MergeSubcommand),
269 cl::desc("Number of merge threads to use (default: autodetect)"));
270 cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
274 "prof-sym-list", cl::init(""), cl::sub(MergeSubcommand),
279 "convert-sample-profile-layout",
289 "drop-profile-symbol-list", cl::init(false), cl::Hidden,
292 "(only meaningful for -sample)"));
295 "keep-vtable-symbols", cl::init(false), cl::Hidden,
302 // deployment of newer versions of llvm-profdata.
304 "write-prev-version", cl::init(false), cl::Hidden,
309 "memprof-version", cl::Hidden, cl::sub(MergeSubcommand),
318 "memprof-full-schema", cl::Hidden, cl::sub(MergeSubcommand),
323 cl::desc("<base profile file>"),
330 "similarity-cutoff", cl::init(0),
342 "value-cutoff", cl::init(-1),
354 SFormat("show-format", cl::init(ShowFormat::Text),
361 // TODO: Consider replacing this with `--show-format=text-encoding`.
369 "(deprecated, please use --show-format=json)"),
372 "ic-targets", cl::init(false),
375 cl::opt<bool> ShowVTables("show-vtables", cl::init(false),
379 "memop-sizes", cl::init(false),
383 cl::opt<bool> ShowDetailedSummary("detailed-summary", cl::init(false),
387 cl::CommaSeparated, "detailed-summary-cutoffs",
392 ShowHotFuncList("hot-func-list", cl::init(false),
395 cl::opt<bool> ShowAllFunctions("all-functions", cl::init(false),
412 "value-cutoff", cl::init(0),
417 "list-below-cutoff", cl::init(false),
422 "show-prof-sym-list", cl::init(false),
426 "show-sec-info-only", cl::init(false),
431 cl::opt<bool> ShowBinaryIds("binary-ids", cl::init(false),
435 "temporal-profile-traces",
444 cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
450 NumTestTraces("num-test-traces", cl::init(0),
451 cl::desc("Keep aside the last <num-test-traces> traces in "
458 const std::string DuplicateNameStr = "----";
495 Hint = "Perhaps you forgot to use the --sample or --memory option?"; in exitWithError()
527 [&IPE](std::unique_ptr<InstrProfError> E) -> Error { in handleMergeWriterError()
528 IPE = E->get(); in handleMergeWriterError()
568 Remapper->File = std::move(BufOrError.get()); in create()
570 for (line_iterator LineIt(*Remapper->File, /*SkipBlanks=*/true, '#'); in create()
572 std::pair<StringRef, StringRef> Parts = LineIt->split(' '); in create()
579 Remapper->RemappingTable.insert(Parts); in create()
637 WC->Errors.emplace_back(make_error<InstrProfError>(ErrorCode, Msg), in overlapInput()
647 WC->Writer.overlapRecord(std::move(I), Overlap, FuncOverlap, FuncFilter); in overlapInput()
656 std::unique_lock<std::mutex> CtxGuard{WC->Lock}; in loadInput()
672 if (Error E = WC->Writer.mergeProfileKind(Reader->getProfileKind())) { in loadInput()
674 WC->Errors.emplace_back( in loadInput()
676 "Cannot merge MemProf profile with Clang generated profile.", in loadInput()
684 WC->Errors.emplace_back(make_error<InstrProfError>(ErrorCode, Msg), in loadInput()
689 const auto &IdToFrame = Reader->getFrameMapping(); in loadInput()
691 bool Succeeded = WC->Writer.addMemProfFrame( in loadInput()
700 const auto &CSIdToCallStacks = Reader->getCallStacks(); in loadInput()
702 bool Succeeded = WC->Writer.addMemProfCallStack( in loadInput()
710 const auto &FunctionProfileData = Reader->getProfileData(); in loadInput()
713 WC->Writer.addMemProfRecord(GUID, Record); in loadInput()
719 // TODO: This only saves the first non-fatal error from InstrProfReader, and in loadInput()
721 // we have more non-fatal errors from InstrProfReader in the future. How in loadInput()
722 // should this interact with different -failure-mode? in loadInput()
739 WC->Errors.emplace_back(make_error<InstrProfError>(ErrCode, Msg), in loadInput()
745 if (Error E = WC->Writer.mergeProfileKind(Reader->getProfileKind())) { in loadInput()
747 WC->Errors.emplace_back( in loadInput()
749 "Merge IR generated profile with Clang generated profile.", in loadInput()
760 WC->Writer.addRecord(std::move(I), Input.Weight, [&](Error E) { in loadInput()
768 std::unique_lock<std::mutex> ErrGuard{WC->ErrLock}; in loadInput()
769 bool firstTime = WC->WriterErrorCodes.insert(ErrCode).second; in loadInput()
776 const InstrProfSymtab &symtab = Reader->getSymtab(); in loadInput()
780 WC->Writer.addVTableName(kv.getKey()); in loadInput()
783 if (Reader->hasTemporalProfile()) { in loadInput()
784 auto &Traces = Reader->getTemporalProfTraces(Input.Weight); in loadInput()
786 WC->Writer.addTemporalProfileTraces( in loadInput()
787 Traces, Reader->getTemporalProfTraceStreamSize()); in loadInput()
789 if (Reader->hasError()) { in loadInput()
790 if (Error E = Reader->getError()) { in loadInput()
791 WC->Errors.emplace_back(std::move(E), Filename); in loadInput()
797 if (Error E = Reader->readBinaryIds(BinaryIds)) { in loadInput()
798 WC->Errors.emplace_back(std::move(E), Filename); in loadInput()
801 WC->Writer.addBinaryIds(BinaryIds); in loadInput()
804 WC->Errors.emplace_back(std::move(ReaderWarning->first), in loadInput()
805 ReaderWarning->second); in loadInput()
809 /// Merge the \p Src writer context into \p Dst.
811 for (auto &ErrorPair : Src->Errors) in mergeWriterContexts()
812 Dst->Errors.push_back(std::move(ErrorPair)); in mergeWriterContexts()
813 Src->Errors.clear(); in mergeWriterContexts()
815 if (Error E = Dst->Writer.mergeProfileKind(Src->Writer.getProfileKind())) in mergeWriterContexts()
818 Dst->Writer.mergeRecordsFromWriter(std::move(Src->Writer), [&](Error E) { in mergeWriterContexts()
820 std::unique_lock<std::mutex> ErrGuard{Dst->ErrLock}; in mergeWriterContexts()
821 bool firstTime = Dst->WriterErrorCodes.insert(ErrorCode).second; in mergeWriterContexts()
845 llvm::Regex ProbablyMSVCMangledName("[?@$_0-9A-Za-z]+"); in filterFunctions()
879 llvm::dbgs() << Count - ProfileMap.size() << " of " << Count << " functions " in filterFunctions()
898 exitWithError("cannot write a non-text format profile to the terminal"); in writeInstrProfile()
917 // correlation modes(w/wo debug-info/object correlation). in mergeInstrProfile()
919 exitWithError("Expected only one of -debug-info, -binary-file"); in mergeInstrProfile()
935 if (auto Err = Correlator->correlateProfileData(MaxDbgCorrelationWarnings)) in mergeInstrProfile()
942 // If NumThreads is not specified, auto-detect a good default. in mergeInstrProfile()
970 // Merge the writer contexts together (~ lg(NumThreads) serial steps). in mergeInstrProfile()
981 Contexts[End - 1].get()); in mergeInstrProfile()
990 // is equal to the number of inputs the merge failed. in mergeInstrProfile()
993 for (auto &ErrorPair : WC->Errors) { in mergeInstrProfile()
1002 filterFunctions(Contexts[0]->Writer.getProfileData()); in mergeInstrProfile()
1004 writeInstrProfile(OutputFilename, OutputFormat, Contexts[0]->Writer); in mergeInstrProfile()
1019 uint64_t CntNum = Record->Counts.size(); in InstrProfileEntry()
1022 MaxCount = std::max(MaxCount, Record->Counts[I]); in InstrProfileEntry()
1023 ZeroCntNum += !Record->Counts[I]; in InstrProfileEntry()
1030 /// -1 / -2 /in order to drop the profile or scale up the
1043 // counters to be -1 / -2 and PGO profile-use will drop the profile. in updateInstrProfileEntry()
1044 // All counters being -1 also implies that the function is hot so in updateInstrProfileEntry()
1045 // PGO profile-use will also set the entry count metadata to be in updateInstrProfileEntry()
1047 // All counters being -2 implies that the function is warm so in updateInstrProfileEntry()
1048 // PGO profile-use will also set the entry count metadata to be in updateInstrProfileEntry()
1052 ProfRecord->setPseudoCount(Kind); in updateInstrProfileEntry()
1069 ProfRecord->scale(Numerator, Denominator, [&](instrprof_error E) { in updateInstrProfileEntry()
1079 // Internal options to set FSDiscriminatorPass. Used in merge and show
1082 "fs-discriminator-pass", cl::init(PassLast), cl::Hidden,
1086 cl::values(clEnumVal(Base, "Use base discriminators only"),
1087 clEnumVal(Pass1, "Use base and pass 1 discriminators"),
1088 clEnumVal(Pass2, "Use base and pass 1-2 discriminators"),
1089 clEnumVal(Pass3, "Use base and pass 1-3 discriminators"),
1109 for (const auto &PD : Reader->getProfiles()) { in adjustInstrProfile()
1139 StringRef FName = Name.substr(0, PrefixPos - 1); in adjustInstrProfile()
1151 // If instrumented profile uses -funique-internal-linkage-symbols, in adjustInstrProfile()
1156 // If sample profile uses -funique-internal-linkage-symbols, in adjustInstrProfile()
1175 // One caveat is the pre-inlined function -- their samples in adjustInstrProfile()
1181 // name = FS->getName(); in adjustInstrProfile()
1232 auto &BuildImpl) -> void { in adjustInstrProfile()
1245 It = InstrProfileMap.find(NewName->second.str()); in adjustInstrProfile()
1246 if (NewName->second != DuplicateNameStr) { in adjustInstrProfile()
1247 NewRootName = &NewName->second; in adjustInstrProfile()
1268 for (auto &PD : WC->Writer.getProfileData()) { in adjustInstrProfile()
1280 InstrProfRecord *R = &PD.getValue().begin()->second; in adjustInstrProfile()
1286 for (auto &PD : Reader->getProfiles()) { in adjustInstrProfile()
1293 ProfileSummary SamplePS = Reader->getSummary(); in adjustInstrProfile()
1330 It = InstrProfileMap.find(NewName->second.str()); in adjustInstrProfile()
1331 if (NewName->second == DuplicateNameStr) { in adjustInstrProfile()
1339 It->second.MaxCount > ColdInstrThreshold || in adjustInstrProfile()
1340 It->second.NumEdgeCounters < SupplMinSizeThreshold) in adjustInstrProfile()
1343 updateInstrProfileEntry(It->second, SetToHot, HotInstrThreshold, in adjustInstrProfile()
1364 if (OutputFilename == "-") in supplementInstrProfile()
1381 if (std::error_code EC = Reader->read()) in supplementInstrProfile()
1390 if (WC->Errors.size() > 0) in supplementInstrProfile()
1391 exitWithError(std::move(WC->Errors[0].first), InstrFilename); in supplementInstrProfile()
1395 writeInstrProfile(OutputFilename, OutputFormat, WC->Writer); in supplementInstrProfile()
1425 Target[Remapped.getFunction()].merge(Remapped)); in remapSamples()
1457 StringRef Data = Buffer->getBuffer(); in populateProfileSymbolList()
1458 Data.split(SymbolVec, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false); in populateProfileSymbolList()
1479 warn("-compress-all-section is ignored. Specify -extbinary to enable it"); in handleExtBinaryWriter()
1485 warn("-use-md5 is ignored. Specify -extbinary to enable it"); in handleExtBinaryWriter()
1491 warn("-gen-partial-profile is ignored. Specify -extbinary to enable it"); in handleExtBinaryWriter()
1523 if (std::error_code EC = Reader->read()) { in mergeSampleProfile()
1529 SampleProfileMap &Profiles = Reader->getProfiles(); 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()
1542 Remapper ? remapSamples(I->second, *Remapper, Result) in mergeSampleProfile()
1544 FunctionSamples &Samples = Remapper ? Remapped : I->second; in mergeSampleProfile()
1547 ProfileMap[FContext].merge(Samples, Input.Weight)); in mergeSampleProfile()
1557 Reader->getProfileSymbolList(); in mergeSampleProfile()
1559 WriterList.merge(*ReaderList); in mergeSampleProfile()
1569 (Summary->getDetailedSummary())); in mergeSampleProfile()
1571 // Trim and merge cold context profile using cold threshold above; in mergeSampleProfile()
1603 Writer->writeWithSizeLimit(ProfileMap, OutputSizeLimit)) in mergeSampleProfile()
1623 if (Filename == "-") { in addWeightedInput()
1643 if (llvm::sys::fs::is_regular_file(F->path())) { in addWeightedInput()
1644 addWeightedInput(WNI, {F->path(), Weight}); in addWeightedInput()
1658 StringRef Data = Buffer->getBuffer(); in parseInputFilenamesFile()
1659 Data.split(Entries, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false); in parseInputFilenamesFile()
1686 exitWithError("no input files specified. See " + ProgName + " merge -help"); in merge_main()
1701 "-supplement-instr-with-sample can only work with -instr. "); in merge_main()
1731 if (Overlap.Base.CountSum < 1.0f) { in overlapInstrProfile()
1753 // Number of and total samples of units that only present in base or test
1759 // Number of units and total samples in base or test profile
1770 // function in base and test profiles
1857 (SecondIter == SecondEnd || FirstIter->first < SecondIter->first)) in updateOneStep()
1860 (FirstIter == FirstEnd || SecondIter->first < FirstIter->first)) in updateOneStep()
1906 /// Detect 0-sample input profile and report to output stream. This interface
1910 /// Write out function-level similarity statistics for functions specified by
1911 /// options --function, --value-cutoff, and --similarity-cutoff.
1914 /// Write out program-level similarity and overlap statistics.
1917 /// Write out hot-function and hot-block statistics for base_profile,
1925 /// This function tries matching functions in base and test profiles. For each
1926 /// pair of matched functions, it aggregates the function-level
1927 /// similarity into a profile-level similarity. It also dump function-level
1928 /// similarity information of functions specified by --function,
1929 /// --value-cutoff, and --similarity-cutoff options. The program-level
1931 /// Given function-level similarity FS(A) for all function A, the
1932 /// weight of function A in base profile WB(A), and the weight of function
1935 /// meaning no-overlap.
1938 /// Initialize ProfOverlap with the sum of samples in base and test
1941 /// use to avoid re-computations.
1973 // FuncFilter carries specifications in options --value-cutoff and
1974 // --function.
1976 // Column offsets for printing the function-level details table.
1987 /// function in base and test profiles. The line/block-similarity BS(i) is
1989 /// For an offsets i, given the sample count at i in base profile BB(i),
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 -
1993 /// BT(i)/ST), ranging in [0.0f to 1.0f] with 0.0 meaning no-overlap.
2022 /// base and test profile. It also calculates a function-internal similarity
2026 /// FIS(A) = (2.0 - sum_i(1.0 - BS(i))) / 2, ranging in [0.0f to 1.0f] with
2033 /// Function-level similarity (FS) is a weighted value over function internal
2039 /// The function-level similarity FS(A) for a function A is computed as
2041 /// Compute a function-internal similarity FIS(A) by
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
2055 /// weights in the base and test profiles for the aggregation.
2084 return 1.0 - std::fabs(BaseFrac - TestFrac); in computeBlockSimilarity()
2149 1.0 - computeBlockSimilarity(BaseSample, TestSample, FuncOverlap); in updateOverlapStatsForFunction()
2182 // We match them through sort-merge join algorithm because in computeSampleFunctionInternalOverlap()
2193 : BlockIterStep.getFirstIter()->second.getSamples(); in computeSampleFunctionInternalOverlap()
2197 : BlockIterStep.getSecondIter()->second.getSamples(); in computeSampleFunctionInternalOverlap()
2205 // them through sort-merge algorithm because in computeSampleFunctionInternalOverlap()
2223 for (const auto &F : Callsite->second) in computeSampleFunctionInternalOverlap()
2228 // matching all of them. This match is implemented through sort-merge in computeSampleFunctionInternalOverlap()
2232 CallsiteIterStep.getFirstIter()->second.cbegin(), in computeSampleFunctionInternalOverlap()
2233 CallsiteIterStep.getFirstIter()->second.cend(), in computeSampleFunctionInternalOverlap()
2234 CallsiteIterStep.getSecondIter()->second.cbegin(), in computeSampleFunctionInternalOverlap()
2235 CallsiteIterStep.getSecondIter()->second.cend()); in computeSampleFunctionInternalOverlap()
2243 updateForUnmatchedCallee(Callee->second, FuncOverlap, Difference, in computeSampleFunctionInternalOverlap()
2248 Difference += 2.0 - 2 * computeSampleFunctionInternalOverlap( in computeSampleFunctionInternalOverlap()
2249 CalleeIterStep.getFirstIter()->second, in computeSampleFunctionInternalOverlap()
2250 CalleeIterStep.getSecondIter()->second, in computeSampleFunctionInternalOverlap()
2260 // function and ranges in [0.0f to 2.0f]. Take (2.0 - Difference) / 2 to in computeSampleFunctionInternalOverlap()
2262 return (2.0 - Difference) / 2; in computeSampleFunctionInternalOverlap()
2273 "Total samples in base profile should be greater than 0"); in weightForFuncSimilarity()
2278 double WeightDistance = std::fabs(BaseFrac - TestFrac); in weightForFuncSimilarity()
2281 return FuncInternalSimilarity * (1 - WeightDistance); in weightForFuncSimilarity()
2292 "Total samples in base profile should be greater than 0"); in weightByImportance()
2324 FuncInternalSimilarity = (std::fabs(FuncInternalSimilarity - 0) < Epsilon) in computeSampleFunctionOverlap()
2339 const auto &BaseProfiles = BaseReader->getProfiles(); in computeSampleProfileOverlap()
2345 const auto &TestProfiles = TestReader->getProfiles(); in computeSampleProfileOverlap()
2374 // Two functions match with each other. Compute function-level overlap and in computeSampleProfileOverlap()
2375 // aggregate them into profile-level overlap. in computeSampleProfileOverlap()
2376 FuncOverlap.BaseName = Match->second->getContext(); in computeSampleProfileOverlap()
2378 "BaseStats should have records for all functions in base profile " in computeSampleProfileOverlap()
2383 Match->second, &TestFunc.second, &FuncOverlap, FuncOverlap.BaseSample, in computeSampleProfileOverlap()
2391 // Accumulate the percentage of base unique and test unique samples into in computeSampleProfileOverlap()
2396 // Remove matched base functions for later reporting functions not found in computeSampleProfileOverlap()
2402 // Print function-level similarity information if specified by options. in computeSampleProfileOverlap()
2412 "Total samples in base profile should be greater than 0"); in computeSampleProfileOverlap()
2423 // Traverse through functions in base profile but not in test profile. in computeSampleProfileOverlap()
2425 assert(BaseStats.count(F.second->getContext()) && in computeSampleProfileOverlap()
2426 "BaseStats should have records for all functions in base profile " in computeSampleProfileOverlap()
2428 const FuncSampleStats &FuncStats = BaseStats[F.second->getContext()]; in computeSampleProfileOverlap()
2445 ProfOverlap.Similarity = (std::fabs(ProfOverlap.Similarity - 1) < Epsilon) in computeSampleProfileOverlap()
2453 const auto &BaseProf = BaseReader->getProfiles(); in initializeSampleProfileOverlap()
2462 const auto &TestProf = TestReader->getProfiles(); in initializeSampleProfileOverlap()
2482 FOS << "Function-level details:\n"; in dumpFuncSimilarity()
2483 FOS << "Base weight"; in dumpFuncSimilarity()
2491 FOS << "Base unique"; in dumpFuncSimilarity()
2495 FOS << "Base samples"; in dumpFuncSimilarity()
2550 "Total samples in base profile should be greater than 0"); in dumpProgramSummary()
2560 OS << " percentage of samples unique in base profile: " in dumpProgramSummary()
2564 OS << " total samples in base profile: " << ProfOverlap.BaseSample << "\n" in dumpProgramSummary()
2574 OS << " functions unique in base profile: " << ProfOverlap.BaseUniqueCount in dumpProgramSummary()
2584 OS << " Hot-function overlap: " in dumpHotFuncAndBlockOverlap()
2589 OS << " hot functions unique in base profile: " in dumpHotFuncAndBlockOverlap()
2590 << HotFuncOverlap.BaseCount - HotFuncOverlap.OverlapCount << "\n"; in dumpHotFuncAndBlockOverlap()
2592 << HotFuncOverlap.TestCount - HotFuncOverlap.OverlapCount << "\n"; in dumpHotFuncAndBlockOverlap()
2596 OS << " Hot-block overlap: " in dumpHotFuncAndBlockOverlap()
2601 OS << " hot blocks unique in base profile: " in dumpHotFuncAndBlockOverlap()
2602 << HotBlockOverlap.BaseCount - HotBlockOverlap.OverlapCount << "\n"; in dumpHotFuncAndBlockOverlap()
2604 << HotBlockOverlap.TestCount - HotBlockOverlap.OverlapCount << "\n"; in dumpHotFuncAndBlockOverlap()
2625 if (std::error_code EC = BaseReader->read()) in loadProfiles()
2627 if (std::error_code EC = TestReader->read()) in loadProfiles()
2629 if (BaseReader->profileIsProbeBased() != TestReader->profileIsProbeBased()) in loadProfiles()
2631 "cannot compare probe-based profile with non-probe-based profile"); in loadProfiles()
2632 if (BaseReader->profileIsCS() != TestReader->profileIsCS()) in loadProfiles()
2633 exitWithError("cannot compare CS profile with non-CS profile"); in loadProfiles()
2635 // Load BaseHotThreshold and TestHotThreshold as 99-percentile threshold in in loadProfiles()
2637 ProfileSummary &BasePS = BaseReader->getSummary(); in loadProfiles()
2638 ProfileSummary &TestPS = TestReader->getSummary(); in loadProfiles()
2654 // report 2--3 places after decimal point in percentage numbers. in overlapSampleProfile()
2714 Stats.ValueSitesHistogram[NV - 1]++; in traverseAllValueSites()
2727 OS << Symtab->getFuncOrVarName(V.Value); in traverseAllValueSites()
2764 bool IsIRInstr = Reader->isIRLevelProfile(); in showInstrProfile()
2767 int NumVPKind = IPVK_Last - IPVK_First + 1; in showInstrProfile()
2785 // Add marker so that IR-level instrumentation round-trips properly. in showInstrProfile()
2790 if (Reader->isIRLevelProfile()) { in showInstrProfile()
2801 InstrProfSymtab &Symtab = Reader->getSymtab(); in showInstrProfile()
2901 &(Reader->getSymtab())); in showInstrProfile()
2908 &(Reader->getSymtab())); in showInstrProfile()
2918 if (Reader->hasError()) in showInstrProfile()
2919 exitWithError(Reader->getError(), Filename); in showInstrProfile()
2924 bool IsIR = Reader->isIRLevelProfile(); in showInstrProfile()
2925 OS << "Instrumentation level: " << (IsIR ? "IR" : "Front-end"); in showInstrProfile()
2927 OS << " entry_first = " << Reader->instrEntryBBEnabled(); in showInstrProfile()
2931 OS << "Total functions: " << PS->getNumFunctions() << "\n"; in showInstrProfile()
2936 << "): " << PS->getNumFunctions() - BelowCutoffFunctions << "\n"; in showInstrProfile()
2938 OS << "Maximum function count: " << PS->getMaxFunctionCount() << "\n"; in showInstrProfile()
2939 OS << "Maximum internal block count: " << PS->getMaxInternalCount() << "\n"; in showInstrProfile()
2970 OS << "Total number of blocks: " << PS->getNumCounts() << "\n"; in showInstrProfile()
2971 OS << "Total count: " << PS->getTotalCount() << "\n"; in showInstrProfile()
2972 PS->printDetailedSummary(OS); in showInstrProfile()
2976 if (Error E = Reader->printBinaryIds(OS)) in showInstrProfile()
2980 OS << "Profile version: " << Reader->getVersion() << "\n"; in showInstrProfile()
2983 auto &Traces = Reader->getTemporalProfTraces(); in showInstrProfile()
2985 << " seen=" << Reader->getTemporalProfTraceStreamSize() << "):\n"; in showInstrProfile()
2990 OS << " " << Reader->getSymtab().getFuncOrVarName(NameRef) << "\n"; in showInstrProfile()
2999 if (!Reader->dumpSectionInfo(OS)) { in showSectionInfo()
3000 WithColor::warning() << "-show-sec-info-only is only supported for " in showSectionInfo()
3158 if (std::error_code EC = Reader->read()) in showSampleProfile()
3163 Reader->dumpJson(OS); in showSampleProfile()
3165 Reader->dump(OS); in showSampleProfile()
3173 FunctionSamples *FS = Reader->getSamplesFor(StringRef(FuncNameFilter)); in showSampleProfile()
3174 Reader->dumpFunctionProfile(FS ? *FS : FunctionSamples(), OS); in showSampleProfile()
3179 Reader->getProfileSymbolList(); in showSampleProfile()
3180 ReaderList->dump(OS); in showSampleProfile()
3184 auto &PS = Reader->getSummary(); in showSampleProfile()
3190 showHotFunctionList(Reader->getProfiles(), Reader->getSummary(), in showSampleProfile()
3210 Reader->printYAML(OS); in showMemProfProfile()
3224 if (auto Err = Correlator->dumpYaml(MaxDbgCorrelationWarnings, OS)) in showDebugInfoCorrelation()
3229 if (auto Err = Correlator->correlateProfileData(MaxDbgCorrelationWarnings)) in showDebugInfoCorrelation()
3234 StringRef(Correlator->getNamesPointer(), Correlator->getNamesSize()))) in showDebugInfoCorrelation()
3243 << Twine::utohexstr(Correlator->getCountersSectionSize()) << " bytes\n"; in showDebugInfoCorrelation()
3244 OS << "Found " << Correlator->getDataSize() << " functions\n"; in showDebugInfoCorrelation()
3252 "the positional argument '<profdata-file>' is required unless '--" + in show_main()
3270 WithColor::warning() << "-function argument ignored: showing all functions\n"; in show_main()
3297 ArrayRef Traces = Reader->getTemporalProfTraces(); in order_main()
3300 "--" + NumTestTraces.ArgStr + in order_main()
3326 TouchedPages.insert(It->getSecond()); in order_main()
3333 OS << "# Warning: Mach-O may prefix symbols with \"_\" depending on the " in order_main()
3335 "post-processing may be required before passing to the linker via " in order_main()
3336 "-order_file.\n"; in order_main()
3339 getParsedIRPGOName(Reader->getSymtab().getFuncOrVarName(N.Id)); in order_main()
3355 << ": No subcommand specified! Run llvm-profata --help for usage.\n"; in llvm_profdata_main()
3374 << ": Unknown command. Run llvm-profdata --help for usage.\n"; in llvm_profdata_main()