LLVM: llvm::sampleprof::SampleProfileReader Class Reference (original ) (raw )Sample-based profile reader. More...
#include "[llvm/ProfileData/SampleProfReader.h](SampleProfReader%5F8h%5Fsource.html)"
Sample-based profile reader.
Each profile contains sample counts for all the functions executed. Inside each function, statements are annotated with the collected samples on all the instructions associated with that statement.
For this to produce meaningful data, the program needs to be compiled with some debug information (at minimum, line numbers: -gline-tables-only). Otherwise, it will be impossible to match IR instructions to the line numbers collected by the profiler.
From the profile file, we are interested in collecting the following information:
A list of functions included in the profile (mangled names).
For each function F:
The total number of samples collected in F.
The samples collected at each line in F. To provide some protection against source code shuffling, line numbers should be relative to the start of the function.
The reader supports two file formats: text and binary. The text format is useful for debugging and testing, while the binary format is more compact and I/O efficient. They can both be used interchangeably.
Definition at line 346 of file SampleProfReader.h .
Definition at line 348 of file SampleProfReader.h .
References B() , Buffer , llvm::CallingConv::C , Ctx , Format , llvm::move() , Profiles , and llvm::sampleprof::SPF_None .
Referenced by llvm::sampleprof::SampleProfileReaderBinary::SampleProfileReaderBinary() , llvm::sampleprof::SampleProfileReaderGCC::SampleProfileReaderGCC() , llvm::sampleprof::SampleProfileReaderText::SampleProfileReaderText() , and takeSummary() .
◆ ~SampleProfileReader()
virtual llvm::sampleprof::SampleProfileReader::~SampleProfileReader ( )
virtualdefault
◆ collectFuncsFromModule()
virtual bool llvm::sampleprof::SampleProfileReader::collectFuncsFromModule ( )
inlinevirtual
◆ computeSummary()
void SampleProfileReader::computeSummary ( )
protected
◆ create() [1/2]◆ create() [2/2]◆ dump()◆ dumpFunctionProfile()Print the profile for [FunctionSamples](classllvm%5F1%5F1sampleprof%5F1%5F1FunctionSamples.html "Representation of the samples collected for a function.") on stream OS.
Dump the function profile for FName.
Parameters
FContext
Name + context of the function to print.
OS
Stream to emit the output to.
Definition at line 64 of file SampleProfReader.cpp .
Referenced by dump() .
◆ dumpJson()◆ dumpSectionInfo()
virtual bool llvm::sampleprof::SampleProfileReader::dumpSectionInfo ( raw_ostream & OS = dbgs ())
inlinevirtual
◆ getBuffer()
MemoryBuffer * llvm::sampleprof::SampleProfileReader::getBuffer ( ) const
inline
◆ getDiscriminatorMask()
uint32_t llvm::sampleprof::SampleProfileReader::getDiscriminatorMask ( ) const
inline
virtual std::vector< FunctionId > * llvm::sampleprof::SampleProfileReader::getNameTable ( )
inlinevirtual
◆ getProfiles()
SampleProfileMap & llvm::sampleprof::SampleProfileReader::getProfiles ( )
inline
◆ getProfileSymbolList()
virtual std::unique_ptr< ProfileSymbolList > llvm::sampleprof::SampleProfileReader::getProfileSymbolList ( )
inlinevirtual
◆ getRemapper()◆ getSamplesFor() [1/2]◆ getSamplesFor() [2/2]◆ getSummary()
ProfileSummary & llvm::sampleprof::SampleProfileReader::getSummary ( ) const
inline
◆ hasUniqSuffix()
virtual bool llvm::sampleprof::SampleProfileReader::hasUniqSuffix ( )
inlinevirtual
Return whether any name in the profile contains ".__uniq." suffix.
Definition at line 513 of file SampleProfReader.h .
◆ profileIsCS()
bool llvm::sampleprof::SampleProfileReader::profileIsCS ( ) const
inline
◆ profileIsFS()
bool llvm::sampleprof::SampleProfileReader::profileIsFS ( ) const
inline
◆ profileIsPreInlined()
bool llvm::sampleprof::SampleProfileReader::profileIsPreInlined ( ) const
inline
◆ profileIsProbeBased()
bool llvm::sampleprof::SampleProfileReader::profileIsProbeBased ( ) const
inline
◆ read() [1/3]
std::error_code llvm::sampleprof::SampleProfileReader::read ( )
inline
◆ read() [2/3]
std::error_code llvm::sampleprof::SampleProfileReader::read ( const DenseSet < StringRef > & FuncsToUse )
inline
◆ read() [3/3]Read sample profiles for the given functions and write them to the given profile map.
Currently it's only used for extended binary format to load the profiles on-demand.
Definition at line 553 of file SampleProfReader.h .
References llvm::not_implemented , and Profiles .
virtual std::error_code llvm::sampleprof::SampleProfileReader::readHeader ( )
pure virtual
◆ readImpl()
virtual std::error_code llvm::sampleprof::SampleProfileReader::readImpl ( )
pure virtual
◆ reportError()
void llvm::sampleprof::SampleProfileReader::reportError ( int64_t LineNumber , const Twine & Msg ) const
inline
◆ setDiscriminatorMaskedBitFrom()
void llvm::sampleprof::SampleProfileReader::setDiscriminatorMaskedBitFrom ( FSDiscriminatorPass P )
inline
◆ setFuncNameToProfNameMap()◆ setModule()
void llvm::sampleprof::SampleProfileReader::setModule ( const Module * Mod )
inline
◆ setProfileUseMD5()
virtual void llvm::sampleprof::SampleProfileReader::setProfileUseMD5 ( )
inlinevirtual
◆ setSkipFlatProf()
void llvm::sampleprof::SampleProfileReader::setSkipFlatProf ( bool Skip )
inline
◆ takeSummary()◆ useMD5()
bool llvm::sampleprof::SampleProfileReader::useMD5 ( ) const
inline
◆ Buffer
std::unique_ptr<MemoryBuffer > llvm::sampleprof::SampleProfileReader::Buffer
protected
Memory buffer holding the profile file.
Definition at line 536 of file SampleProfReader.h .
Referenced by getBuffer() , llvm::sampleprof::SampleProfileReaderExtBinary::hasFormat() , llvm::sampleprof::SampleProfileReaderGCC::hasFormat() , llvm::sampleprof::SampleProfileReaderRawBinary::hasFormat() , llvm::sampleprof::SampleProfileReaderText::hasFormat() , llvm::sampleprof::SampleProfileReaderBinary::readHeader() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readHeader() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readImpl() , llvm::sampleprof::SampleProfileReaderText::readImpl() , llvm::sampleprof::SampleProfileReaderBinary::readVTableTypeCountMap() , reportError() , SampleProfileReader() , and llvm::sampleprof::SampleProfileReaderGCC::SampleProfileReaderGCC() .
◆ CSProfileCount
uint32_t llvm::sampleprof::SampleProfileReader::CSProfileCount = 0
protected
◆ Ctx
LLVMContext & llvm::sampleprof::SampleProfileReader::Ctx
protected
◆ FuncNameToProfNameMap
const Module * llvm::sampleprof::SampleProfileReader::M = nullptr
protected
◆ MaskedBitFrom
uint32_t llvm::sampleprof::SampleProfileReader::MaskedBitFrom = 31
protected
◆ ProfileHasAttribute
bool llvm::sampleprof::SampleProfileReader::ProfileHasAttribute = false
protected
◆ ProfileIsCS
bool llvm::sampleprof::SampleProfileReader::ProfileIsCS = false
protected
Whether function profiles are context-sensitive flat profiles.
Definition at line 580 of file SampleProfReader.h .
Referenced by profileIsCS() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readCSNameTableSec() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncProfiles() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncProfiles() , llvm::sampleprof::SampleProfileReaderText::readImpl() , llvm::sampleprof::SampleProfileReaderBinary::readNameTable() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readNameTableSec() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection() , llvm::sampleprof::SampleProfileReaderBinary::readSampleContextFromTable() , and llvm::sampleprof::SampleProfileReaderExtBinaryBase::useFuncOffsetList() .
◆ ProfileIsFS
bool llvm::sampleprof::SampleProfileReader::ProfileIsFS = false
protected
◆ ProfileIsMD5
bool llvm::sampleprof::SampleProfileReader::ProfileIsMD5 = false
protected
◆ ProfileIsPreInlined
bool llvm::sampleprof::SampleProfileReader::ProfileIsPreInlined = false
protected
◆ ProfileIsProbeBased
bool llvm::sampleprof::SampleProfileReader::ProfileIsProbeBased = false
protected
◆ ProfilesMap every function to its associated profile.
The profile of every function executed at runtime is collected in the structure FunctionSamples . This maps function objects to their corresponding profiles.
Definition at line 530 of file SampleProfReader.h .
Referenced by computeSummary() , dump() , dumpJson() , getProfiles() , getSamplesFor() , read() , read() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata() , llvm::sampleprof::SampleProfileReaderBinary::readFuncProfile() , llvm::sampleprof::SampleProfileReaderBinary::readFuncProfile() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncProfiles() , llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncProfiles() , llvm::sampleprof::SampleProfileReaderText::readImpl() , llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile() , and SampleProfileReader() .
◆ ProfileSecRange◆ ReadVTableProf
bool llvm::sampleprof::SampleProfileReader::ReadVTableProf = false
protected
◆ Remapper◆ SkipFlatProf
bool llvm::sampleprof::SampleProfileReader::SkipFlatProf = false
protected
◆ Summary
std::unique_ptr<ProfileSummary > llvm::sampleprof::SampleProfileReader::Summary
protected
The documentation for this class was generated from the following files: