Struct CTimeLoggerEntry

Struct Documentation

struct CTimeLoggerEntry

A safe way to call enter() and leave() of a mrpt::system::CTimeLogger upon construction and destruction of this auxiliary object, making sure that leave() will be called upon exceptions, etc. Usage mode #1 (scoped):

CTimeLogger logger;
// ...
{ // Start of scope to be monitorized
   CTimeLoggerEntry tle(logger,"operation-name");

   // do whatever

} // End of scope
// **DO NOT** call tle.stop() explicitly here, it's called by its dtor

Usage mode #2 (unscoped):

CTimeLogger logger;
// ...

CTimeLoggerEntry tle(logger,"operation-name");
// do whatever
tle.stop();

// tle dtor does nothing else, since you already called stop()

Public Functions

CTimeLoggerEntry(const CTimeLogger &logger, const std::string_view &section_name)
~CTimeLoggerEntry()
void stop()

for correct use, see docs for CTimeLoggerEntry

Public Members

CTimeLogger &m_logger