MRPT  2.0.2
List of all members | Public Member Functions | Public Attributes | Private Attributes
mrpt::system::CTimeLoggerEntry Struct Reference

Detailed Description

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()

Definition at line 189 of file system/CTimeLogger.h.

#include <mrpt/system/CTimeLogger.h>

Public Member Functions

 CTimeLoggerEntry (const CTimeLogger &logger, const std::string_view &section_name)
 
 ~CTimeLoggerEntry ()
 
void stop ()
 for correct use, see docs for CTimeLoggerEntry More...
 

Public Attributes

CTimeLoggerm_logger
 

Private Attributes

const std::string m_section_name
 
mrpt::Clock::time_point m_entry
 
bool stopped_ {false}
 

Constructor & Destructor Documentation

◆ CTimeLoggerEntry()

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

Definition at line 414 of file CTimeLogger.cpp.

References m_entry, and mrpt::Clock::now().

Here is the call graph for this function:

◆ ~CTimeLoggerEntry()

CTimeLoggerEntry::~CTimeLoggerEntry ( )

Definition at line 430 of file CTimeLogger.cpp.

References mrpt::exception_to_str(), and stop().

Here is the call graph for this function:

Member Function Documentation

◆ stop()

void CTimeLoggerEntry::stop ( )

for correct use, see docs for CTimeLoggerEntry

Definition at line 420 of file CTimeLogger.cpp.

References m_entry, m_logger, m_section_name, mrpt::Clock::now(), mrpt::system::CTimeLogger::registerUserMeasure(), stopped_, and mrpt::system::timeDifference().

Referenced by ~CTimeLoggerEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_entry

mrpt::Clock::time_point mrpt::system::CTimeLoggerEntry::m_entry
private

Definition at line 201 of file system/CTimeLogger.h.

Referenced by CTimeLoggerEntry(), and stop().

◆ m_logger

CTimeLogger& mrpt::system::CTimeLoggerEntry::m_logger

Definition at line 194 of file system/CTimeLogger.h.

Referenced by stop().

◆ m_section_name

const std::string mrpt::system::CTimeLoggerEntry::m_section_name
private

Definition at line 200 of file system/CTimeLogger.h.

Referenced by stop().

◆ stopped_

bool mrpt::system::CTimeLoggerEntry::stopped_ {false}
private

Definition at line 202 of file system/CTimeLogger.h.

Referenced by stop().




Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020