MIRA
Public Member Functions | List of all members
LogTimer Class Reference

Class that can be used as a stop watch to measure execution time of operations. More...

#include <error/LogTimer.h>

Public Member Functions

 LogTimer (SeverityLevel level, const char *name, const Time &time, const char *file, int line, const char *function, ThreadID threadID, const std::string &caption)
 Constructor taking details for a log entry. More...
 
 ~LogTimer ()
 Destructor. More...
 
Duration peek () const
 Use this function to trace the time consumed since the start of this timer. More...
 
void end ()
 This function can be called to end tracing at a defined point before destruction. More...
 

Detailed Description

Class that can be used as a stop watch to measure execution time of operations.

Never use this class directly use the R_LOGTIMER macro instead. An instance of this class will automatically write a log entry on construction and an entry on destruction counting the time between both. e.g.

{
MIRA_LOGTIMER(DEBUG, MyTimer, "I watch you")
callLengthyOperation();
}

will produce LOGENTRY MyTimer[I watch you] started. LOGENTRY MyTimer[I watch you] ended taking 00:00:00.531772

Constructor & Destructor Documentation

◆ LogTimer()

LogTimer ( SeverityLevel  level,
const char *  name,
const Time time,
const char *  file,
int  line,
const char *  function,
ThreadID  threadID,
const std::string &  caption 
)

Constructor taking details for a log entry.

◆ ~LogTimer()

~LogTimer ( )

Destructor.

Member Function Documentation

◆ peek()

Duration peek ( ) const

Use this function to trace the time consumed since the start of this timer.

◆ end()

void end ( )

This function can be called to end tracing at a defined point before destruction.

If this function is called no log is created upon destruction.


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