|
LLVM 24.0.0git
|
#include "llvm/ProfileData/SampleProfWriter.h"
Public Member Functions | |
| std::error_code | write (const SampleProfileMap &ProfileMap) override |
| Write all the sample profiles in the given map of samples. | |
| void | setToCompressAllSections () override |
| void | setToCompressSection (SecType Type) |
| std::error_code | writeSample (const FunctionSamples &S) override |
| Write samples of a top-level function to a binary file. | |
| void | setUseMD5 () override |
| void | setPartialProfile () override |
| void | setProfileSymbolList (ProfileSymbolList *PSL) override |
| void | setUseCtxSplitLayout () override |
| void | resetSecLayout (SectionLayout SL) |
| Public Member Functions inherited from llvm::sampleprof::SampleProfileWriterBinary | |
| SampleProfileWriterBinary (std::unique_ptr< raw_ostream > &OS) | |
| Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
| virtual | ~SampleProfileWriter ()=default |
| 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 () |
| void | setFormatVersion (uint64_t V) |
| uint64_t | getFormatVersion () const |
Protected Member Functions | |
| uint64_t | markSectionStart (SecType Type, uint32_t LayoutIdx) |
Return the current position and prepare to use it as the start position of a section given the section type Type and its position LayoutIdx in SectionHdrLayout. | |
| std::error_code | addNewSection (SecType Sec, uint32_t LayoutIdx, uint64_t SectionStart) |
Add a new section into section header table given the section type Type, its position LayoutIdx in SectionHdrLayout and the location SectionStart where the section should be written to. | |
| template<class SecFlagType> | |
| void | addSectionFlag (SecType Type, SecFlagType Flag) |
| template<class SecFlagType> | |
| void | addSectionFlag (uint32_t SectionIdx, SecFlagType Flag) |
| void | addContext (const SampleContext &Context) override |
| virtual std::error_code | writeCustomSection (SecType Type)=0 |
| virtual void | verifySecLayout (SectionLayout SL)=0 |
| virtual std::error_code | writeSections (const SampleProfileMap &ProfileMap)=0 |
| virtual std::error_code | writeOneSection (SecType Type, uint32_t LayoutIdx, const SampleProfileMap &ProfileMap) |
| std::error_code | writeNameTable () override |
| std::error_code | writeContextIdx (const SampleContext &Context) override |
| std::error_code | writeCSNameIdx (const SampleContext &Context) |
| std::error_code | writeCSNameTableSection () |
| std::error_code | writeFuncMetadata (const SampleProfileMap &Profiles) |
| std::error_code | writeFuncMetadata (const FunctionSamples &Profile) |
| std::error_code | writeNameTableSection (const SampleProfileMap &ProfileMap) |
| std::error_code | writeFuncOffsetTable () |
| std::error_code | writeProfileSymbolListSection () |
| Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriterBinary | |
| virtual MapVector< FunctionId, uint32_t > & | getNameTable () |
| virtual std::error_code | writeMagicIdent (SampleProfileFormat Format) |
| std::error_code | writeSummary () |
| std::error_code | writeNameIdx (FunctionId FName) |
| std::error_code | writeBody (const FunctionSamples &S) |
| void | addName (FunctionId FName) |
| void | addNames (const FunctionSamples &S) |
| std::error_code | writeCallsiteVTableProf (const CallsiteTypeMap &CallsiteTypeMap, raw_ostream &OS) |
Write CallsiteTypeMap to the output stream OS. | |
| Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
| SampleProfileWriter (std::unique_ptr< raw_ostream > &OS) | |
| 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 | |
| SectionLayout | SecLayout = DefaultLayout |
| SmallVector< SecHdrTableEntry, 8 > | SectionHdrLayout |
| uint64_t | SecLBRProfileStart = 0 |
| Protected Attributes inherited from llvm::sampleprof::SampleProfileWriterBinary | |
| MapVector< FunctionId, uint32_t > | NameTable |
| bool | WriteVTableProf = false |
| 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. | |
| uint64_t | FormatVersion = sampleprof::DefaultVersion |
| Format version to write. | |
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. | |
Definition at line 327 of file SampleProfWriter.h.
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 725 of file SampleProfWriter.cpp.
References llvm::sampleprof::SampleProfileWriterBinary::addName().
Referenced by writeNameTableSection().
|
protected |
Add a new section into section header table given the section type Type, its position LayoutIdx in SectionHdrLayout and the location SectionStart where the section should be written to.
Definition at line 206 of file SampleProfWriter.cpp.
References assert(), llvm::sampleprof::hasSecFlag(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::SecFlagCompress, SectionHdrLayout, and llvm::success.
Referenced by writeOneSection().
|
inlineprotected |
Definition at line 380 of file SampleProfWriter.h.
References llvm::sampleprof::addSecFlag(), and SectionHdrLayout.
Referenced by setPartialProfile(), setToCompressSection(), setUseMD5(), writeFuncOffsetTable(), writeNameTableSection(), and writeOneSection().
|
inlineprotected |
Definition at line 387 of file SampleProfWriter.h.
References llvm::sampleprof::addSecFlag(), and SectionHdrLayout.
|
protected |
Return the current position and prepare to use it as the start position of a section given the section type Type and its position LayoutIdx in SectionHdrLayout.
Definition at line 172 of file SampleProfWriter.cpp.
References assert(), llvm::sampleprof::hasSecFlag(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::SecFlagCompress, and SectionHdrLayout.
Referenced by writeOneSection().
|
inline |
Definition at line 362 of file SampleProfWriter.h.
References assert(), llvm::sampleprof::ExtBinaryHdrLayoutTable, SecLayout, SectionHdrLayout, and verifySecLayout().
Referenced by setUseCtxSplitLayout().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 350 of file SampleProfWriter.h.
References addSectionFlag(), llvm::sampleprof::SecFlagPartial, and llvm::sampleprof::SecProfSummary.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 354 of file SampleProfWriter.h.
|
overridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 779 of file SampleProfWriter.cpp.
References llvm::sampleprof::addSecFlag(), llvm::sampleprof::SecFlagCompress, and SectionHdrLayout.
| void SampleProfileWriterExtBinaryBase::setToCompressSection | ( | SecType | Type | ) |
Definition at line 784 of file SampleProfWriter.cpp.
References addSectionFlag(), and llvm::sampleprof::SecFlagCompress.
Referenced by writeOneSection().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 358 of file SampleProfWriter.h.
References llvm::sampleprof::CtxSplitLayout, and resetSecLayout().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 339 of file SampleProfWriter.h.
References addSectionFlag(), llvm::sampleprof::SecFlagFixedLengthMD5, llvm::sampleprof::SecFlagMD5Name, and llvm::sampleprof::SecNameTable.
|
protectedpure virtual |
Referenced by resetSecLayout().
|
overridevirtual |
Write all the sample profiles in the given map of samples.
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 222 of file SampleProfWriter.cpp.
References llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::success, and writeSections().
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 243 of file SampleProfWriter.cpp.
References writeCSNameIdx(), and llvm::sampleprof::SampleProfileWriterBinary::writeNameIdx().
Referenced by writeFuncMetadata(), writeFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 252 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::success, and llvm::truncated_name_table.
Referenced by writeContextIdx(), and writeSections().
|
protected |
Definition at line 405 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::little, llvm::sampleprof::SampleProfileWriter::OutputStream, stabilizeTable(), llvm::success, and llvm::sampleprof::SampleProfileWriterBinary::writeNameIdx().
Referenced by writeOneSection(), and writeSections().
|
protectedpure virtual |
Referenced by writeOneSection().
|
protected |
Definition at line 305 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::SampleContext::getAllAttributes(), llvm::sampleprof::FunctionSamples::getCallsiteSamples(), llvm::sampleprof::FunctionSamples::getContext(), llvm::sampleprof::FunctionSamples::getFunctionHash(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsPreInlined, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::success, writeContextIdx(), and writeFuncMetadata().
|
protected |
Definition at line 337 of file SampleProfWriter.cpp.
References llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsPreInlined, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::success, and writeFuncMetadata().
Referenced by writeFuncMetadata(), writeFuncMetadata(), writeOneSection(), and writeSections().
|
protected |
Definition at line 269 of file SampleProfWriter.cpp.
References addSectionFlag(), llvm::encodeULEB128(), llvm::Offset, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::SecFlagOrdered, llvm::sampleprof::SecFuncOffsetTable, llvm::success, and writeContextIdx().
Referenced by writeOneSection(), and writeSections().
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 364 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::little, llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::SampleProfileWriter::OutputStream, stabilizeTable(), llvm::success, llvm::support::endian::Writer::write(), and llvm::sampleprof::SampleProfileWriterBinary::writeNameTable().
Referenced by writeNameTableSection(), and writeSections().
|
protected |
Definition at line 380 of file SampleProfWriter.cpp.
References addContext(), llvm::sampleprof::SampleProfileWriterBinary::addNames(), addSectionFlag(), I, llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::SecFlagUniqSuffix, llvm::sampleprof::SecNameTable, llvm::success, llvm::sampleprof::FunctionSamples::UniqSuffix, and writeNameTable().
Referenced by writeOneSection(), and writeSections().
|
protectedvirtual |
Definition at line 432 of file SampleProfWriter.cpp.
References addNewSection(), addSectionFlag(), llvm::sampleprof::SampleProfileWriter::computeSummary(), ExtBinaryWriteVTableTypeProf, markSectionStart(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsFS, llvm::sampleprof::FunctionSamples::ProfileIsPreInlined, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::sampleprof::SecCSNameTable, llvm::sampleprof::SecFlagFSDiscriminator, llvm::sampleprof::SecFlagFullContext, llvm::sampleprof::SecFlagHasAttribute, llvm::sampleprof::SecFlagHasVTableTypeProf, llvm::sampleprof::SecFlagIsPreInlined, llvm::sampleprof::SecFlagIsProbeBased, llvm::sampleprof::SecFuncMetadata, llvm::sampleprof::SecFuncOffsetTable, llvm::sampleprof::SecLBRProfile, SecLBRProfileStart, llvm::sampleprof::SecNameTable, llvm::sampleprof::SecProfileSymbolList, llvm::sampleprof::SecProfSummary, setToCompressSection(), llvm::success, writeCSNameTableSection(), writeCustomSection(), writeFuncMetadata(), writeFuncOffsetTable(), llvm::sampleprof::SampleProfileWriter::writeFuncProfiles(), writeNameTableSection(), writeProfileSymbolListSection(), and llvm::sampleprof::SampleProfileWriterBinary::writeSummary().
Referenced by writeSections().
|
protected |
Definition at line 424 of file SampleProfWriter.cpp.
References llvm::sampleprof::SampleProfileWriter::OutputStream, and llvm::success.
Referenced by writeOneSection(), and writeSections().
|
overridevirtual |
Write samples of a top-level function to a binary file.
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 261 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::FunctionSamples::getContext(), llvm::sampleprof::FunctionSamples::getHeadSamples(), llvm::Offset, llvm::sampleprof::SampleProfileWriter::OutputStream, SecLBRProfileStart, and llvm::sampleprof::SampleProfileWriterBinary::writeBody().
|
protectedpure virtual |
References Profile, writeContextIdx(), writeCSNameIdx(), writeCSNameTableSection(), writeFuncMetadata(), writeFuncOffsetTable(), writeNameTable(), writeNameTableSection(), writeOneSection(), and writeProfileSymbolListSection().
Referenced by write().
|
protected |
Definition at line 420 of file SampleProfWriter.h.
Referenced by resetSecLayout().
|
protected |
Definition at line 431 of file SampleProfWriter.h.
Referenced by writeOneSection(), and writeSample().
|
protected |
Definition at line 425 of file SampleProfWriter.h.
Referenced by addNewSection(), addSectionFlag(), addSectionFlag(), markSectionStart(), resetSecLayout(), and setToCompressAllSections().