14#ifndef LLVM_PROFILEDATA_INSTRPROFWRITER_H
15#define LLVM_PROFILEDATA_INSTRPROFWRITER_H
32class InstrProfRecordWriterTrait;
47 uint64_t TemporalProfTraceReservoirSize;
49 uint64_t TemporalProfTraceStreamSize = 0;
58 std::vector<llvm::object::BuildID> BinaryIds;
73 bool WritePrevVersion =
false;
79 bool MemProfFullSchema;
83 bool Sparse =
false,
uint64_t TemporalProfTraceReservoirSize = 0,
84 uint64_t MaxTemporalProfTraceLength = 0,
bool WritePrevVersion =
false,
86 bool MemProfFullSchema =
false);
163 return (
static_cast<bool>(ProfileKind &
A) &&
164 static_cast<bool>(
Other &
B)) ||
165 (
static_cast<bool>(ProfileKind &
B) &&
166 static_cast<bool>(
Other &
A));
171 if (
static_cast<bool>(
178 return make_error<InstrProfError>(
180 "cannot merge FunctionEntryOnly profiles and BB profiles together");
184 ProfileKind |=
Other;
198 MemProfVersionRequested =
Version;
This file defines the StringMap class.
This file declares a library for handling Build IDs and using them to find debug info.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the DenseMap class.
This file implements a map that provides insertion order iteration.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
A symbol table used for function [IR]PGO name look-up with keys (such as pointers,...
bool hasSingleByteCoverage() const
void addVTableName(StringRef VTableName)
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.
InstrProfKind getProfileKind() const
void addRecord(NamedInstrProfRecord &&I, function_ref< void(Error)> Warn)
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.
void setMemProfVersionRequested(memprof::IndexedVersion Version)
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.
void mergeRecordsFromWriter(InstrProfWriter &&IPW, function_ref< void(Error)> Warn)
Merge existing function counts from the given writer.
Error mergeProfileKind(const InstrProfKind Other)
Update the attributes of the current profile from the attributes specified.
void writeTextTemporalProfTraceData(raw_fd_ostream &OS, InstrProfSymtab &Symtab)
Write temporal profile trace data to the header in text format to OS.
SmallDenseMap< uint64_t, InstrProfRecord > ProfilingData
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)
StringMap< ProfilingData > & getProfileData()
void setMemProfFullSchema(bool Full)
Error validateRecord(const InstrProfRecord &Func)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
StringSet - A wrapper for StringMap that provides set-like functionality.
std::pair< typename Base::iterator, bool > insert(StringRef key)
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to a file descriptor.
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
InstrProfKind
An enum describing the attributes of an instrumented profile.
@ FunctionEntryInstrumentation
@ FrontendInstrumentation
Profiling information for a single function.
An ordered list of functions identified by their NameRef found in INSTR_PROF_DATA.