LLVM 22.0.0git
llvm::DebugCounter Class Reference

#include "llvm/Support/DebugCounter.h"

Classes

struct  Chunk
struct  CounterInfo
struct  CounterState

Public Types

typedef UniqueVector< std::string > CounterVector

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
unsigned getCounterId (const std::string &Name) const
unsigned int getNumCounters () const
std::pair< std::string, std::string > getCounterInfo (unsigned ID) const
CounterVector::const_iterator begin () const
CounterVector::const_iterator end () const

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 unsigned registerCounter (StringRef Name, StringRef Desc)
static LLVM_ABI bool shouldExecuteImpl (unsigned CounterName)
static bool shouldExecute (unsigned CounterName)
static bool isCounterSet (unsigned ID)
static CounterState getCounterState (unsigned ID)
static void setCounterState (unsigned ID, CounterState State)
static void enableAllCounters ()
static bool isCountingEnabled ()

Protected Member Functions

unsigned addCounter (const std::string &Name, const std::string &Desc)

Protected Attributes

DenseMap< unsigned, CounterInfoCounters
CounterVector RegisteredCounters
bool Enabled = false
bool ShouldPrintCounter = false
bool BreakOnLast = false

Detailed Description

Definition at line 57 of file DebugCounter.h.

Member Typedef Documentation

◆ CounterVector

Definition at line 143 of file DebugCounter.h.

Member Function Documentation

◆ addCounter()

unsigned llvm::DebugCounter::addCounter ( const std::string & Name,
const std::string & Desc )
inlineprotected

Definition at line 166 of file DebugCounter.h.

References llvm::CallingConv::C, Counters, and RegisteredCounters.

Referenced by registerCounter().

◆ begin()

CounterVector::const_iterator llvm::DebugCounter::begin ( ) const
inline

Definition at line 144 of file DebugCounter.h.

References RegisteredCounters.

◆ dump()

LLVM_DUMP_METHOD void DebugCounter::dump ( ) const

Definition at line 257 of file DebugCounter.cpp.

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

◆ enableAllCounters()

void llvm::DebugCounter::enableAllCounters ( )
inlinestatic

Definition at line 154 of file DebugCounter.h.

References Enabled, and instance().

Referenced by push_back().

◆ end()

CounterVector::const_iterator llvm::DebugCounter::end ( ) const
inline

Definition at line 147 of file DebugCounter.h.

References RegisteredCounters.

◆ getCounterId()

unsigned llvm::DebugCounter::getCounterId ( const std::string & Name) const
inline

Definition at line 130 of file DebugCounter.h.

References RegisteredCounters.

Referenced by print(), and push_back().

◆ getCounterInfo()

std::pair< std::string, std::string > llvm::DebugCounter::getCounterInfo ( unsigned ID) const
inline

Definition at line 138 of file DebugCounter.h.

References Counters, and RegisteredCounters.

◆ getCounterState()

CounterState llvm::DebugCounter::getCounterState ( unsigned ID)
inlinestatic

Definition at line 107 of file DebugCounter.h.

References assert(), and instance().

◆ getNumCounters()

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

Definition at line 135 of file DebugCounter.h.

References RegisteredCounters.

◆ instance()

DebugCounter & DebugCounter::instance ( )
static

◆ isCounterSet()

bool llvm::DebugCounter::isCounterSet ( unsigned ID)
inlinestatic

Definition at line 97 of file DebugCounter.h.

References Counters, and instance().

◆ isCountingEnabled()

bool llvm::DebugCounter::isCountingEnabled ( )
inlinestatic

Definition at line 156 of file DebugCounter.h.

References Enabled, instance(), and ShouldPrintCounter.

Referenced by shouldExecute().

◆ parseChunks()

◆ print()

void DebugCounter::print ( raw_ostream & OS) const

◆ printChunks()

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

Definition at line 19 of file DebugCounter.cpp.

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

Referenced by print().

◆ push_back()

◆ registerCounter()

unsigned llvm::DebugCounter::registerCounter ( StringRef Name,
StringRef Desc )
inlinestatic

Definition at line 83 of file DebugCounter.h.

References addCounter(), and instance().

◆ setCounterState()

void llvm::DebugCounter::setCounterState ( unsigned ID,
CounterState State )
inlinestatic

Definition at line 115 of file DebugCounter.h.

References instance().

◆ shouldExecute()

◆ shouldExecuteImpl()

bool DebugCounter::shouldExecuteImpl ( unsigned CounterName)
static

Member Data Documentation

◆ BreakOnLast

bool llvm::DebugCounter::BreakOnLast = false
protected

Definition at line 191 of file DebugCounter.h.

◆ Counters

DenseMap<unsigned, CounterInfo> llvm::DebugCounter::Counters
protected

Definition at line 182 of file DebugCounter.h.

Referenced by addCounter(), getCounterInfo(), isCounterSet(), and push_back().

◆ Enabled

bool llvm::DebugCounter::Enabled = false
protected

Definition at line 187 of file DebugCounter.h.

Referenced by enableAllCounters(), and isCountingEnabled().

◆ RegisteredCounters

CounterVector llvm::DebugCounter::RegisteredCounters
protected

Definition at line 183 of file DebugCounter.h.

Referenced by addCounter(), begin(), end(), getCounterId(), getCounterInfo(), getNumCounters(), and print().

◆ ShouldPrintCounter

bool llvm::DebugCounter::ShouldPrintCounter = false
protected

Definition at line 189 of file DebugCounter.h.

Referenced by isCountingEnabled().


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