class SampleProfileReaderCompactBinary
Declaration
class SampleProfileReaderCompactBinary
: public SampleProfileReaderBinary { /* 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:807
Inherits from: SampleProfileReaderBinary
Member Variables
- private std::vector<std::string> NameTable
- Function name table.
- private DenseMap<llvm::StringRef, uint64_t> FuncOffsetTable
- The table mapping from function name to the offset of its FunctionSample towards file start.
- private DenseSet<llvm::StringRef> FuncsToUse
- The set containing the functions to use when compiling a module.
Inherited from SampleProfileReaderBinary:
- protected Data = nullptr
- protected End = nullptr
- protected NameTable
Inherited from SampleProfileReader:
- protected Profiles
- protected Ctx
- protected Buffer
- protected MD5NameBuffer
- protected Summary
- protected Remapper
- protected ProfileIsProbeBased = false
- protected ProfileIsCS = false
- protected ProfileIsPreInlined = false
- protected CSProfileCount = 0
- protected ProfileIsFS = false
- protected Format = SPF_None
- protected M = nullptr
- protected MaskedBitFrom = 31
Method Overview
- public SampleProfileReaderCompactBinary(std::unique_ptr<MemoryBuffer> B, llvm::LLVMContext & C)
- public bool collectFuncsFromModule()
- public static bool hasFormat(const llvm::MemoryBuffer & Buffer)
- private std::error_code readFuncOffsetTable()
- private std::error_code readHeader()
- public std::error_code readImpl()
- private std::error_code readNameTable()
- private ErrorOr<llvm::StringRef> readStringFromTable()
- public bool useMD5()
- private std::error_code verifySPMagic(uint64_t Magic)
Inherited from SampleProfileReaderBinary:
- protected at_eof
- public getNameTable
- protected readFuncProfile
- public readHeader
- public readImpl
- protected readMagicIdent
- protected readNameTable
- protected readNumber
- protected readProfile
- protected readSampleContextFromTable
- protected readString
- protected readStringFromTable
- protected readStringIndex
- protected readSummary
- protected readUnencodedNumber
Inherited from SampleProfileReader:
- public collectFuncsFromModule
- protected computeSummary
- public create
- public create
- public dump
- public dumpFunctionProfile
- public dumpSectionInfo
- public getBuffer
- public getDiscriminatorMask
- public getFormat
- public getNameTable
- public getOrCreateSamplesFor
- public getProfileSymbolList
- public getProfiles
- public getRemapper
- public getSamplesFor
- public getSamplesFor
- public getSummary
- public hasUniqSuffix
- public profileIsCS
- public profileIsPreInlined
- public profileIsProbeBased
- public read
- public readHeader
- public readImpl
- public reportError
- public setDiscriminatorMaskedBitFrom
- public setModule
- public setSkipFlatProf
- protected takeSummary
- public useMD5
Methods
¶SampleProfileReaderCompactBinary(
std::unique_ptr<MemoryBuffer> B,
llvm::LLVMContext& C)
SampleProfileReaderCompactBinary(
std::unique_ptr<MemoryBuffer> B,
llvm::LLVMContext& C)
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:824
Parameters
- std::unique_ptr<MemoryBuffer> B
- llvm::LLVMContext& C
¶bool collectFuncsFromModule()
bool collectFuncsFromModule()
Description
Collect functions with definitions in Module M. Return true if the reader has been given a module.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:836
¶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:829
Parameters
- const llvm::MemoryBuffer& Buffer
¶std::error_code readFuncOffsetTable()
std::error_code readFuncOffsetTable()
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:821
¶std::error_code readHeader()
std::error_code readHeader()
Description
Read and validate the file header.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:820
¶std::error_code readImpl()
std::error_code readImpl()
Description
Read samples only for functions to use.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:832
¶std::error_code readNameTable()
std::error_code readNameTable()
Description
Read the whole name table.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:817
¶ErrorOr<llvm::StringRef> readStringFromTable()
ErrorOr<llvm::StringRef> readStringFromTable()
Description
Read a string indirectly via the name table.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:819
¶bool useMD5()
bool useMD5()
Description
Return whether names in the profile are all MD5 numbers.
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:839
¶std::error_code verifySPMagic(uint64_t Magic)
std::error_code verifySPMagic(uint64_t Magic)
Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:816
Parameters
- uint64_t Magic