52 std::map<std::string,TCallData>
m_data;
62 double min_t,
max_t,mean_t,total_t;
68 void getStats(std::map<std::string,TCallStats> &out_stats)
const;
70 void clear(
bool deep_clear=
false);
71 void enable(
bool enabled =
true) { m_enabled = enabled; }
77 inline void enter(
const char *func_name ) {
82 inline double leave(
const char *func_name ) {
83 return m_enabled ? do_leave(func_name) : 0;
This base class provides a common printf-like method to send debug information to std::cout,...
This class implements a high-performance stopwatch.
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
void dumpAllStats(const size_t column_width=80) const
Dump all stats through the CDebugOutputCapable interface.
double do_leave(const char *func_name)
void registerUserMeasure(const char *event_name, const double value)
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" wit...
void getStats(std::map< std::string, TCallStats > &out_stats) const
Returns all the current stats as a map: section_name => stats.
void clear(bool deep_clear=false)
Resets all stats. By default (deep_clear=false), all section names are remembered (not freed) so the ...
void enter(const char *func_name)
Start of a named section.
std::map< std::string, TCallData > m_data
void enable(bool enabled=true)
CTimeLogger(bool enabled=true)
virtual ~CTimeLogger()
Default constructor.
double leave(const char *func_name)
End of a named section.
std::string getStatsAsText(const size_t column_width=80) const
Dump all stats to a multi-line text string.
void do_enter(const char *func_name)
void saveToCSVFile(const std::string &csv_file) const
Dump all stats to a Comma Separated Values (CSV) file.
#define MRPT_NO_THROWS
Used after member declarations.
void BASE_IMPEXP global_profiler_enter(const char *func_name) MRPT_NO_THROWS
void BASE_IMPEXP global_profiler_leave(const char *func_name) MRPT_NO_THROWS
CTimeLogger BASE_IMPEXP global_profiler
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::stack< double, std::vector< double > > open_calls
Data of each call section: # of calls, minimum, maximum, average and overall execution time (in secon...
A safe way to call enter() and leave() of a mrpt::utils::CTimeLogger upon construction and destructio...
const char * m_section_name
CTimeLoggerEntry(CTimeLogger &logger, const char *section_name)