MLIR  19.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
mlir::tracing::DebugCounter Class Reference

This class implements an action handler that attaches a counter value to debug actions and enables/disables execution of these action based on the value of the counter. More...

#include "mlir/Debug/Counter.h"

Public Member Functions

 DebugCounter ()
 
 ~DebugCounter ()
 
void addCounter (StringRef actionTag, int64_t countToSkip, int64_t countToStopAfter)
 Add a counter for the given action tag. More...
 
void operator() (llvm::function_ref< void()> transform, const Action &action)
 Entry point for handling actions. More...
 
void print (raw_ostream &os) const
 Print the counters that have been registered with this instance to the provided output stream. More...
 

Static Public Member Functions

static void registerCLOptions ()
 Register the command line options for debug counters. More...
 
static bool isActivated ()
 Returns true if any of the CL options are activated. More...
 

Detailed Description

This class implements an action handler that attaches a counter value to debug actions and enables/disables execution of these action based on the value of the counter.

The counter controls the execution of the action with a "skip" and "count" value. The "skip" value is used to skip a certain number of initial executions of an action. The "count" value is used to prevent an action from executing after it has executed for a set number of times (not including any executions that have been skipped). For example, a counter for an action with skip=47 and count=2, would skip the first 47 executions, then execute twice, and finally prevent any further executions.

Definition at line 29 of file Counter.h.

Constructor & Destructor Documentation

◆ DebugCounter()

DebugCounter::DebugCounter ( )

Definition at line 46 of file DebugCounter.cpp.

◆ ~DebugCounter()

DebugCounter::~DebugCounter ( )

Definition at line 48 of file DebugCounter.cpp.

References clOptions, and print().

Member Function Documentation

◆ addCounter()

void DebugCounter::addCounter ( StringRef  actionTag,
int64_t  countToSkip,
int64_t  countToStopAfter 
)

Add a counter for the given action tag.

Add a counter for the given debug action tag.

countToSkip is the number of counter executions to skip before enabling execution of the action. countToStopAfter is the number of executions of the counter to allow before preventing the action from executing any more.

Definition at line 58 of file DebugCounter.cpp.

◆ isActivated()

bool DebugCounter::isActivated ( )
static

Returns true if any of the CL options are activated.

Definition at line 117 of file DebugCounter.cpp.

References clOptions.

Referenced by mlir::tracing::InstallDebugHandler::Impl::Impl().

◆ operator()()

void DebugCounter::operator() ( llvm::function_ref< void()>  transform,
const Action action 
)

Entry point for handling actions.

Definition at line 65 of file DebugCounter.cpp.

References mlir::tracing::Action::getTag().

◆ print()

void DebugCounter::print ( raw_ostream &  os) const

Print the counters that have been registered with this instance to the provided output stream.

Definition at line 91 of file DebugCounter.cpp.

Referenced by ~DebugCounter().

◆ registerCLOptions()

void DebugCounter::registerCLOptions ( )
static

Register the command line options for debug counters.

Register a set of useful command-line options that can be used to configure various flags within the DebugCounter.

These flags are used when constructing a DebugCounter for initialization.

Definition at line 112 of file DebugCounter.cpp.

References clOptions.

Referenced by mlir::registerAndParseCLIOptions().


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