class SampleProfileReaderGCC
Declaration
class SampleProfileReaderGCC : public SampleProfileReader { /* full declaration omitted */ };
Description
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: 1. The total number of samples collected in F. 2. 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.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:691
Inherits from: SampleProfileReader
Member Variables
- protected llvm::GCOVBuffer GcovBuffer
- GCOV buffer containing the profile.
- protected std::vector<std::string> Names
- Function names in this profile.
- protected static const uint32_t GCOVTagAFDOFileNames = 2852126720U
- GCOV tags used to separate sections in the profile file.
- protected static const uint32_t GCOVTagAFDOFunction = 2885681152U
Inherited from SampleProfileReader:
- protected Profiles
- protected Ctx
- protected Buffer
- protected Summary
- protected Remapper
- protected Format = SPF_None
Method Overview
- public SampleProfileReaderGCC(std::unique_ptr<MemoryBuffer> B, llvm::LLVMContext & C)
- public static bool hasFormat(const llvm::MemoryBuffer & Buffer)
- protected std::error_code readFunctionProfiles()
- public std::error_code readHeader()
- public std::error_code readImpl()
- protected std::error_code readNameTable()
- protected template <typename T>ErrorOr<T> readNumber()
- protected std::error_code readOneFunctionProfile(const llvm::sampleprof::InlineCallStack & InlineStack, bool Update, uint32_t Offset)
- protected std::error_code readSectionTag(uint32_t Expected)
- protected ErrorOr<llvm::StringRef> readString()
- protected std::error_code skipNextWord()
Inherited from SampleProfileReader:
- public collectFuncsFrom
- protected computeSummary
- public create
- public create
- public dump
- public dumpFunctionProfile
- public dumpSectionInfo
- public getBuffer
- public getFormat
- public getNameTable
- public getOrCreateSamplesFor
- public getProfileSymbolList
- public getProfiles
- public getSamplesFor
- public getSamplesFor
- public getSummary
- public read
- public readHeader
- public readImpl
- public reportError
- protected takeSummary
Methods
¶SampleProfileReaderGCC(
std::unique_ptr<MemoryBuffer> B,
llvm::LLVMContext& C)
SampleProfileReaderGCC(
std::unique_ptr<MemoryBuffer> B,
llvm::LLVMContext& C)
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:693
Parameters
- std::unique_ptr<MemoryBuffer> B
- llvm::LLVMContext& C
¶static bool hasFormat(
const llvm::MemoryBuffer& Buffer)
static bool hasFormat(
const llvm::MemoryBuffer& Buffer)
Description
Return true if \p Buffer is in the format supported by this class.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:704
Parameters
- const llvm::MemoryBuffer& Buffer
¶std::error_code readFunctionProfiles()
std::error_code readFunctionProfiles()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:710
¶std::error_code readHeader()
std::error_code readHeader()
Description
Read and validate the file header.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:698
¶std::error_code readImpl()
std::error_code readImpl()
Description
Read sample profiles from the associated file.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:701
¶std::error_code readNameTable()
std::error_code readNameTable()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:707
¶template <typename T>
ErrorOr<T> readNumber()
template <typename T>
ErrorOr<T> readNumber()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:712
Templates
- T
¶std::error_code readOneFunctionProfile(
const llvm::sampleprof::InlineCallStack&
InlineStack,
bool Update,
uint32_t Offset)
std::error_code readOneFunctionProfile(
const llvm::sampleprof::InlineCallStack&
InlineStack,
bool Update,
uint32_t Offset)
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:708
Parameters
- const llvm::sampleprof::InlineCallStack& InlineStack
- bool Update
- uint32_t Offset
¶std::error_code readSectionTag(uint32_t Expected)
std::error_code readSectionTag(uint32_t Expected)
Description
Read the section tag and check that it's the same as \p Expected.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:716
Parameters
- uint32_t Expected
¶ErrorOr<llvm::StringRef> readString()
ErrorOr<llvm::StringRef> readString()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:713
¶std::error_code skipNextWord()
std::error_code skipNextWord()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:711