LLVM 22.0.0git
llvm::DebugCounter Class Reference

#include "llvm/Support/DebugCounter.h"

Classes

struct  Chunk
class  CounterInfo
 Struct to store counter info. More...
struct  CounterState

Public Member Functions

LLVM_ABI void push_back (const std::string &)
LLVM_DUMP_METHOD void dump () const
LLVM_ABI void print (raw_ostream &OS) const
CounterInfogetCounterInfo (StringRef Name) const
unsigned int getNumCounters () const
std::pair< StringRef, StringRefgetCounterDesc (CounterInfo *Info) const
MapVector< StringRef, CounterInfo * >::const_iterator begin () const
MapVector< StringRef, CounterInfo * >::const_iterator end () const
void activateAllCounters ()

Static Public Member Functions

static LLVM_ABI void printChunks (raw_ostream &OS, ArrayRef< Chunk >)
static LLVM_ABI bool parseChunks (StringRef Str, SmallVector< Chunk > &Res)
 Return true on parsing error and print the error message on the llvm::errs()
static LLVM_ABI DebugCounterinstance ()
 Returns a reference to the singleton instance.
static void registerCounter (CounterInfo *Info)
static LLVM_ABI bool shouldExecuteImpl (CounterInfo &Counter)
static bool shouldExecute (CounterInfo &Counter)
static bool isCounterSet (CounterInfo &Info)
static CounterState getCounterState (CounterInfo &Info)
static void setCounterState (CounterInfo &Info, CounterState State)

Protected Member Functions

void addCounter (CounterInfo *Info)
bool handleCounterIncrement (CounterInfo &Info)

Protected Attributes

MapVector< StringRef, CounterInfo * > Counters
bool ShouldPrintCounter = false
bool ShouldPrintCounterQueries = false
bool BreakOnLast = false

Detailed Description

Definition at line 57 of file DebugCounter.h.

Member Function Documentation

◆ activateAllCounters()

void llvm::DebugCounter::activateAllCounters ( )
inline

Definition at line 167 of file DebugCounter.h.

References _, and Counters.

◆ addCounter()

void llvm::DebugCounter::addCounter ( CounterInfo * Info)
inlineprotected

Definition at line 173 of file DebugCounter.h.

References Counters, and Info.

Referenced by registerCounter().

◆ begin()

MapVector< StringRef, CounterInfo * >::const_iterator llvm::DebugCounter::begin ( ) const
inline

Definition at line 160 of file DebugCounter.h.

References Counters.

◆ dump()

LLVM_DUMP_METHOD void DebugCounter::dump ( ) const

Definition at line 262 of file DebugCounter.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ end()

MapVector< StringRef, CounterInfo * >::const_iterator llvm::DebugCounter::end ( ) const
inline

Definition at line 163 of file DebugCounter.h.

References Counters.

◆ getCounterDesc()

std::pair< StringRef, StringRef > llvm::DebugCounter::getCounterDesc ( CounterInfo * Info) const
inline

Definition at line 155 of file DebugCounter.h.

References Info.

◆ getCounterInfo()

CounterInfo * llvm::DebugCounter::getCounterInfo ( StringRef Name) const
inline

Definition at line 147 of file DebugCounter.h.

References Counters.

Referenced by print(), and push_back().

◆ getCounterState()

CounterState llvm::DebugCounter::getCounterState ( CounterInfo & Info)
inlinestatic

Definition at line 128 of file DebugCounter.h.

References Info.

◆ getNumCounters()

unsigned int llvm::DebugCounter::getNumCounters ( ) const
inline

Definition at line 152 of file DebugCounter.h.

References Counters.

◆ handleCounterIncrement()

bool DebugCounter::handleCounterIncrement ( CounterInfo & Info)
protected

Handle consecutive blocks.

Definition at line 226 of file DebugCounter.cpp.

References BreakOnLast, and LLVM_BUILTIN_DEBUGTRAP.

◆ instance()

DebugCounter & DebugCounter::instance ( )
static

Returns a reference to the singleton instance.

Definition at line 181 of file DebugCounter.cpp.

References Owner.

Referenced by llvm::initDebugCounterOptions(), registerCounter(), and shouldExecuteImpl().

◆ isCounterSet()

bool llvm::DebugCounter::isCounterSet ( CounterInfo & Info)
inlinestatic

Definition at line 120 of file DebugCounter.h.

References Info.

◆ parseChunks()

◆ print()

void DebugCounter::print ( raw_ostream & OS) const

◆ printChunks()

void llvm::DebugCounter::printChunks ( raw_ostream & OS,
ArrayRef< Chunk > Chunks )
static

Definition at line 20 of file DebugCounter.cpp.

References llvm::ArrayRef< T >::empty().

Referenced by print().

◆ push_back()

void DebugCounter::push_back ( const std::string & Val)

◆ registerCounter()

void llvm::DebugCounter::registerCounter ( CounterInfo * Info)
inlinestatic

Definition at line 106 of file DebugCounter.h.

References addCounter(), Info, and instance().

Referenced by llvm::DebugCounter::CounterInfo::CounterInfo().

◆ setCounterState()

void llvm::DebugCounter::setCounterState ( CounterInfo & Info,
CounterState State )
inlinestatic

Definition at line 133 of file DebugCounter.h.

References Info.

◆ shouldExecute()

◆ shouldExecuteImpl()

bool DebugCounter::shouldExecuteImpl ( CounterInfo & Counter)
static

Definition at line 251 of file DebugCounter.cpp.

References llvm::dbgs(), and instance().

Referenced by shouldExecute().

Member Data Documentation

◆ BreakOnLast

bool llvm::DebugCounter::BreakOnLast = false
protected

Definition at line 182 of file DebugCounter.h.

Referenced by handleCounterIncrement().

◆ Counters

MapVector<StringRef, CounterInfo *> llvm::DebugCounter::Counters
protected

◆ ShouldPrintCounter

bool llvm::DebugCounter::ShouldPrintCounter = false
protected

Definition at line 178 of file DebugCounter.h.

◆ ShouldPrintCounterQueries

bool llvm::DebugCounter::ShouldPrintCounterQueries = false
protected

Definition at line 180 of file DebugCounter.h.


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