24 #ifndef CROCODDYL_CORE_UTILS_STOPWATCH_H_ 25 #define CROCODDYL_CORE_UTILS_STOPWATCH_H_ 34 #pragma GCC visibility push(default) 40 #ifdef PROFILER_ACTIVE 41 #define START_PROFILER(name) getProfiler().start(name) 42 #define STOP_PROFILER(name) getProfiler().stop(name) 44 #define START_PROFILER(name) 45 #define STOP_PROFILER(name) 48 #define STOP_WATCH_MAX_NAME_LENGTH 60 49 #define STOP_WATCH_TIME_WIDTH 10 167 bool performance_exists(std::string perf_name);
170 void set_mode(StopwatchMode mode);
173 void start(
const std::string &perf_name);
176 void stop(
const std::string &perf_name);
179 void pause(
const std::string &perf_name);
182 void reset(
const std::string &perf_name);
188 void report(
const std::string &perf_name,
int precision = 2, std::ostream &output = std::cout);
191 void report_all(
int precision = 2, std::ostream &output = std::cout);
194 long double get_total_time(
const std::string &perf_name);
197 long double get_average_time(
const std::string &perf_name);
200 long double get_min_time(
const std::string &perf_name);
203 long double get_max_time(
const std::string &perf_name);
206 long double get_last_time(
const std::string &perf_name);
211 long double get_time_so_far(
const std::string &perf_name);
221 long double take_time();
227 : clock_start(0), total_time(0), min_time(0), max_time(0), last_time(0), paused(
false), stops(0) {}
248 #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.