LLVM 20.0.0git
|
#include "llvm/ProfileData/InstrProfWriter.h"
Public Types | |
using | ProfilingData = SmallDenseMap< uint64_t, InstrProfRecord > |
Public Member Functions | |
InstrProfWriter (bool Sparse=false, uint64_t TemporalProfTraceReservoirSize=0, uint64_t MaxTemporalProfTraceLength=0, bool WritePrevVersion=false, memprof::IndexedVersion MemProfVersionRequested=memprof::Version0, bool MemProfFullSchema=false) | |
~InstrProfWriter () | |
StringMap< ProfilingData > & | getProfileData () |
void | addRecord (NamedInstrProfRecord &&I, uint64_t Weight, function_ref< void(Error)> Warn) |
Add function counts for the given function. | |
void | addRecord (NamedInstrProfRecord &&I, function_ref< void(Error)> Warn) |
void | addVTableName (StringRef VTableName) |
void | addTemporalProfileTraces (SmallVectorImpl< TemporalProfTraceTy > &SrcTraces, uint64_t SrcStreamSize) |
Add SrcTraces using reservoir sampling where SrcStreamSize is the total number of temporal profiling traces the source has seen. | |
void | addMemProfRecord (const GlobalValue::GUID Id, const memprof::IndexedMemProfRecord &Record) |
Add a memprof record for a function identified by its Id . | |
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 . | |
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 | addBinaryIds (ArrayRef< llvm::object::BuildID > BIs) |
void | mergeRecordsFromWriter (InstrProfWriter &&IPW, function_ref< void(Error)> Warn) |
Merge existing function counts from the given writer. | |
Error | write (raw_fd_ostream &OS) |
Write the profile to OS . | |
Error | write (raw_string_ostream &OS) |
Write the profile to a string output stream OS . | |
Error | writeText (raw_fd_ostream &OS) |
Write the profile in text format to OS . | |
void | writeTextTemporalProfTraceData (raw_fd_ostream &OS, InstrProfSymtab &Symtab) |
Write temporal profile trace data to the header in text format to OS . | |
Error | validateRecord (const InstrProfRecord &Func) |
std::unique_ptr< MemoryBuffer > | writeBuffer () |
Write the profile, returning the raw data. For testing. | |
Error | mergeProfileKind (const InstrProfKind Other) |
Update the attributes of the current profile from the attributes specified. | |
InstrProfKind | getProfileKind () const |
bool | hasSingleByteCoverage () const |
void | setValueProfDataEndianness (llvm::endianness Endianness) |
void | setOutputSparse (bool Sparse) |
void | setMemProfVersionRequested (memprof::IndexedVersion Version) |
void | setMemProfFullSchema (bool Full) |
void | overlapRecord (NamedInstrProfRecord &&Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, const OverlapFuncFilters &FuncFilter) |
Static Public Member Functions | |
static void | writeRecordInText (StringRef Name, uint64_t Hash, const InstrProfRecord &Counters, InstrProfSymtab &Symtab, raw_fd_ostream &OS) |
Write Record in text format to OS . | |
Definition at line 37 of file InstrProfWriter.h.
Definition at line 39 of file InstrProfWriter.h.
InstrProfWriter::InstrProfWriter | ( | bool | Sparse = false , |
uint64_t | TemporalProfTraceReservoirSize = 0 , |
||
uint64_t | MaxTemporalProfTraceLength = 0 , |
||
bool | WritePrevVersion = false , |
||
memprof::IndexedVersion | MemProfVersionRequested = memprof::Version0 , |
||
bool | MemProfFullSchema = false |
||
) |
Definition at line 184 of file InstrProfWriter.cpp.
InstrProfWriter::~InstrProfWriter | ( | ) |
Definition at line 195 of file InstrProfWriter.cpp.
void InstrProfWriter::addBinaryIds | ( | ArrayRef< llvm::object::BuildID > | BIs | ) |
Definition at line 318 of file InstrProfWriter.cpp.
References llvm::append_range().
Referenced by mergeRecordsFromWriter().
bool InstrProfWriter::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
.
Definition at line 301 of file InstrProfWriter.cpp.
References llvm::memprof::IndexedMemProfData::CallStacks, and llvm::malformed.
Referenced by mergeRecordsFromWriter().
bool InstrProfWriter::addMemProfFrame | ( | const memprof::FrameId | Id, |
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
.
Definition at line 285 of file InstrProfWriter.cpp.
References llvm::memprof::IndexedMemProfData::Frames, and llvm::malformed.
Referenced by mergeRecordsFromWriter().
void InstrProfWriter::addMemProfRecord | ( | const GlobalValue::GUID | Id, |
const memprof::IndexedMemProfRecord & | Record | ||
) |
Add a memprof record for a function identified by its Id
.
Definition at line 274 of file InstrProfWriter.cpp.
References llvm::memprof::IndexedMemProfRecord::merge(), and llvm::memprof::IndexedMemProfData::Records.
Referenced by mergeRecordsFromWriter().
|
inline |
Definition at line 96 of file InstrProfWriter.h.
References addRecord(), and I.
void InstrProfWriter::addRecord | ( | NamedInstrProfRecord && | I, |
uint64_t | Weight, | ||
function_ref< void(Error)> | Warn | ||
) |
Add function counts for the given function.
If there are already counts for this function and the hash and number of counts match, each counter is summed. Optionally scale counts by Weight
.
Definition at line 206 of file InstrProfWriter.cpp.
References addRecord(), I, and Name.
Referenced by addRecord(), and mergeRecordsFromWriter().
void InstrProfWriter::addTemporalProfileTraces | ( | SmallVectorImpl< TemporalProfTraceTy > & | SrcTraces, |
uint64_t | SrcStreamSize | ||
) |
Add SrcTraces
using reservoir sampling where SrcStreamSize
is the total number of temporal profiling traces the source has seen.
Definition at line 339 of file InstrProfWriter.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::erase_if(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::shuffle(), llvm::Trace::size(), std::swap(), and llvm::zip().
Referenced by mergeRecordsFromWriter().
|
inline |
Definition at line 99 of file InstrProfWriter.h.
References llvm::StringSet< AllocatorTy >::insert().
|
inline |
Definition at line 89 of file InstrProfWriter.h.
|
inline |
Definition at line 188 of file InstrProfWriter.h.
|
inline |
Definition at line 190 of file InstrProfWriter.h.
References llvm::SingleByteCoverage.
|
inline |
Update the attributes of the current profile from the attributes specified.
An error is returned if IR and FE profiles are mixed.
Definition at line 153 of file InstrProfWriter.h.
References A, B, llvm::FrontendInstrumentation, llvm::FunctionEntryInstrumentation, llvm::FunctionEntryOnly, llvm::Other, llvm::Error::success(), llvm::Unknown, and llvm::unsupported_version.
void InstrProfWriter::mergeRecordsFromWriter | ( | InstrProfWriter && | IPW, |
function_ref< void(Error)> | Warn | ||
) |
Merge existing function counts from the given writer.
Definition at line 379 of file InstrProfWriter.cpp.
References addBinaryIds(), addMemProfCallStack(), addMemProfFrame(), addMemProfRecord(), addRecord(), addTemporalProfileTraces(), llvm::memprof::IndexedMemProfData::CallStacks, llvm::memprof::IndexedMemProfData::Frames, I, and llvm::memprof::IndexedMemProfData::Records.
void InstrProfWriter::overlapRecord | ( | NamedInstrProfRecord && | Other, |
OverlapStats & | Overlap, | ||
OverlapStats & | FuncLevelOverlap, | ||
const OverlapFuncFilters & | FuncFilter | ||
) |
Definition at line 213 of file InstrProfWriter.cpp.
References llvm::OverlapStats::addOneMismatch(), llvm::OverlapStats::addOneUnique(), llvm::CountSumOrPercent::CountSum, Name, llvm::OverlapFuncFilters::NameFilter, llvm::CountSumOrPercent::NumEntries, llvm::Other, llvm::OverlapStats::Overlap, llvm::InstrProfRecord::overlap(), llvm::OverlapStats::Test, and llvm::OverlapFuncFilters::ValueCutoff.
|
inline |
Definition at line 200 of file InstrProfWriter.h.
References llvm::Full.
|
inline |
Definition at line 197 of file InstrProfWriter.h.
References llvm::Version.
void InstrProfWriter::setOutputSparse | ( | bool | Sparse | ) |
Definition at line 202 of file InstrProfWriter.cpp.
void InstrProfWriter::setValueProfDataEndianness | ( | llvm::endianness | Endianness | ) |
Definition at line 198 of file InstrProfWriter.cpp.
References llvm::InstrProfRecordWriterTrait::ValueProfDataEndianness.
Error InstrProfWriter::validateRecord | ( | const InstrProfRecord & | Func | ) |
Definition at line 1036 of file InstrProfWriter.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::invalid_prof, and llvm::Error::success().
Referenced by writeText().
Error InstrProfWriter::write | ( | raw_fd_ostream & | OS | ) |
Write the profile to OS
.
Definition at line 1010 of file InstrProfWriter.cpp.
References OS.
Referenced by writeBuffer().
Error InstrProfWriter::write | ( | raw_string_ostream & | OS | ) |
Write the profile to a string output stream OS
.
Definition at line 1016 of file InstrProfWriter.cpp.
References OS.
std::unique_ptr< MemoryBuffer > InstrProfWriter::writeBuffer | ( | ) |
Write the profile, returning the raw data. For testing.
Definition at line 1021 of file InstrProfWriter.cpp.
References llvm::Data, llvm::MemoryBuffer::getMemBufferCopy(), OS, and write().
|
static |
Write Record
in text format to OS
.
Definition at line 1052 of file InstrProfWriter.cpp.
References llvm::InstrProfSymtab::getFuncOrVarNameIfDefined(), Name, OS, ValueProfKindStr, and llvm::raw_ostream::write_hex().
Referenced by writeText().
Error InstrProfWriter::writeText | ( | raw_fd_ostream & | OS | ) |
Write the profile in text format to OS
.
Definition at line 1103 of file InstrProfWriter.cpp.
References A, llvm::InstrProfSymtab::addFuncName(), llvm::InstrProfSymtab::addVTableName(), B, llvm::ContextSensitive, llvm::FunctionEntryInstrumentation, I, llvm::IRInstrumentation, Name, OS, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SingleByteCoverage, llvm::sort(), llvm::Error::success(), llvm::TemporalProfile, validateRecord(), writeRecordInText(), and writeTextTemporalProfTraceData().
void InstrProfWriter::writeTextTemporalProfTraceData | ( | raw_fd_ostream & | OS, |
InstrProfSymtab & | Symtab | ||
) |
Write temporal profile trace data to the header in text format to OS
.
Definition at line 1157 of file InstrProfWriter.cpp.
References llvm::InstrProfSymtab::getFuncOrVarName(), OS, and llvm::Trace::size().
Referenced by writeText().