24 #ifndef CROCODDYL_CORE_UTILS_STOPWATCH_H_ 25 #define CROCODDYL_CORE_UTILS_STOPWATCH_H_ 27 #include "crocoddyl/core/utils/Stdafx.hh" 31 #pragma GCC visibility push(default) 37 #ifdef PROFILER_ACTIVE 38 #define START_PROFILER(name) getProfiler().start(name) 39 #define STOP_PROFILER(name) getProfiler().stop(name) 41 #define START_PROFILER(name) 42 #define STOP_PROFILER(name) 45 #define STOP_WATCH_MAX_NAME_LENGTH 60 46 #define STOP_WATCH_TIME_WIDTH 10 164 bool performance_exists(std::string perf_name);
167 void set_mode(StopwatchMode mode);
170 void start(
const std::string &perf_name);
173 void stop(
const std::string &perf_name);
176 void pause(
const std::string &perf_name);
179 void reset(
const std::string &perf_name);
185 void report(
const std::string &perf_name,
int precision = 2, std::ostream &output = std::cout);
188 void report_all(
int precision = 2, std::ostream &output = std::cout);
191 long double get_total_time(
const std::string &perf_name);
194 long double get_average_time(
const std::string &perf_name);
197 long double get_min_time(
const std::string &perf_name);
200 long double get_max_time(
const std::string &perf_name);
203 long double get_last_time(
const std::string &perf_name);
208 long double get_time_so_far(
const std::string &perf_name);
218 long double take_time();
224 : clock_start(0), total_time(0), min_time(0), max_time(0), last_time(0), paused(
false), stops(0) {}
245 #pragma GCC visibility pop
StopwatchMode mode
Time taking mode.
bool active
Flag to hold the clock's status.
std::map< std::string, PerformanceData > * records_of
Dynamic collection of performance data.
A class representing a stopwatch.