|
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 | writeEytzingerNameTableSection (const SampleProfileMap &ProfileMap) |
| std::error_code | writeFuncOffsetTable (bool IsCS) |
| std::error_code | writeEytzingerFuncOffsetTable (bool IsCS) |
| std::error_code | writeLegacyFuncOffsetTable () |
| 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) |
| 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 328 of file SampleProfWriter.h.
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 936 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 218 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 381 of file SampleProfWriter.h.
References llvm::sampleprof::addSecFlag(), and SectionHdrLayout.
Referenced by setPartialProfile(), setToCompressSection(), setUseMD5(), writeEytzingerFuncOffsetTable(), writeLegacyFuncOffsetTable(), writeNameTableSection(), and writeOneSection().
|
inlineprotected |
Definition at line 388 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 184 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 363 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 351 of file SampleProfWriter.h.
References addSectionFlag(), llvm::sampleprof::SecFlagPartial, and llvm::sampleprof::SecProfSummary.
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 355 of file SampleProfWriter.h.
|
overridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 990 of file SampleProfWriter.cpp.
References llvm::sampleprof::addSecFlag(), llvm::sampleprof::SecFlagCompress, and SectionHdrLayout.
| void SampleProfileWriterExtBinaryBase::setToCompressSection | ( | SecType | Type | ) |
Definition at line 995 of file SampleProfWriter.cpp.
References addSectionFlag(), and llvm::sampleprof::SecFlagCompress.
Referenced by writeOneSection().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 359 of file SampleProfWriter.h.
References llvm::sampleprof::CtxSplitLayout, and resetSecLayout().
|
inlineoverridevirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriter.
Definition at line 340 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 234 of file SampleProfWriter.cpp.
References llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::success, and writeSections().
|
overrideprotectedvirtual |
Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.
Definition at line 255 of file SampleProfWriter.cpp.
References writeCSNameIdx(), and llvm::sampleprof::SampleProfileWriterBinary::writeNameIdx().
Referenced by writeFuncMetadata(), writeLegacyFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 264 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 577 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 294 of file SampleProfWriter.cpp.
References addSectionFlag(), assert(), llvm::is_contained(), llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::SecFlagEytzinger, llvm::sampleprof::SecFuncOffsetTable, llvm::success, and llvm::too_large.
Referenced by writeFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 536 of file SampleProfWriter.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy >::contains(), llvm::sampleprof::CS, llvm::sampleprof::CtxSplitLayout, llvm::sampleprof::Flat, I, llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::sampleprof::SampleProfileWriterBinary::NameTable, llvm::sampleprof::SampleProfileWriter::OutputStream, SecLayout, and llvm::success.
Referenced by writeNameTableSection(), and writeSections().
|
protected |
Definition at line 372 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 404 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 282 of file SampleProfWriter.cpp.
References llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::unsupported_writing_format, writeEytzingerFuncOffsetTable(), WriteEytzingerNameTables, and writeLegacyFuncOffsetTable().
Referenced by writeOneSection(), and writeSections().
|
protected |
Definition at line 336 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 writeFuncOffsetTable(), and writeSections().
|
protected |
Definition at line 615 of file SampleProfWriter.cpp.
References assert(), 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 431 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 447 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, WriteEytzingerNameTables, writeEytzingerNameTableSection(), and writeNameTable().
Referenced by writeOneSection(), and writeSections().
|
protectedvirtual |
Definition at line 633 of file SampleProfWriter.cpp.
References addNewSection(), addSectionFlag(), llvm::sampleprof::SampleProfileWriter::computeSummary(), ExtBinaryWriteVTableTypeProf, 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::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, setToCompressSection(), llvm::success, writeCSNameTableSection(), writeCustomSection(), WriteEytzingerNameTables, writeFuncMetadata(), writeFuncOffsetTable(), llvm::sampleprof::SampleProfileWriter::writeFuncProfiles(), WriteMD5ProfSymList, writeNameTableSection(), writeProfileSymbolListSection(), and llvm::sampleprof::SampleProfileWriterBinary::writeSummary().
Referenced by writeSections().
|
protected |
Definition at line 596 of file SampleProfWriter.cpp.
References writeMD5ProfileSymbolListSection(), WriteMD5ProfSymList, 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 273 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(), writeEytzingerFuncOffsetTable(), writeEytzingerNameTableSection(), writeFuncMetadata(), writeFuncOffsetTable(), writeLegacyFuncOffsetTable(), writeMD5ProfileSymbolListSection(), writeNameTable(), writeNameTableSection(), writeOneSection(), writeProfileSymbolListSection(), and writeStringBasedProfileSymbolListSection().
Referenced by write().
|
protected |
Definition at line 603 of file SampleProfWriter.cpp.
References assert(), llvm::sampleprof::SampleProfileWriter::OutputStream, and llvm::success.
Referenced by writeProfileSymbolListSection(), and writeSections().
|
protected |
Definition at line 427 of file SampleProfWriter.h.
Referenced by resetSecLayout(), and writeEytzingerNameTableSection().
|
protected |
Definition at line 438 of file SampleProfWriter.h.
Referenced by writeOneSection(), and writeSample().
|
protected |
Definition at line 432 of file SampleProfWriter.h.
Referenced by addNewSection(), addSectionFlag(), addSectionFlag(), markSectionStart(), resetSecLayout(), setToCompressAllSections(), and writeOneSection().