Main MRPT website > C++ reference
MRPT logo
Classes | Public Member Functions | Private Member Functions | Private Attributes

mrpt::utils::CTimeLogger Class Reference


Detailed Description

A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats.

The results can be dumped to cout or to Visual Studio's output panel. Recursive methods are supported with no problems, that is, calling "enter(X) enter(X) ... leave(X) leave(X)".

Note:
The default behavior is dumping all the information at destruction.

Definition at line 47 of file CTimeLogger.h.

#include <mrpt/utils/CTimeLogger.h>

Inheritance diagram for mrpt::utils::CTimeLogger:
Inheritance graph
[legend]

List of all members.

Classes

struct  TCallData
 Data of all the calls: More...

Public Member Functions

 CTimeLogger (bool enabled=true)
virtual ~CTimeLogger ()
 Default constructor.
std::string getStatsAsText (const size_t column_width=80) const
 Dump all stats to a multi-line text string.
void dumpAllStats (const size_t column_width=80) const
 Dump all stats through the CDebugOutputCapable interface.
void clear ()
void enable (bool enabled=true)
void disable ()
void saveToCSVFile (const std::string &csv_file) const
 Dump all stats to a Comma Separated Values (CSV) file.
void enter (const char *func_name)
 Start of a named section.
double leave (const char *func_name)
 End of a named section.
double getMeanTime (const std::string &name) const
 Return the mean execution time of the given "section", or 0 if it hasn't ever been called "enter" with that section name.

Private Member Functions

void do_enter (const char *func_name)
double do_leave (const char *func_name)

Private Attributes

CTicTac m_tictac
bool m_enabled
map< string, TCallDatam_data

Constructor & Destructor Documentation

mrpt::utils::CTimeLogger::CTimeLogger ( bool  enabled = true )
virtual mrpt::utils::CTimeLogger::~CTimeLogger (  ) [virtual]

Default constructor.

Destructor


Member Function Documentation

void mrpt::utils::CTimeLogger::clear (  )
void mrpt::utils::CTimeLogger::disable (  ) [inline]

Definition at line 75 of file CTimeLogger.h.

void mrpt::utils::CTimeLogger::do_enter ( const char *  func_name ) [private]
double mrpt::utils::CTimeLogger::do_leave ( const char *  func_name ) [private]
void mrpt::utils::CTimeLogger::dumpAllStats ( const size_t  column_width = 80 ) const

Dump all stats through the CDebugOutputCapable interface.

See also:
getStatsAsText, saveToCVSFile
void mrpt::utils::CTimeLogger::enable ( bool  enabled = true ) [inline]

Definition at line 74 of file CTimeLogger.h.

void mrpt::utils::CTimeLogger::enter ( const char *  func_name ) [inline]

Start of a named section.

See also:
enter

Definition at line 79 of file CTimeLogger.h.

Referenced by mrpt::bayes::detail::CRunOneKalmanIteration_addNewLandmarks::operator()().

double mrpt::utils::CTimeLogger::getMeanTime ( const std::string &  name ) const

Return the mean execution time of the given "section", or 0 if it hasn't ever been called "enter" with that section name.

std::string mrpt::utils::CTimeLogger::getStatsAsText ( const size_t  column_width = 80 ) const

Dump all stats to a multi-line text string.

See also:
dumpAllStats, saveToCVSFile
double mrpt::utils::CTimeLogger::leave ( const char *  func_name ) [inline]

End of a named section.

Returns:
The ellapsed time, in seconds or 0 if disabled.
See also:
enter

Definition at line 84 of file CTimeLogger.h.

Referenced by mrpt::bayes::detail::CRunOneKalmanIteration_addNewLandmarks::operator()().

void mrpt::utils::CTimeLogger::saveToCSVFile ( const std::string &  csv_file ) const

Dump all stats to a Comma Separated Values (CSV) file.

See also:
dumpAllStats

Member Data Documentation

Definition at line 63 of file CTimeLogger.h.

Definition at line 51 of file CTimeLogger.h.

Definition at line 50 of file CTimeLogger.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011