66 using namespace support;
71 for (
const auto &K :
P) {
72 FDOStream.
seek(K.Pos);
73 for (
int I = 0;
I < K.N;
I++)
79 FDOStream.
seek(LastPos);
82 std::string &
Data = SOStream.
str();
83 for (
const auto &K :
P) {
84 for (
int I = 0;
I < K.N;
I++) {
86 endian::byte_swap<uint64_t, llvm::endianness::little>(K.D[
I]);
88 (
const char *)&Bytes,
sizeof(
uint64_t));
122 static std::pair<offset_type, offset_type>
124 using namespace support;
132 for (
const auto &ProfileData : *V) {
141 M += ValueProfData::getSize(ProfileData.second);
145 return std::make_pair(
N, M);
153 using namespace support;
156 for (
const auto &ProfileData : *V) {
163 LE.write<
uint64_t>(ProfileData.first);
173 std::unique_ptr<ValueProfData> VDataPtr =
174 ValueProfData::serializeFrom(ProfileData.second);
177 Out.
write((
const char *)VDataPtr.get(), S);
185 bool Sparse,
uint64_t TemporalProfTraceReservoirSize,
186 uint64_t MaxTemporalProfTraceLength,
bool WritePrevVersion,
188 : Sparse(Sparse), MaxTemporalProfTraceLength(MaxTemporalProfTraceLength),
189 TemporalProfTraceReservoirSize(TemporalProfTraceReservoirSize),
191 WritePrevVersion(WritePrevVersion),
192 MemProfVersionRequested(MemProfVersionRequested),
193 MemProfFullSchema(MemProfFullSchema) {}
203 this->Sparse = Sparse;
218 auto Hash =
Other.Hash;
219 Other.accumulateCounts(FuncLevelOverlap.
Test);
220 if (!FunctionData.contains(
Name)) {
228 auto &ProfileDataMap = FunctionData[
Name];
231 std::tie(Where, NewFunc) =
243 Dest.
overlap(
Other, Overlap, FuncLevelOverlap, ValueCutoff);
249 auto &ProfileDataMap = FunctionData[
Name];
253 std::tie(Where, NewFunc) =
258 Warn(make_error<InstrProfError>(E));
265 Dest.
scale(Weight, 1, MapWarn);
268 Dest.
merge(
I, Weight, MapWarn);
276 auto [Iter, Inserted] = MemProfRecordData.insert({Id,
Record});
288 auto [Iter, Inserted] = MemProfFrameData.insert({Id, Frame});
293 if (!Inserted && Iter->second != Frame) {
295 "frame to id mapping mismatch"));
305 auto [Iter, Inserted] = MemProfCallStackData.insert({CSId, CallStack});
310 if (!Inserted && Iter->second != CallStack) {
312 "call stack to id mapping mismatch"));
323 if (
Trace.FunctionNameRefs.
size() > MaxTemporalProfTraceLength)
324 Trace.FunctionNameRefs.resize(MaxTemporalProfTraceLength);
328 if (TemporalProfTraceStreamSize < TemporalProfTraceReservoirSize) {
330 TemporalProfTraces.push_back(std::move(
Trace));
333 std::uniform_int_distribution<uint64_t> Distribution(
334 0, TemporalProfTraceStreamSize);
335 uint64_t RandomIndex = Distribution(RNG);
336 if (RandomIndex < TemporalProfTraces.size())
337 TemporalProfTraces[RandomIndex] = std::move(
Trace);
339 ++TemporalProfTraceStreamSize;
347 (TemporalProfTraceStreamSize > TemporalProfTraceReservoirSize);
348 bool IsSrcSampled = (SrcStreamSize > TemporalProfTraceReservoirSize);
349 if (!IsDestSampled && IsSrcSampled) {
351 std::swap(TemporalProfTraces, SrcTraces);
352 std::swap(TemporalProfTraceStreamSize, SrcStreamSize);
357 for (
auto &
Trace : SrcTraces)
358 addTemporalProfileTrace(std::move(
Trace));
365 std::uniform_int_distribution<uint64_t> Distribution(
366 0, TemporalProfTraceStreamSize);
367 uint64_t RandomIndex = Distribution(RNG);
368 if (RandomIndex < TemporalProfTraces.size())
369 IndicesToReplace.
insert(RandomIndex);
370 ++TemporalProfTraceStreamSize;
380 for (
auto &
I : IPW.FunctionData)
381 for (
auto &Func :
I.getValue())
382 addRecord(
I.getKey(), Func.first, std::move(Func.second), 1, Warn);
384 BinaryIds.reserve(BinaryIds.size() + IPW.BinaryIds.size());
385 for (
auto &
I : IPW.BinaryIds)
389 IPW.TemporalProfTraceStreamSize);
391 MemProfFrameData.reserve(IPW.MemProfFrameData.size());
392 for (
auto &[FrameId, Frame] : IPW.MemProfFrameData) {
399 MemProfCallStackData.reserve(IPW.MemProfCallStackData.size());
400 for (
auto &[CSId, CallStack] : IPW.MemProfCallStackData) {
405 MemProfRecordData.reserve(IPW.MemProfRecordData.size());
406 for (
auto &[GUID,
Record] : IPW.MemProfRecordData) {
411bool InstrProfWriter::shouldEncodeData(
const ProfilingData &PD) {
414 for (
const auto &Func : PD) {
426 using namespace IndexedInstrProf;
437 for (
unsigned I = 0;
I < Res.size();
I++)
445 for (
const auto Id : Schema)
457 RecordTableGenerator;
458 for (
auto &[GUID,
Record] : MemProfRecordData) {
460 RecordTableGenerator.insert(GUID,
Record, RecordWriter);
463 MemProfRecordData.
clear();
468 return RecordTableGenerator.
Emit(
OS.OS, RecordWriter);
477 for (
auto &[FrameId, Frame] : MemProfFrameData) {
479 FrameTableGenerator.insert(FrameId, Frame);
482 MemProfFrameData.
clear();
484 return FrameTableGenerator.
Emit(
OS.OS);
490 &MemProfCallStackData) {
492 CallStackTableGenerator;
493 for (
auto &[CSId, CallStack] : MemProfCallStackData)
494 CallStackTableGenerator.insert(CSId, CallStack);
496 MemProfCallStackData.clear();
498 return CallStackTableGenerator.
Emit(
OS.OS);
520 uint64_t Header[] = {RecordTableOffset, FramePayloadOffset, FrameTableOffset};
521 OS.patch({{HeaderUpdatePos, Header, std::size(Header)}});
546 uint64_t Header[] = {RecordTableOffset, FramePayloadOffset, FrameTableOffset};
547 OS.patch({{HeaderUpdatePos, Header, std::size(Header)}});
558 &MemProfCallStackData,
559 bool MemProfFullSchema) {
569 if (MemProfFullSchema)
584 RecordTableOffset, FramePayloadOffset, FrameTableOffset,
585 CallStackPayloadOffset, CallStackTableOffset,
587 OS.patch({{HeaderUpdatePos, Header, std::size(Header)}});
611 &MemProfCallStackData,
614 switch (MemProfVersionRequested) {
621 MemProfCallStackData, MemProfFullSchema);
624 return make_error<InstrProfError>(
626 formatv(
"MemProf version {} not supported; "
627 "requires version between {} and {}, inclusive",
633 using namespace IndexedInstrProf;
634 using namespace support;
645 for (
const auto &
I : FunctionData)
646 if (shouldEncodeData(
I.getValue()))
649 for (
const auto &
I : OrderedData)
650 Generator.insert(
I.first,
I.second);
655 Header.Version = WritePrevVersion
663 Header.Version |= VARIANT_MASK_IR_PROF;
665 Header.Version |= VARIANT_MASK_CSIR_PROF;
666 if (
static_cast<bool>(ProfileKind &
668 Header.Version |= VARIANT_MASK_INSTR_ENTRY;
670 Header.Version |= VARIANT_MASK_BYTE_COVERAGE;
672 Header.Version |= VARIANT_MASK_FUNCTION_ENTRY_ONLY;
674 Header.Version |= VARIANT_MASK_MEMPROF;
676 Header.Version |= VARIANT_MASK_TEMPORAL_PROF;
680 Header.HashOffset = 0;
681 Header.MemProfOffset = 0;
682 Header.BinaryIdOffset = 0;
683 Header.TemporalProfTracesOffset = 0;
684 Header.VTableNamesOffset = 0;
688 for (
int I = 0;
I < 4;
I++)
713 if (!WritePrevVersion)
718 uint32_t SummarySize = Summary::getSize(Summary::NumKinds, NumEntries);
721 for (
unsigned I = 0;
I < SummarySize /
sizeof(
uint64_t);
I++)
726 CSSummaryOffset =
OS.
tell();
727 CSSummarySize = SummarySize /
sizeof(
uint64_t);
728 for (
unsigned I = 0;
I < CSSummarySize;
I++)
738 MemProfSectionStart =
OS.
tell();
739 if (
auto E =
writeMemProf(
OS, MemProfRecordData, MemProfFrameData,
740 MemProfCallStackData, MemProfVersionRequested,
757 BinaryIds.erase(std::unique(BinaryIds.begin(), BinaryIds.end()),
760 for (
auto BI : BinaryIds) {
762 BinaryIdsSectionSize +=
sizeof(
uint64_t);
767 OS.
write(BinaryIdsSectionSize);
769 for (
auto BI : BinaryIds) {
774 for (
unsigned K = 0;
K < BILen;
K++)
778 for (
unsigned K = 0;
K < PaddingSize;
K++)
784 if (!WritePrevVersion) {
785 std::vector<std::string> VTableNameStrs;
787 VTableNameStrs.push_back(VTableName.str());
789 std::string CompressedVTableNames;
790 if (!VTableNameStrs.empty())
793 CompressedVTableNames))
796 const uint64_t CompressedStringLen = CompressedVTableNames.length();
802 for (
auto &c : CompressedVTableNames)
803 OS.writeByte(
static_cast<uint8_t
>(c));
809 for (
uint64_t K = CompressedStringLen;
K < PaddedLength;
K++)
813 uint64_t TemporalProfTracesSectionStart = 0;
815 TemporalProfTracesSectionStart =
OS.
tell();
816 OS.
write(TemporalProfTraces.size());
817 OS.
write(TemporalProfTraceStreamSize);
818 for (
auto &
Trace : TemporalProfTraces) {
821 for (
auto &NameRef :
Trace.FunctionNameRefs)
827 std::unique_ptr<IndexedInstrProf::Summary> TheSummary =
831 std::unique_ptr<ProfileSummary> PS = ISB.getSummary();
836 std::unique_ptr<IndexedInstrProf::Summary> TheCSSummary =
nullptr;
839 std::unique_ptr<ProfileSummary> CSPS = CSISB.getSummary();
844 if (!WritePrevVersion) {
848 {HashTableStartFieldOffset, &HashTableStart, 1},
851 {MemProfSectionOffset, &MemProfSectionStart, 1},
853 {BinaryIdSectionOffset, &BinaryIdSectionStart, 1},
856 {TemporalProfTracesOffset, &TemporalProfTracesSectionStart, 1},
857 {VTableNamesOffset, &VTableNamesSectionStart, 1},
859 {SummaryOffset,
reinterpret_cast<uint64_t *
>(TheSummary.get()),
860 (
int)(SummarySize /
sizeof(
uint64_t))},
861 {CSSummaryOffset,
reinterpret_cast<uint64_t *
>(TheCSSummary.get()),
862 (
int)CSSummarySize}};
864 OS.patch(PatchItems);
869 {HashTableStartFieldOffset, &HashTableStart, 1},
872 {MemProfSectionOffset, &MemProfSectionStart, 1},
874 {BinaryIdSectionOffset, &BinaryIdSectionStart, 1},
877 {TemporalProfTracesOffset, &TemporalProfTracesSectionStart, 1},
879 {SummaryOffset,
reinterpret_cast<uint64_t *
>(TheSummary.get()),
880 (
int)(SummarySize /
sizeof(
uint64_t))},
881 {CSSummaryOffset,
reinterpret_cast<uint64_t *
>(TheCSSummary.get()),
882 (
int)CSSummarySize}};
884 OS.patch(PatchItems);
887 for (
const auto &
I : FunctionData)
888 for (
const auto &
F :
I.getValue())
898 return writeImpl(POS);
903 return writeImpl(POS);
917#define VALUE_PROF_KIND(Enumerator, Value, Descr) #Enumerator,
922 for (
uint32_t VK = 0; VK <= IPVK_Last; VK++) {
923 uint32_t NS = Func.getNumValueSites(VK);
927 uint32_t ND = Func.getNumValueDataForSite(VK, S);
928 std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(VK, S);
931 if ((VK != IPVK_IndirectCallTarget && VK != IPVK_VTableTarget) &&
932 !SeenValues.
insert(VD[
I].Value).second)
945 OS <<
"# Func Hash:\n" << Hash <<
"\n";
946 OS <<
"# Num Counters:\n" << Func.Counts.size() <<
"\n";
947 OS <<
"# Counter Values:\n";
951 if (Func.BitmapBytes.size() > 0) {
952 OS <<
"# Num Bitmap Bytes:\n$" << Func.BitmapBytes.size() <<
"\n";
953 OS <<
"# Bitmap Byte Values:\n";
954 for (uint8_t Byte : Func.BitmapBytes) {
962 uint32_t NumValueKinds = Func.getNumValueKinds();
963 if (!NumValueKinds) {
968 OS <<
"# Num Value Kinds:\n" << Func.getNumValueKinds() <<
"\n";
969 for (
uint32_t VK = 0; VK < IPVK_Last + 1; VK++) {
970 uint32_t NS = Func.getNumValueSites(VK);
974 OS <<
"# NumValueSites:\n" << NS <<
"\n";
976 uint32_t ND = Func.getNumValueDataForSite(VK, S);
978 std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(VK, S);
980 if (VK == IPVK_IndirectCallTarget || VK == IPVK_VTableTarget)
982 << VD[
I].Count <<
"\n";
984 OS << VD[
I].Value <<
":" << VD[
I].Count <<
"\n";
995 OS <<
"# CSIR level Instrumentation Flag\n:csir\n";
997 OS <<
"# IR level Instrumentation Flag\n:ir\n";
999 if (
static_cast<bool>(ProfileKind &
1001 OS <<
"# Always instrument the function entry block\n:entry_first\n";
1003 OS <<
"# Instrument block coverage\n:single_byte_coverage\n";
1007 using RecordType = std::pair<StringRef, FuncPair>;
1010 for (
const auto &
I : FunctionData) {
1011 if (shouldEncodeData(
I.getValue())) {
1014 for (
const auto &Func :
I.getValue())
1015 OrderedFuncData.
push_back(std::make_pair(
I.getKey(), Func));
1019 for (
const auto &VTableName : VTableNames)
1027 return std::tie(
A.first,
A.second.first) <
1028 std::tie(
B.first,
B.second.first);
1031 for (
const auto &record : OrderedFuncData) {
1033 const FuncPair &Func = record.second;
1037 for (
const auto &record : OrderedFuncData) {
1038 const FuncPair &Func = record.second;
1048 OS <<
":temporal_prof_traces\n";
1049 OS <<
"# Num Temporal Profile Traces:\n" << TemporalProfTraces.
size() <<
"\n";
1050 OS <<
"# Temporal Profile Trace Stream Size:\n"
1051 << TemporalProfTraceStreamSize <<
"\n";
1052 for (
auto &
Trace : TemporalProfTraces) {
1053 OS <<
"# Weight:\n" <<
Trace.Weight <<
"\n";
1054 for (
auto &NameRef :
Trace.FunctionNameRefs)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static uint64_t writeMemProfRecords(ProfOStream &OS, llvm::MapVector< GlobalValue::GUID, memprof::IndexedMemProfRecord > &MemProfRecordData, memprof::MemProfSchema *Schema, memprof::IndexedVersion Version)
static Error writeMemProfV1(ProfOStream &OS, llvm::MapVector< GlobalValue::GUID, memprof::IndexedMemProfRecord > &MemProfRecordData, llvm::MapVector< memprof::FrameId, memprof::Frame > &MemProfFrameData)
static uint64_t writeMemProfCallStacks(ProfOStream &OS, llvm::MapVector< memprof::CallStackId, llvm::SmallVector< memprof::FrameId > > &MemProfCallStackData)
static Error writeMemProfV0(ProfOStream &OS, llvm::MapVector< GlobalValue::GUID, memprof::IndexedMemProfRecord > &MemProfRecordData, llvm::MapVector< memprof::FrameId, memprof::Frame > &MemProfFrameData)
static uint64_t writeMemProfFrames(ProfOStream &OS, llvm::MapVector< memprof::FrameId, memprof::Frame > &MemProfFrameData)
static Error writeMemProf(ProfOStream &OS, llvm::MapVector< GlobalValue::GUID, memprof::IndexedMemProfRecord > &MemProfRecordData, llvm::MapVector< memprof::FrameId, memprof::Frame > &MemProfFrameData, llvm::MapVector< memprof::CallStackId, llvm::SmallVector< memprof::FrameId > > &MemProfCallStackData, memprof::IndexedVersion MemProfVersionRequested, bool MemProfFullSchema)
static void setSummary(IndexedInstrProf::Summary *TheSummary, ProfileSummary &PS)
static const char * ValueProfKindStr[]
static Error writeMemProfV2(ProfOStream &OS, llvm::MapVector< GlobalValue::GUID, memprof::IndexedMemProfRecord > &MemProfRecordData, llvm::MapVector< memprof::FrameId, memprof::Frame > &MemProfFrameData, llvm::MapVector< memprof::CallStackId, llvm::SmallVector< memprof::FrameId > > &MemProfCallStackData, bool MemProfFullSchema)
static void writeMemProfSchema(ProfOStream &OS, const memprof::MemProfSchema &Schema)
Defines facilities for reading and writing on-disk hash tables.
This file implements a set that has insertion order iteration characteristics.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Implements a dense probed hash-table based set.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
static std::pair< offset_type, offset_type > EmitKeyDataLength(raw_ostream &Out, key_type_ref K, data_type_ref V)
const InstrProfWriter::ProfilingData *const data_type_ref
InstrProfSummaryBuilder * SummaryBuilder
llvm::endianness ValueProfDataEndianness
static hash_value_type ComputeHash(key_type_ref K)
InstrProfSummaryBuilder * CSSummaryBuilder
InstrProfRecordWriterTrait()=default
void EmitKey(raw_ostream &Out, key_type_ref K, offset_type N)
void EmitData(raw_ostream &Out, key_type_ref, data_type_ref V, offset_type)
const InstrProfWriter::ProfilingData *const data_type
void addRecord(const InstrProfRecord &)
A symbol table used for function [IR]PGO name look-up with keys (such as pointers,...
StringRef getFuncOrVarName(uint64_t ValMD5Hash)
Return name of functions or global variables from the name's md5 hash value.
Error addVTableName(StringRef VTableName)
Adds VTableName as a known symbol, and inserts it to a map that tracks all vtable names.
Error addFuncName(StringRef FuncName)
The method name is kept since there are many callers.
StringRef getFuncOrVarNameIfDefined(uint64_t ValMD5Hash)
Just like getFuncOrVarName, except that it will return literal string 'External Symbol' if the functi...
Error write(raw_fd_ostream &OS)
Write the profile to OS.
void addTemporalProfileTraces(SmallVectorImpl< TemporalProfTraceTy > &SrcTraces, uint64_t SrcStreamSize)
Add SrcTraces using reservoir sampling where SrcStreamSize is the total number of temporal profiling ...
void overlapRecord(NamedInstrProfRecord &&Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, const OverlapFuncFilters &FuncFilter)
Error writeText(raw_fd_ostream &OS)
Write the profile in text format to OS.
void addBinaryIds(ArrayRef< llvm::object::BuildID > BIs)
void addMemProfRecord(const GlobalValue::GUID Id, const memprof::IndexedMemProfRecord &Record)
Add a memprof record for a function identified by its Id.
static void writeRecordInText(StringRef Name, uint64_t Hash, const InstrProfRecord &Counters, InstrProfSymtab &Symtab, raw_fd_ostream &OS)
Write Record in text format to OS.
void setValueProfDataEndianness(llvm::endianness Endianness)
bool addMemProfCallStack(const memprof::CallStackId CSId, const llvm::SmallVector< memprof::FrameId > &CallStack, function_ref< void(Error)> Warn)
Add a call stack identified by the hash of the contents of the call stack in CallStack.
void addRecord(NamedInstrProfRecord &&I, uint64_t Weight, function_ref< void(Error)> Warn)
Add function counts for the given function.
InstrProfWriter(bool Sparse=false, uint64_t TemporalProfTraceReservoirSize=0, uint64_t MaxTemporalProfTraceLength=0, bool WritePrevVersion=false, memprof::IndexedVersion MemProfVersionRequested=memprof::Version0, bool MemProfFullSchema=false)
void mergeRecordsFromWriter(InstrProfWriter &&IPW, function_ref< void(Error)> Warn)
Merge existing function counts from the given writer.
void writeTextTemporalProfTraceData(raw_fd_ostream &OS, InstrProfSymtab &Symtab)
Write temporal profile trace data to the header in text format to OS.
std::unique_ptr< MemoryBuffer > writeBuffer()
Write the profile, returning the raw data. For testing.
bool addMemProfFrame(const memprof::FrameId, const memprof::Frame &F, function_ref< void(Error)> Warn)
Add a memprof frame identified by the hash of the contents of the frame in FrameId.
void setOutputSparse(bool Sparse)
Error validateRecord(const InstrProfRecord &Func)
This class implements a map that also provides access to all stored values in a deterministic order.
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
Generates an on disk hash table.
offset_type Emit(raw_ostream &Out)
Emit the table to Out, which must not be at offset 0.
void writeByte(uint8_t V)
void patch(ArrayRef< PatchItem > P)
ProfOStream(raw_string_ostream &STR)
support::endian::Writer LE
ProfOStream(raw_fd_ostream &FD)
static const ArrayRef< uint32_t > DefaultCutoffs
A vector of useful cutoff values for detailed summary.
uint64_t getTotalCount() const
uint64_t getMaxCount() const
const SummaryEntryVector & getDetailedSummary()
uint32_t getNumCounts() const
uint64_t getMaxInternalCount() const
uint64_t getMaxFunctionCount() const
uint32_t getNumFunctions() const
bool insert(const value_type &X)
Insert a new element into the SetVector.
A SetVector that performs no allocations if smaller than a certain size.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
iterator_range< StringMapKeyIterator< ValueTy > > keys() const
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
std::pair< iterator, bool > insert(const ValueT &V)
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to a file descriptor.
uint64_t seek(uint64_t off)
Flushes the stream and repositions the underlying file descriptor position to the offset specified fr...
This class implements an extremely fast bulk output stream that can only output to a stream.
uint64_t tell() const
tell - Return the current offset with the file.
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
raw_ostream & write(unsigned char C)
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
std::unique_ptr< Summary > allocSummary(uint32_t TotalSize)
uint64_t ComputeHash(StringRef K)
constexpr uint64_t MaximumSupportedVersion
MemProfSchema getHotColdSchema()
constexpr uint64_t MinimumSupportedVersion
MemProfSchema getFullSchema()
This is an optimization pass for GlobalISel generic memory operations.
detail::zippy< detail::zip_shortest, T, U, Args... > zip(T &&t, U &&u, Args &&...args)
zip iterator for two or more iteratable types.
uint64_t alignToPowerOf2(uint64_t Value, uint64_t Align)
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
void shuffle(Iterator first, Iterator last, RNG &&g)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
void sort(IteratorTy Start, IteratorTy End)
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Error collectGlobalObjectNameStrings(ArrayRef< std::string > NameStrs, bool doCompression, std::string &Result)
Given a vector of strings (names of global objects like functions or, virtual tables) NameStrs,...
@ FunctionEntryInstrumentation
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...
void set(SummaryFieldKind K, uint64_t V)
void setEntry(uint32_t I, const ProfileSummaryEntry &E)
uint64_t NumSummaryFields
uint64_t NumCutoffEntries
Profiling information for a single function.
std::vector< uint64_t > Counts
void merge(InstrProfRecord &Other, uint64_t Weight, function_ref< void(instrprof_error)> Warn)
Merge the counts in Other into this one.
void overlap(InstrProfRecord &Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, uint64_t ValueCutoff)
Compute the overlap b/w this IntrprofRecord and Other.
void sortValueData()
Sort value profile data (per site) by count.
std::vector< uint8_t > BitmapBytes
void scale(uint64_t N, uint64_t D, function_ref< void(instrprof_error)> Warn)
Scale up profile counts (including value profile data) by a factor of (N / D).
static bool hasCSFlagInHash(uint64_t FuncHash)
const std::string NameFilter
void addOneMismatch(const CountSumOrPercent &MismatchFunc)
CountSumOrPercent Overlap
void addOneUnique(const CountSumOrPercent &UniqueFunc)
An ordered list of functions identified by their NameRef found in INSTR_PROF_DATA.
Function object to check whether the first component of a container supported by std::get (like std::...
void merge(const IndexedMemProfRecord &Other)
Adapter to write values to a stream in a particular byte order.
void write(ArrayRef< value_type > Val)