|
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 | setUseMD5ProfileSymbolList () override |
| void | setUseMD5IndexedTables () override |
| void | setUseCompositeProfile (bool Enable) override |
| Select composite encoding for subsequent writes. | |
| 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) |
| 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 |
| unsigned | findUnwrittenEntry (SecType Type) |
| virtual std::error_code | writeOneSection (SecType Type, 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 | writeEytzingerNameTableSection (const SampleProfileMap &ProfileMap) |
| std::error_code | writeFuncOffsetTable (SecType Type, bool IsNested) |
| std::error_code | writeEytzingerFuncOffsetTable (SecType Type, bool IsNested) |
| std::error_code | writeLegacyFuncOffsetTable (SecType Type) |
| std::error_code | writeProfileSymbolListSection () |
| std::error_code | writeStringBasedProfileSymbolListSection () |
| std::error_code | writeMD5ProfileSymbolListSection () |
| 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, bool IsNested) |
| std::error_code | writeLBRProfile (const FunctionSamples &S, bool IsNested) |
| std::error_code | writeCompositeProfile (const FunctionSamples &S, bool IsNested) |
| Interfaces for composite profile writing. | |
| std::error_code | writeProfileType (ProfTypes Type, function_ref< std::error_code()> WritePayload) |
Write one Type and the size-prefixed payload emitted by WritePayload. | |
| 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. | |
Static Protected Member Functions | |
| static SmallVector< SecHdrTableEntry, 8 > | getExtBinaryHdrLayout (SectionLayout SL) |
Protected Attributes | |
| SectionLayout | SecLayout = DefaultLayout |
| SmallVector< SecHdrTableEntry, 8 > | SectionHdrLayout |
| uint64_t | SecLBRProfileStart = 0 |
| Protected Attributes inherited from llvm::sampleprof::SampleProfileWriterBinary | |
| std::unique_ptr< raw_ostream > | PayloadSizeStream |
| Reusable stream that counts payload bytes without retaining them. | |
| bool | WritingProfileType = false |
| Whether a profile payload callback is currently being executed. | |
| MapVector< FunctionId, uint32_t > | NameTable |
| bool | WriteVTableProf = false |
| bool | WriteCompositeProf = 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 271 of file SampleProfWriter.h.
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 978 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 252 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 339 of file SampleProfWriter.h.
References llvm::sampleprof::addSecFlag(), and SectionHdrLayout.
Referenced by setPartialProfile(), setToCompressSection(), setUseMD5(), writeEytzingerFuncOffsetTable(), writeLegacyFuncOffsetTable(), writeNameTableSection(), and writeOneSection().
Definition at line 670 of file SampleProfWriter.cpp.
References llvm::enumerate(), I, llvm::is_contained(), llvm::sampleprof::SecHdrTableEntry::LayoutIndex, llvm_unreachable, llvm::map_range(), and SectionHdrLayout.
Referenced by writeOneSection(), and writeSections().
|
staticprotected |
Definition at line 177 of file SampleProfWriter.cpp.
References llvm::sampleprof::CtxSplitLayout, llvm::sampleprof::DefaultLayout, llvm_unreachable, llvm::sampleprof::NumOfLayout, llvm::sampleprof::SecCSNameTable, llvm::sampleprof::SecFlagFlat, llvm::sampleprof::SecFuncMetadata, llvm::sampleprof::SecFuncOffsetTable, llvm::sampleprof::SecLBRProfile, llvm::sampleprof::SecNameTable, llvm::sampleprof::SecProfileSymbolList, and llvm::sampleprof::SecProfSummary.
Referenced by resetSecLayout().
|
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 218 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 318 of file SampleProfWriter.h.
References assert(), getExtBinaryHdrLayout(), SecLayout, SectionHdrLayout, and verifySecLayout().
Referenced by setUseCtxSplitLayout().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 294 of file SampleProfWriter.h.
References addSectionFlag(), llvm::sampleprof::SecFlagPartial, and llvm::sampleprof::SecProfSummary.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 298 of file SampleProfWriter.h.
References setUseMD5ProfileSymbolList().
|
overridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 1032 of file SampleProfWriter.cpp.
References llvm::sampleprof::addSecFlag(), llvm::sampleprof::SecFlagCompress, and SectionHdrLayout.
| void SampleProfileWriterExtBinaryBase::setToCompressSection | ( | SecType | Type | ) |
Definition at line 1037 of file SampleProfWriter.cpp.
References addSectionFlag(), and llvm::sampleprof::SecFlagCompress.
|
inlineoverridevirtual |
Select composite encoding for subsequent writes.
Composite output requires CompositeProfileVersion or newer when write() is called.
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 314 of file SampleProfWriter.h.
References llvm::Enable, and llvm::sampleprof::SampleProfileWriterBinary::WriteCompositeProf.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 304 of file SampleProfWriter.h.
References llvm::sampleprof::CtxSplitLayout, and resetSecLayout().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 283 of file SampleProfWriter.h.
References addSectionFlag(), llvm::sampleprof::SecFlagFixedLengthMD5, llvm::sampleprof::SecFlagMD5Name, and llvm::sampleprof::SecNameTable.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 310 of file SampleProfWriter.h.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 308 of file SampleProfWriter.h.
Referenced by setProfileSymbolList().
|
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 268 of file SampleProfWriter.cpp.
References llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::success, and writeSections().
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 289 of file SampleProfWriter.cpp.
References writeCSNameIdx(), and llvm::sampleprof::SampleProfileWriterBinary::writeNameIdx().
Referenced by writeFuncMetadata(), writeLegacyFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 298 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 617 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 330 of file SampleProfWriter.cpp.
References addSectionFlag(), assert(), llvm::is_contained(), llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::SecFlagEytzinger, llvm::success, and llvm::too_large.
Referenced by writeFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 575 of file SampleProfWriter.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy >::contains(), llvm::sampleprof::CtxSplitLayout, llvm::sampleprof::Flat, I, llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::Nested, llvm::sampleprof::SampleProfileWriter::OutputStream, SecLayout, and llvm::success.
Referenced by writeNameTableSection(), and writeSections().
|
protected |
Definition at line 411 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 443 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 317 of file SampleProfWriter.cpp.
References llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::unsupported_writing_format, writeEytzingerFuncOffsetTable(), and writeLegacyFuncOffsetTable().
Referenced by writeOneSection(), and writeSections().
|
protected |
Definition at line 375 of file SampleProfWriter.cpp.
References addSectionFlag(), llvm::encodeULEB128(), llvm::Offset, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::SecFlagOrdered, llvm::success, and writeContextIdx().
Referenced by writeFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 655 of file SampleProfWriter.cpp.
References llvm::EytzingerTable< T >::create(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::success, llvm::Table, and llvm::raw_ostream::write().
Referenced by writeProfileSymbolListSection(), and writeSections().
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 470 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 486 of file SampleProfWriter.cpp.
References addContext(), llvm::sampleprof::SampleProfileWriterBinary::addNames(), addSectionFlag(), I, llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::SecFlagUniqSuffix, llvm::sampleprof::SecNameTable, llvm::success, llvm::sampleprof::FunctionSamples::UniqSuffix, llvm::unsupported_writing_format, writeEytzingerNameTableSection(), and writeNameTable().
Referenced by writeOneSection(), and writeSections().
|
protectedvirtual |
Definition at line 679 of file SampleProfWriter.cpp.
References addNewSection(), addSectionFlag(), llvm::sampleprof::SampleProfileWriter::computeSummary(), ExtBinaryWriteVTableTypeProf, findUnwrittenEntry(), llvm::sampleprof::hasSecFlag(), markSectionStart(), llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsFS, llvm::sampleprof::FunctionSamples::ProfileIsPreInlined, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::sampleprof::SecCompositeFuncOffsetTable, llvm::sampleprof::SecCompositeProfile, llvm::sampleprof::SecCSNameTable, llvm::sampleprof::SecFlagEytzinger, llvm::sampleprof::SecFlagFlat, llvm::sampleprof::SecFlagFSDiscriminator, llvm::sampleprof::SecFlagFullContext, llvm::sampleprof::SecFlagHasAttribute, llvm::sampleprof::SecFlagHasVTableTypeProf, llvm::sampleprof::SecFlagIsPreInlined, llvm::sampleprof::SecFlagIsProbeBased, llvm::sampleprof::SecFlagMD5, llvm::sampleprof::SecFuncMetadata, llvm::sampleprof::SecFuncOffsetTable, llvm::sampleprof::SecLBRProfile, SecLBRProfileStart, llvm::sampleprof::SecNameTable, llvm::sampleprof::SecProfileSymbolList, llvm::sampleprof::SecProfSummary, SectionHdrLayout, llvm::success, writeCSNameTableSection(), writeCustomSection(), writeFuncMetadata(), writeFuncOffsetTable(), llvm::sampleprof::SampleProfileWriter::writeFuncProfiles(), writeNameTableSection(), writeProfileSymbolListSection(), and llvm::sampleprof::SampleProfileWriterBinary::writeSummary().
Referenced by writeSections().
|
protected |
Definition at line 636 of file SampleProfWriter.cpp.
References writeMD5ProfileSymbolListSection(), and writeStringBasedProfileSymbolListSection().
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 307 of file SampleProfWriter.cpp.
References llvm::encodeULEB128(), llvm::sampleprof::FunctionSamples::getContext(), llvm::sampleprof::FunctionSamples::getHeadSamples(), llvm::Offset, llvm::sampleprof::SampleProfileWriter::OutputStream, SecLBRProfileStart, llvm::sampleprof::SampleProfileWriterBinary::writeBody(), and llvm::sampleprof::SampleProfileWriterBinary::WriteCompositeProf.
|
protectedpure virtual |
References findUnwrittenEntry(), Profile, writeContextIdx(), writeCSNameIdx(), writeCSNameTableSection(), writeEytzingerFuncOffsetTable(), writeEytzingerNameTableSection(), writeFuncMetadata(), writeFuncOffsetTable(), writeLegacyFuncOffsetTable(), writeMD5ProfileSymbolListSection(), writeNameTable(), writeNameTableSection(), writeOneSection(), writeProfileSymbolListSection(), and writeStringBasedProfileSymbolListSection().
Referenced by write().
|
protected |
Definition at line 643 of file SampleProfWriter.cpp.
References assert(), llvm::sampleprof::SampleProfileWriter::OutputStream, and llvm::success.
Referenced by writeProfileSymbolListSection(), and writeSections().
|
protected |
Definition at line 384 of file SampleProfWriter.h.
Referenced by resetSecLayout(), and writeEytzingerNameTableSection().
|
protected |
Definition at line 395 of file SampleProfWriter.h.
Referenced by writeOneSection(), and writeSample().
|
protected |
Definition at line 389 of file SampleProfWriter.h.
Referenced by addNewSection(), addSectionFlag(), findUnwrittenEntry(), markSectionStart(), resetSecLayout(), setToCompressAllSections(), and writeOneSection().