Go to the documentation of this file.
79 void do_enter(
const std::string_view& func_name) noexcept;
80 double do_leave(
const std::string_view& func_name) noexcept;
92 bool enabled =
true,
const std::string& name =
"",
93 const bool keep_whole_history =
false);
109 void getStats(std::map<std::string, TCallStats>& out_stats)
const;
112 void dumpAllStats(
const size_t column_width = 80)
const;
133 const std::string_view& event_name,
const double value,
134 const bool is_time =
false) noexcept;
140 inline void enter(
const std::string_view& func_name) noexcept
146 inline double leave(
const std::string_view& func_name) noexcept
192 const CTimeLogger& logger,
const std::string_view& section_name);
constexpr static unsigned int HASH_SIZE_IN_BYTES
void deep_clear(CONTAINER &c)
Deep clear for a std vector container.
Data of each call section: # of calls, minimum, maximum, average and overall execution time (in secon...
mrpt::Clock::time_point m_entry
mrpt::system::CTimeLogger & global_profiler_getref() noexcept
A high-performance stopwatch, with typical resolution of nanoseconds.
~CTimeLogger() override
Destructor.
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
std::optional< std::deque< double > > whole_history
constexpr static unsigned int HASH_ALLOWED_COLLISIONS
A helper class to save CSV stats upon self destruction, for example, at the end of a program run.
mrpt::system::CTimeLogger & m_tm
void dumpAllStats(const size_t column_width=80) const
Dump all stats through the COutputLogger interface.
void clear(bool deep_clear=false)
Resets all stats.
void stop()
for correct use, see docs for CTimeLoggerEntry
double do_leave(const std::string_view &func_name) noexcept
void registerUserMeasure(const std::string_view &event_name, const double value, const bool is_time=false) noexcept
double leave(const std::string_view &func_name) noexcept
End of a named section.
const std::string m_section_name
CTimeLogger & operator=(const CTimeLogger &o)=default
void enter(const std::string_view &func_name) noexcept
Start of a named section.
std::stack< double, std::vector< double > > open_calls
void global_profiler_leave(const char *func_name) noexcept
CTimeLoggerEntry(const CTimeLogger &logger, const std::string_view §ion_name)
ts_hash_map()=default
< Default constructor */
std::chrono::time_point< Clock > time_point
Versatile class for consistent logging and management of output messages.
CTimeLoggerSaveAtDtor(mrpt::system::CTimeLogger &tm)
A safe way to call enter() and leave() of a mrpt::system::CTimeLogger upon construction and destructi...
double getLastTime(const std::string &name) const
Return the last execution time of the given "section", or 0 if it hasn't ever been called "enter" wit...
void do_enter(const std::string_view &func_name) noexcept
void getStats(std::map< std::string, TCallStats > &out_stats) const
Returns all the current stats as a map: section_name => stats.
void enable(bool enabled=true)
void saveToCSVFile(const std::string &csv_file) const
Dump all stats to a Comma Separated Values (CSV) file.
bool m_keep_whole_history
void setName(const std::string &name) noexcept
const std::string & getName() const noexcept
void enableKeepWholeHistory(bool enable=true)
mrpt::containers::ts_hash_map< std::string, TCallData, HASH_SIZE_IN_BYTES, HASH_ALLOWED_COLLISIONS > TDataMap
std::string getStatsAsText(const size_t column_width=80) const
Dump all stats to a multi-line text string.
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 saveToMFile(const std::string &m_file) const
Dump all stats to a Matlab/Octave (.m) file.
void global_profiler_enter(const char *func_name) noexcept
bool isEnabledKeepWholeHistory() const
CTimeLogger(bool enabled=true, const std::string &name="", const bool keep_whole_history=false)
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 17:54:30 UTC 2020 | |