LLVM 24.0.0git
llvm::sampleprof::SampleProfileNameTable Class Referenceabstract

Sample-based profile reader. More...

#include "llvm/ProfileData/SampleProfReader.h"

Inheritance diagram for llvm::sampleprof::SampleProfileNameTable:
[legend]

Classes

class  iterator

Public Types

using const_iterator = iterator

Public Member Functions

 SampleProfileNameTable ()=default
 SampleProfileNameTable (const SampleProfileNameTable &)=delete
 SampleProfileNameTable (SampleProfileNameTable &&)=delete
SampleProfileNameTableoperator= (const SampleProfileNameTable &)=delete
SampleProfileNameTableoperator= (SampleProfileNameTable &&)=delete
virtual ~SampleProfileNameTable ()=default
virtual size_t size () const =0
bool empty () const
virtual FunctionId operator[] (size_t Idx) const =0
iterator begin () const
iterator end () const

Detailed 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. Manages the sample profile name table, supporting both an eagerly loaded std::vector of FunctionId objects and lazy-loaded MD5 hashes read directly from the memory-mapped buffer. It enforces the exclusivity of these two formats and provides a unified read-only container interface.

Definition at line 353 of file SampleProfReader.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ SampleProfileNameTable() [1/3]

llvm::sampleprof::SampleProfileNameTable::SampleProfileNameTable ( )
default

◆ SampleProfileNameTable() [2/3]

llvm::sampleprof::SampleProfileNameTable::SampleProfileNameTable ( const SampleProfileNameTable & )
delete

◆ SampleProfileNameTable() [3/3]

llvm::sampleprof::SampleProfileNameTable::SampleProfileNameTable ( SampleProfileNameTable && )
delete

◆ ~SampleProfileNameTable()

virtual llvm::sampleprof::SampleProfileNameTable::~SampleProfileNameTable ( )
virtualdefault

Member Function Documentation

◆ begin()

iterator llvm::sampleprof::SampleProfileNameTable::begin ( ) const
inline

Definition at line 397 of file SampleProfReader.h.

◆ empty()

bool llvm::sampleprof::SampleProfileNameTable::empty ( ) const
inline

Definition at line 394 of file SampleProfReader.h.

References size().

◆ end()

iterator llvm::sampleprof::SampleProfileNameTable::end ( ) const
inline

Definition at line 398 of file SampleProfReader.h.

References size().

◆ operator=() [1/2]

SampleProfileNameTable & llvm::sampleprof::SampleProfileNameTable::operator= ( const SampleProfileNameTable & )
delete

◆ operator=() [2/2]

SampleProfileNameTable & llvm::sampleprof::SampleProfileNameTable::operator= ( SampleProfileNameTable && )
delete

◆ operator[]()

virtual FunctionId llvm::sampleprof::SampleProfileNameTable::operator[] ( size_t Idx) const
pure virtual

◆ size()

virtual size_t llvm::sampleprof::SampleProfileNameTable::size ( ) const
pure virtual

The documentation for this class was generated from the following file: