LLVM 20.0.0git
|
Sample-based profile writer (binary format). More...
#include "llvm/ProfileData/SampleProfWriter.h"
Public Member Functions | |
SampleProfileWriterBinary (std::unique_ptr< raw_ostream > &OS) | |
std::error_code | writeSample (const FunctionSamples &S) override |
Write samples of a top-level function to a binary file. | |
Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
virtual | ~SampleProfileWriter ()=default |
virtual std::error_code | writeSample (const FunctionSamples &S)=0 |
Write sample profiles in S . | |
virtual std::error_code | write (const SampleProfileMap &ProfileMap) |
Write all the sample profiles in the given map of samples. | |
template<typename FunctionPruningStrategy = DefaultFunctionPruningStrategy> | |
std::error_code | writeWithSizeLimit (SampleProfileMap &ProfileMap, size_t OutputSizeLimit) |
Write sample profiles up to given size limit, using the pruning strategy to drop some functions if necessary. | |
raw_ostream & | getOutputStream () |
virtual void | setProfileSymbolList (ProfileSymbolList *PSL) |
virtual void | setToCompressAllSections () |
virtual void | setUseMD5 () |
virtual void | setPartialProfile () |
virtual void | setUseCtxSplitLayout () |
Protected Member Functions | |
virtual MapVector< FunctionId, uint32_t > & | getNameTable () |
virtual std::error_code | writeMagicIdent (SampleProfileFormat Format) |
virtual std::error_code | writeNameTable () |
std::error_code | writeHeader (const SampleProfileMap &ProfileMap) override |
Write a file header for the profile file. | |
std::error_code | writeSummary () |
virtual std::error_code | writeContextIdx (const SampleContext &Context) |
std::error_code | writeNameIdx (FunctionId FName) |
std::error_code | writeBody (const FunctionSamples &S) |
void | stablizeNameTable (MapVector< FunctionId, uint32_t > &NameTable, std::set< FunctionId > &V) |
void | addName (FunctionId FName) |
virtual void | addContext (const SampleContext &Context) |
void | addNames (const FunctionSamples &S) |
Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
SampleProfileWriter (std::unique_ptr< raw_ostream > &OS) | |
virtual std::error_code | writeHeader (const SampleProfileMap &ProfileMap)=0 |
Write a file header for the profile file. | |
virtual std::error_code | writeFuncProfiles (const SampleProfileMap &ProfileMap) |
std::error_code | writeWithSizeLimitInternal (SampleProfileMap &ProfileMap, size_t OutputSizeLimit, FunctionPruningStrategy *Strategy) |
void | computeSummary (const SampleProfileMap &ProfileMap) |
Compute summary for this profile. | |
Protected Attributes | |
MapVector< FunctionId, uint32_t > | NameTable |
Protected Attributes inherited from llvm::sampleprof::SampleProfileWriter | |
size_t | LineCount |
For writeWithSizeLimit in text mode, each newline takes 1 additional byte on Windows when actually written to the file, but not written to a memory buffer. | |
std::unique_ptr< raw_ostream > | OutputStream |
Output stream where to emit the profile to. | |
std::unique_ptr< ProfileSummary > | Summary |
Profile summary. | |
SampleProfileFormat | Format = SPF_None |
Profile format. | |
Friends | |
ErrorOr< std::unique_ptr< SampleProfileWriter > > | SampleProfileWriter::create (std::unique_ptr< raw_ostream > &OS, SampleProfileFormat Format) |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
static ErrorOr< std::unique_ptr< SampleProfileWriter > > | create (StringRef Filename, SampleProfileFormat Format) |
Profile writer factory. | |
static ErrorOr< std::unique_ptr< SampleProfileWriter > > | create (std::unique_ptr< raw_ostream > &OS, SampleProfileFormat Format) |
Create a new stream writer based on the value of Format . | |
Sample-based profile writer (binary format).
Definition at line 201 of file SampleProfWriter.h.
|
inline |
Definition at line 203 of file SampleProfWriter.h.
|
protectedvirtual |
Reimplemented in llvm::sampleprof::SampleProfileWriterExtBinaryBase.
Definition at line 651 of file SampleProfWriter.cpp.
References addName(), and llvm::sampleprof::SampleContext::getFunction().
Referenced by writeHeader().
|
protected |
Definition at line 646 of file SampleProfWriter.cpp.
References getNameTable().
Referenced by addContext(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::addContext(), and addNames().
|
protected |
Definition at line 655 of file SampleProfWriter.cpp.
References addName(), addNames(), llvm::sampleprof::FunctionSamples::getBodySamples(), llvm::sampleprof::FunctionSamples::getCallsiteSamples(), llvm::sampleprof::SampleRecord::getCallTargets(), llvm::sampleprof::FunctionSamples::getFunction(), and I.
Referenced by addNames(), writeHeader(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTableSection().
|
inlineprotectedvirtual |
Definition at line 209 of file SampleProfWriter.h.
References NameTable.
Referenced by addName(), and writeNameIdx().
|
inlineprotected |
Definition at line 683 of file SampleProfWriter.cpp.
References I, N, and NameTable.
Referenced by writeNameTable(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTable().
|
protected |
Definition at line 824 of file SampleProfWriter.cpp.
References llvm::sampleprof::LineLocation::Discriminator, llvm::encodeULEB128(), llvm::sampleprof::FunctionSamples::getBodySamples(), llvm::sampleprof::FunctionSamples::getCallsiteSamples(), llvm::sampleprof::SampleRecord::getCallTargets(), llvm::sampleprof::FunctionSamples::getContext(), llvm::sampleprof::SampleRecord::getSamples(), llvm::sampleprof::SampleRecord::getSortedCallTargets(), llvm::sampleprof::FunctionSamples::getTotalSamples(), I, llvm::sampleprof::LineLocation::LineOffset, OS, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::success, writeBody(), writeContextIdx(), and writeNameIdx().
Referenced by writeBody(), writeSample(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeSample().
|
protectedvirtual |
Reimplemented in llvm::sampleprof::SampleProfileWriterExtBinaryBase.
Definition at line 632 of file SampleProfWriter.cpp.
References assert(), llvm::sampleprof::SampleContext::getFunction(), llvm::sampleprof::SampleContext::hasContext(), and writeNameIdx().
Referenced by writeBody().
|
overrideprotectedvirtual |
Write a file header for the profile file.
Implements llvm::sampleprof::SampleProfileWriter.
Definition at line 717 of file SampleProfWriter.cpp.
References addContext(), addNames(), llvm::sampleprof::SampleProfileWriter::computeSummary(), llvm::sampleprof::SampleProfileWriter::Format, I, NameTable, llvm::success, writeMagicIdent(), writeNameTable(), and writeSummary().
|
protectedvirtual |
Definition at line 708 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::SampleProfileWriter::Format, OS, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::SPMagic(), llvm::sampleprof::SPVersion(), and llvm::success.
Referenced by writeHeader().
|
protected |
Definition at line 637 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), getNameTable(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::success, and llvm::truncated_name_table.
Referenced by writeBody(), writeContextIdx(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeContextIdx(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeCSNameTableSection().
|
protectedvirtual |
Reimplemented in llvm::sampleprof::SampleProfileWriterExtBinaryBase.
Definition at line 693 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), N, NameTable, OS, llvm::sampleprof::SampleProfileWriter::OutputStream, stablizeNameTable(), and llvm::success.
Referenced by writeHeader(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTable().
|
overridevirtual |
Write samples of a top-level function to a binary file.
Implements llvm::sampleprof::SampleProfileWriter.
Reimplemented in llvm::sampleprof::SampleProfileWriterExtBinaryBase.
Definition at line 871 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::FunctionSamples::getHeadSamples(), llvm::sampleprof::SampleProfileWriter::OutputStream, and writeBody().
|
protected |
Definition at line 808 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), OS, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::success, and llvm::sampleprof::SampleProfileWriter::Summary.
Referenced by writeHeader(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeOneSection().
|
friend |
|
protected |
Definition at line 220 of file SampleProfWriter.h.
Referenced by getNameTable(), stablizeNameTable(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::write(), writeHeader(), writeNameTable(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTable(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTableSection().