|
LLVM 24.0.0git
|
#include "llvm/ProfileData/InstrProfWriter.h"
Public Types | |
| using | ProfilingData = SmallDenseMap<uint64_t, InstrProfRecord> |
Public Member Functions | |
| LLVM_ABI | InstrProfWriter (bool Sparse=false, uint64_t TemporalProfTraceReservoirSize=0, uint64_t MaxTemporalProfTraceLength=0, bool WritePrevVersion=false, memprof::IndexedVersion MemProfVersionRequested=static_cast< memprof::IndexedVersion >(memprof::MinimumSupportedVersion), bool MemProfFullSchema=false, bool MemprofGenerateRandomHotness=false, unsigned RandomSeed=0) |
| LLVM_ABI | ~InstrProfWriter () |
| StringMap< ProfilingData > & | getProfileData () |
| LLVM_ABI 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) |
| LLVM_ABI 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. | |
| LLVM_ABI bool | addMemProfData (memprof::IndexedMemProfData Incoming, function_ref< void(Error)> Warn) |
Add the entire MemProfData Incoming to the writer context. | |
| LLVM_ABI void | addBinaryIds (ArrayRef< llvm::object::BuildID > BIs) |
| LLVM_ABI void | addDataAccessProfData (std::unique_ptr< memprof::DataAccessProfData > DataAccessProfile) |
| LLVM_ABI void | mergeRecordsFromWriter (InstrProfWriter &&IPW, function_ref< void(Error)> Warn) |
| Merge existing function counts from the given writer. | |
| LLVM_ABI Error | write (raw_fd_ostream &OS) |
Write the profile to OS. | |
| LLVM_ABI Error | write (raw_string_ostream &OS) |
Write the profile to a string output stream OS. | |
| LLVM_ABI Error | writeText (raw_fd_ostream &OS) |
Write the profile in text format to OS. | |
| LLVM_ABI void | writeTextTemporalProfTraceData (raw_fd_ostream &OS, InstrProfSymtab &Symtab) |
Write temporal profile trace data to the header in text format to OS. | |
| LLVM_ABI Error | validateRecord (const InstrProfRecord &Func) |
| LLVM_ABI 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 |
| LLVM_ABI void | setValueProfDataEndianness (llvm::endianness Endianness) |
| LLVM_ABI void | setOutputSparse (bool Sparse) |
| void | setMemProfVersionRequested (memprof::IndexedVersion Version) |
| void | setMemProfFullSchema (bool Full) |
| LLVM_ABI void | overlapRecord (NamedInstrProfRecord &&Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, const OverlapFuncFilters &FuncFilter) |
Static Public Member Functions | |
| static LLVM_ABI 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 40 of file InstrProfWriter.h.
Definition at line 42 of file InstrProfWriter.h.
| InstrProfWriter::InstrProfWriter | ( | bool | Sparse = false, |
| uint64_t | TemporalProfTraceReservoirSize = 0, | ||
| uint64_t | MaxTemporalProfTraceLength = 0, | ||
| bool | WritePrevVersion = false, | ||
| memprof::IndexedVersion | MemProfVersionRequested = static_cast<memprof::IndexedVersion>( memprof::MinimumSupportedVersion), | ||
| bool | MemProfFullSchema = false, | ||
| bool | MemprofGenerateRandomHotness = false, | ||
| unsigned | RandomSeed = 0 ) |
Definition at line 152 of file InstrProfWriter.cpp.
Referenced by mergeRecordsFromWriter().
| InstrProfWriter::~InstrProfWriter | ( | ) |
Definition at line 168 of file InstrProfWriter.cpp.
| void InstrProfWriter::addBinaryIds | ( | ArrayRef< llvm::object::BuildID > | BIs | ) |
Definition at line 348 of file InstrProfWriter.cpp.
References llvm::append_range().
Referenced by mergeRecordsFromWriter().
| void InstrProfWriter::addDataAccessProfData | ( | std::unique_ptr< memprof::DataAccessProfData > | DataAccessProfile | ) |
Definition at line 352 of file InstrProfWriter.cpp.
| bool InstrProfWriter::addMemProfData | ( | memprof::IndexedMemProfData | Incoming, |
| function_ref< void(Error)> | Warn ) |
Add the entire MemProfData Incoming to the writer context.
Definition at line 308 of file InstrProfWriter.cpp.
References assert(), llvm::memprof::IndexedMemProfData::CallStacks, llvm::MapVector< KeyT, ValueT, MapType, VectorType, N >::empty(), F, llvm::memprof::IndexedMemProfData::Frames, and llvm::memprof::IndexedMemProfData::Records.
|
inline |
Definition at line 115 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 177 of file InstrProfWriter.cpp.
References addRecord(), and I.
Referenced by addRecord(), 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 357 of file InstrProfWriter.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::erase_if(), I, llvm::shuffle(), llvm::Trace::size(), and T.
Referenced by mergeRecordsFromWriter().
|
inline |
Definition at line 118 of file InstrProfWriter.h.
|
inline |
Definition at line 108 of file InstrProfWriter.h.
|
inline |
Definition at line 210 of file InstrProfWriter.h.
|
inline |
Definition at line 212 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 166 of file InstrProfWriter.h.
References A(), B(), llvm::coverage_count_mismatch, llvm::FrontendInstrumentation, llvm::FunctionEntryInstrumentation, llvm::FunctionEntryOnly, llvm::LoopEntriesInstrumentation, llvm::make_error(), llvm::Other, llvm::SingleByteCoverage, 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 387 of file InstrProfWriter.cpp.
References addBinaryIds(), addRecord(), addTemporalProfileTraces(), I, and InstrProfWriter().
| void InstrProfWriter::overlapRecord | ( | NamedInstrProfRecord && | Other, |
| OverlapStats & | Overlap, | ||
| OverlapStats & | FuncLevelOverlap, | ||
| const OverlapFuncFilters & | FuncFilter ) |
Definition at line 184 of file InstrProfWriter.cpp.
References llvm::OverlapStats::addOneMismatch(), llvm::OverlapStats::addOneUnique(), llvm::CountSumOrPercent::CountSum, 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 222 of file InstrProfWriter.h.
References llvm::Full.
|
inline |
Definition at line 219 of file InstrProfWriter.h.
References llvm::Version.
| void InstrProfWriter::setOutputSparse | ( | bool | Sparse | ) |
Definition at line 175 of file InstrProfWriter.cpp.
| void InstrProfWriter::setValueProfDataEndianness | ( | llvm::endianness | Endianness | ) |
Definition at line 171 of file InstrProfWriter.cpp.
| Error InstrProfWriter::validateRecord | ( | const InstrProfRecord & | Func | ) |
Definition at line 717 of file InstrProfWriter.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::invalid_prof, llvm::make_error(), and llvm::Error::success().
Referenced by writeText().
| Error InstrProfWriter::write | ( | raw_fd_ostream & | OS | ) |
Write the profile to OS.
Definition at line 691 of file InstrProfWriter.cpp.
Referenced by writeBuffer().
| Error InstrProfWriter::write | ( | raw_string_ostream & | OS | ) |
Write the profile to a string output stream OS.
Definition at line 697 of file InstrProfWriter.cpp.
| std::unique_ptr< MemoryBuffer > InstrProfWriter::writeBuffer | ( | ) |
Write the profile, returning the raw data. For testing.
Definition at line 702 of file InstrProfWriter.cpp.
References llvm::Data, llvm::MemoryBuffer::getMemBufferCopy(), and write().
|
static |
Write Record in text format to OS.
Definition at line 733 of file InstrProfWriter.cpp.
References llvm::Count, llvm::InstrProfSymtab::getFuncOrVarNameIfDefined(), 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 784 of file InstrProfWriter.cpp.
References A(), llvm::InstrProfSymtab::addFuncName(), llvm::InstrProfSymtab::addVTableName(), B(), llvm::ContextSensitive, llvm::FunctionEntryInstrumentation, I, llvm::IRInstrumentation, llvm::LoopEntriesInstrumentation, 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 842 of file InstrProfWriter.cpp.
References llvm::InstrProfSymtab::getFuncOrVarName().
Referenced by writeText().