LLVM 23.0.0git
llvm::sampleprof::NameTableIterator Class Reference

Sample-based profile reader. More...

#include "llvm/ProfileData/SampleProfReader.h"

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

Public Member Functions

 NameTableIterator ()=default
 NameTableIterator (const FunctionId *P)
bool operator== (const NameTableIterator &RHS) const
NameTableIteratoroperator++ ()
FunctionId operator* () const
Public Member Functions inherited from llvm::iterator_facade_base< NameTableIterator, std::input_iterator_tag, FunctionId, std::ptrdiff_t, const FunctionId *, FunctionId >
NameTableIterator operator+ (std::ptrdiff_t n) const
NameTableIterator operator- (std::ptrdiff_t n) const
NameTableIteratoroperator++ ()
NameTableIteratoroperator-- ()
bool operator!= (const NameTableIterator &RHS) const
bool operator> (const NameTableIterator &RHS) const
bool operator<= (const NameTableIterator &RHS) const
bool operator>= (const NameTableIterator &RHS) const
PointerProxy operator-> () const
ReferenceProxy operator[] (std::ptrdiff_t n) const

Additional Inherited Members

Public Types inherited from llvm::iterator_facade_base< NameTableIterator, std::input_iterator_tag, FunctionId, std::ptrdiff_t, const FunctionId *, FunctionId >
enum  
using iterator_category
using value_type
using difference_type
using pointer
using reference

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. NameTableIterator is a lightweight, self-contained input iterator designed to stream FunctionId symbols from an eagerly populated contiguous buffer of FunctionId objects.

Definition at line 350 of file SampleProfReader.h.

Constructor & Destructor Documentation

◆ NameTableIterator() [1/2]

llvm::sampleprof::NameTableIterator::NameTableIterator ( )
default

Referenced by operator++(), and operator==().

◆ NameTableIterator() [2/2]

llvm::sampleprof::NameTableIterator::NameTableIterator ( const FunctionId * P)
inline

Definition at line 358 of file SampleProfReader.h.

References P.

Member Function Documentation

◆ operator*()

FunctionId llvm::sampleprof::NameTableIterator::operator* ( ) const
inline

Definition at line 367 of file SampleProfReader.h.

◆ operator++()

NameTableIterator & llvm::sampleprof::NameTableIterator::operator++ ( )
inline

Definition at line 362 of file SampleProfReader.h.

References NameTableIterator().

◆ operator==()

bool llvm::sampleprof::NameTableIterator::operator== ( const NameTableIterator & RHS) const
inline

Definition at line 360 of file SampleProfReader.h.

References NameTableIterator(), and RHS.


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