LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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

void push_back (const std::string &)
 
LLVM_DUMP_METHOD void dump () const
 
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 void printChunks (raw_ostream &OS, ArrayRef< Chunk >)
 
static bool parseChunks (StringRef Str, SmallVector< Chunk > &Res)
 Return true on parsing error and print the error message on the llvm::errs()
 
static DebugCounterinstance ()
 Returns a reference to the singleton instance.
 
static unsigned registerCounter (StringRef Name, StringRef Desc)
 
static 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 56 of file DebugCounter.h.

Member Typedef Documentation

◆ CounterVector

Definition at line 140 of file DebugCounter.h.

Member Function Documentation

◆ addCounter()

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

Definition at line 163 of file DebugCounter.h.

References Counters, llvm::UniqueVector< T >::insert(), Name, and RegisteredCounters.

Referenced by registerCounter().

◆ begin()

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

Definition at line 141 of file DebugCounter.h.

References llvm::UniqueVector< T >::begin(), and RegisteredCounters.

◆ dump()

LLVM_DUMP_METHOD void DebugCounter::dump ( ) const

Definition at line 250 of file DebugCounter.cpp.

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

◆ enableAllCounters()

static void llvm::DebugCounter::enableAllCounters ( )
inlinestatic

Definition at line 151 of file DebugCounter.h.

References Enabled, and instance().

Referenced by push_back().

◆ end()

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

Definition at line 144 of file DebugCounter.h.

References llvm::UniqueVector< T >::end(), and RegisteredCounters.

◆ getCounterId()

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

Definition at line 127 of file DebugCounter.h.

References llvm::UniqueVector< T >::idFor(), Name, and RegisteredCounters.

Referenced by print(), and push_back().

◆ getCounterInfo()

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

Definition at line 135 of file DebugCounter.h.

References Counters, and RegisteredCounters.

◆ getCounterState()

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

Definition at line 106 of file DebugCounter.h.

References assert(), and instance().

◆ getNumCounters()

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

Definition at line 132 of file DebugCounter.h.

References RegisteredCounters, and llvm::UniqueVector< T >::size().

◆ instance()

DebugCounter & DebugCounter::instance ( )
static

◆ isCounterSet()

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

Definition at line 96 of file DebugCounter.h.

References Counters, and instance().

◆ isCountingEnabled()

static bool llvm::DebugCounter::isCountingEnabled ( )
inlinestatic

Definition at line 153 of file DebugCounter.h.

References Enabled, instance(), and ShouldPrintCounter.

Referenced by shouldExecute().

◆ parseChunks()

bool llvm::DebugCounter::parseChunks ( StringRef  Str,
SmallVector< Chunk > &  Res 
)
static

◆ 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(), and OS.

Referenced by print().

◆ push_back()

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

◆ registerCounter()

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

Definition at line 82 of file DebugCounter.h.

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

◆ setCounterState()

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

◆ shouldExecute()

static bool llvm::DebugCounter::shouldExecute ( unsigned  CounterName)
inlinestatic

◆ shouldExecuteImpl()

bool DebugCounter::shouldExecuteImpl ( unsigned  CounterName)
static

Member Data Documentation

◆ BreakOnLast

bool llvm::DebugCounter::BreakOnLast = false
protected

Definition at line 187 of file DebugCounter.h.

◆ Counters

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

Definition at line 178 of file DebugCounter.h.

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

◆ Enabled

bool llvm::DebugCounter::Enabled = false
protected

Definition at line 183 of file DebugCounter.h.

Referenced by enableAllCounters(), and isCountingEnabled().

◆ RegisteredCounters

CounterVector llvm::DebugCounter::RegisteredCounters
protected

Definition at line 179 of file DebugCounter.h.

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

◆ ShouldPrintCounter

bool llvm::DebugCounter::ShouldPrintCounter = false
protected

Definition at line 185 of file DebugCounter.h.

Referenced by isCountingEnabled().


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