souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ram::LogTimer Class Reference

Execution time logger for a statement. More...

#include <LogTimer.h>

Inheritance diagram for souffle::ram::LogTimer:
Inheritance graph
Collaboration diagram for souffle::ram::LogTimer:
Collaboration graph

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
LogTimerclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
 LogTimer (Own< Statement > stmt, std::string msg)
 
- Public Member Functions inherited from souffle::ram::Node
bool operator!= (const Node &other) const
 Inequality check for two RAM nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two RAM nodes. More...
 
virtual void rewrite (const Node *oldNode, Own< Node > newNode)
 Rewrite a child node. More...
 
virtual ~Node ()=default
 
- Public Member Functions inherited from souffle::ram::AbstractLog
 AbstractLog (Own< Statement > stmt, std::string msg)
 
void apply (const NodeMapper &map)
 
std::vector< const Node * > getChildNodes () const
 
const std::string & getMessage () const
 Get logging message. More...
 
const StatementgetStatement () const
 Get logging statement. More...
 

Protected Member Functions

void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::Statement
void print (std::ostream &os) const override
 Print RAM node. More...
 
- Protected Member Functions inherited from souffle::ram::Node
virtual bool equal (const Node &) const
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::AbstractLog
bool equal (const Node &node) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Statement
static void print (const Statement *statement, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 
- Protected Attributes inherited from souffle::ram::AbstractLog
const std::string message
 Logging message. More...
 
Own< Statementstatement
 Logging statement. More...
 

Detailed Description

Execution time logger for a statement.

Logs the execution time of a statement. Before and after the execution of the logging statement the wall-clock time is taken to compute the time duration for the statement. Duration and logging message is printed after the execution of the statement.

For example:

START_TIMER "@runtime\;"
BEGIN_STRATUM 0
...
...
END_TIMER

Definition at line 55 of file LogTimer.h.

Constructor & Destructor Documentation

◆ LogTimer()

souffle::ram::LogTimer::LogTimer ( Own< Statement stmt,
std::string  msg 
)
inline

Definition at line 57 of file LogTimer.h.

59 {

Referenced by getChildNodes().

Member Function Documentation

◆ apply()

void souffle::ram::LogTimer::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 67 of file LogTimer.h.

67  :
68  void print(std::ostream& os, int tabpos) const override {
69  os << times(" ", tabpos) << "START_TIMER \"" << stringify(message) << "\"" << std::endl;

References souffle::ram::AbstractLog::message, souffle::ram::Statement::print(), souffle::ram::AbstractLog::statement, souffle::stringify(), and souffle::times().

Here is the call graph for this function:

◆ clone()

LogTimer* souffle::ram::LogTimer::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Statement.

Definition at line 63 of file LogTimer.h.

63  {
65  }

References souffle::ram::AbstractLog::apply(), and souffle::map().

Here is the call graph for this function:

◆ getChildNodes()

std::vector<const Node*> souffle::ram::LogTimer::getChildNodes ( ) const
inlineoverridevirtual

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 59 of file LogTimer.h.

59  {
61  }

References souffle::clone(), LogTimer(), souffle::ram::AbstractLog::message, and souffle::ram::AbstractLog::statement.

Here is the call graph for this function:

◆ print()

void souffle::ram::LogTimer::print ( std::ostream &  os,
int  tabpos 
) const
inlineoverrideprotectedvirtual

Pretty print with indentation.

Implements souffle::ram::Statement.

Definition at line 72 of file LogTimer.h.


The documentation for this class was generated from the following file:
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::ram::AbstractLog::apply
void apply(const NodeMapper &map)
Definition: AbstractLog.h:59
souffle::ram::AbstractLog::message
const std::string message
Logging message.
Definition: AbstractLog.h:74
souffle::ram::LogTimer::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: LogTimer.h:72
souffle::stringify
std::string stringify(const std::string &input)
Stringify a string using escapes for escape, newline, tab, double-quotes and semicolons.
Definition: StringUtil.h:334
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
souffle::ram::LogTimer::LogTimer
LogTimer(Own< Statement > stmt, std::string msg)
Definition: LogTimer.h:57
souffle::ram::AbstractLog::statement
Own< Statement > statement
Logging statement.
Definition: AbstractLog.h:71