struct mrpt::system::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()
#include <mrpt/system/CTimeLogger.h>

struct CTimeLoggerEntry
{
    //
fields

    CTimeLogger& m_logger;

    // construction

    CTimeLoggerEntry(
        const CTimeLogger& logger,
        const std::string_view& section_name
        );

    //
methods

    void stop();
};

Methods

void stop()

for correct use, see docs for CTimeLoggerEntry