LLVM 17.0.0git
|
Reader for the raw instrprof binary format from runtime. More...
#include "llvm/ProfileData/InstrProfReader.h"
Public Member Functions | |
RawInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer, const InstrProfCorrelator *Correlator) | |
RawInstrProfReader (const RawInstrProfReader &)=delete | |
RawInstrProfReader & | operator= (const RawInstrProfReader &)=delete |
Error | readHeader () override |
Read the header. Required before reading first record. | |
Error | readNextRecord (NamedInstrProfRecord &Record) override |
Read a single record. | |
Error | readBinaryIds (std::vector< llvm::object::BuildID > &BinaryIds) override |
Read a list of binary ids. | |
Error | printBinaryIds (raw_ostream &OS) override |
Print binary ids. | |
uint64_t | getVersion () const override |
Return the profile version. | |
bool | isIRLevelProfile () const override |
bool | hasCSIRLevelProfile () const override |
bool | instrEntryBBEnabled () const override |
bool | useDebugInfoCorrelate () const override |
Return true if we must provide debug info to create PGO profiles. | |
bool | hasSingleByteCoverage () const override |
Return true if the profile has single byte counters representing coverage. | |
bool | functionEntryOnly () const override |
Return true if the profile only instruments function entries. | |
bool | hasMemoryProfile () const override |
Return true if profile includes a memory profile. | |
InstrProfKind | getProfileKind () const override |
Returns a BitsetEnum describing the attributes of the raw instr profile. | |
InstrProfSymtab & | getSymtab () override |
Return the PGO symtab. | |
![]() | |
InstrProfReader ()=default | |
virtual | ~InstrProfReader ()=default |
virtual Error | readHeader ()=0 |
Read the header. Required before reading first record. | |
virtual Error | readNextRecord (NamedInstrProfRecord &Record)=0 |
Read a single record. | |
virtual Error | readBinaryIds (std::vector< llvm::object::BuildID > &BinaryIds) |
Read a list of binary ids. | |
virtual Error | printBinaryIds (raw_ostream &OS) |
Print binary ids. | |
InstrProfIterator | begin () |
Iterator over profile data. | |
InstrProfIterator | end () |
virtual uint64_t | getVersion () const =0 |
Return the profile version. | |
virtual bool | isIRLevelProfile () const =0 |
virtual bool | hasCSIRLevelProfile () const =0 |
virtual bool | instrEntryBBEnabled () const =0 |
virtual bool | useDebugInfoCorrelate () const |
Return true if we must provide debug info to create PGO profiles. | |
virtual bool | hasSingleByteCoverage () const =0 |
Return true if the profile has single byte counters representing coverage. | |
virtual bool | functionEntryOnly () const =0 |
Return true if the profile only instruments function entries. | |
virtual bool | hasMemoryProfile () const =0 |
Return true if profile includes a memory profile. | |
virtual InstrProfKind | getProfileKind () const =0 |
Returns a BitsetEnum describing the attributes of the profile. | |
virtual InstrProfSymtab & | getSymtab ()=0 |
Return the PGO symtab. | |
void | accumulateCounts (CountSumOrPercent &Sum, bool IsCS) |
Compute the sum of counts and return in Sum. | |
bool | isEOF () |
Return true if the reader has finished reading the profile data. | |
bool | hasError () |
Return true if the reader encountered an error reading profiling data. | |
Error | getError () |
Get the current error. | |
Static Public Member Functions | |
static bool | hasFormat (const MemoryBuffer &DataBuffer) |
![]() | |
static Expected< std::unique_ptr< InstrProfReader > > | create (const Twine &Path, vfs::FileSystem &FS, const InstrProfCorrelator *Correlator=nullptr) |
Factory method to create an appropriately typed reader for the given instrprof file. | |
static Expected< std::unique_ptr< InstrProfReader > > | create (std::unique_ptr< MemoryBuffer > Buffer, const InstrProfCorrelator *Correlator=nullptr) |
Additional Inherited Members | |
![]() | |
Error | error (instrprof_error Err, const std::string &ErrMsg="") |
Set the current error and return same. | |
Error | error (Error &&E) |
Error | success () |
Clear the current error and return a successful one. | |
![]() | |
std::unique_ptr< InstrProfSymtab > | Symtab |
Reader for the raw instrprof binary format from runtime.
This format is a raw memory dump of the instrumentation-based profiling data from the runtime. It has no index.
Templated on the unsigned type whose size matches pointers on the platform that wrote the profile.
Definition at line 284 of file InstrProfReader.h.
|
inline |
Definition at line 316 of file InstrProfReader.h.
|
delete |
|
inlineoverridevirtual |
Return true if the profile only instruments function entries.
Implements llvm::InstrProfReader.
Definition at line 352 of file InstrProfReader.h.
|
overridevirtual |
Returns a BitsetEnum describing the attributes of the raw instr profile.
Implements llvm::InstrProfReader.
Definition at line 397 of file InstrProfReader.cpp.
References getProfileKindFromVersion().
|
inlineoverridevirtual |
Return the PGO symtab.
There are three different readers: Raw, Text, and Indexed profile readers. The first two types of readers are used only by llvm-profdata tool, while the indexed profile reader is also used by llvm-cov tool and the compiler ( backend or frontend). Since creating PGO symtab can create significant runtime and memory overhead (as it touches data for the whole program), InstrProfSymtab for the indexed profile reader should be created on demand and it is recommended to be only used for dumping purpose with llvm-proftool, not with the compiler.
Implements llvm::InstrProfReader.
Definition at line 365 of file InstrProfReader.h.
References assert(), and llvm::InstrProfReader::Symtab.
|
inlineoverridevirtual |
Return the profile version.
Implements llvm::InstrProfReader.
Definition at line 330 of file InstrProfReader.h.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 336 of file InstrProfReader.h.
|
static |
Definition at line 402 of file InstrProfReader.cpp.
References llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), and llvm::sys::getSwappedBytes().
Referenced by llvm::InstrProfReader::create().
|
inlineoverridevirtual |
Return true if profile includes a memory profile.
Implements llvm::InstrProfReader.
Definition at line 356 of file InstrProfReader.h.
References assert().
|
inlineoverridevirtual |
Return true if the profile has single byte counters representing coverage.
Implements llvm::InstrProfReader.
Definition at line 348 of file InstrProfReader.h.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 340 of file InstrProfReader.h.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 332 of file InstrProfReader.h.
|
delete |
|
overridevirtual |
Print binary ids.
Reimplemented from llvm::InstrProfReader.
Definition at line 664 of file InstrProfReader.cpp.
References OS, and printBinaryIdsInternal().
|
overridevirtual |
Read a list of binary ids.
Reimplemented from llvm::InstrProfReader.
Definition at line 657 of file InstrProfReader.cpp.
References readBinaryIdsInternal().
Read the header. Required before reading first record.
Implements llvm::InstrProfReader.
Definition at line 412 of file InstrProfReader.cpp.
References llvm::bad_header, llvm::bad_magic, and error.
|
overridevirtual |
Read a single record.
Implements llvm::InstrProfReader.
Definition at line 627 of file InstrProfReader.cpp.
References E, error, and llvm::success.
|
inlineoverridevirtual |
Return true if we must provide debug info to create PGO profiles.
Reimplemented from llvm::InstrProfReader.
Definition at line 344 of file InstrProfReader.h.