MLIR
20.0.0git
|
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... | |
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.
DebugCounter::DebugCounter | ( | ) |
Definition at line 46 of file DebugCounter.cpp.
DebugCounter::~DebugCounter | ( | ) |
Definition at line 48 of file DebugCounter.cpp.
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.
|
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().
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().
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().
|
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().