24 #ifndef CROCODDYL_CORE_UTILS_STOPWATCH_H_ 25 #define CROCODDYL_CORE_UTILS_STOPWATCH_H_ 34 #pragma GCC visibility push(default) 37 #define START_PROFILER(name) getProfiler().profiler_status() ? getProfiler().start(name) : void() 38 #define STOP_PROFILER(name) getProfiler().profiler_status() ? getProfiler().stop(name) : void() 40 #define STOP_WATCH_MAX_NAME_LENGTH 60 41 #define STOP_WATCH_TIME_WIDTH 10 159 void enable_profiler();
162 void disable_profiler();
165 bool profiler_status();
168 bool performance_exists(std::string perf_name);
171 void set_mode(StopwatchMode mode);
174 void start(
const std::string &perf_name);
177 void stop(
const std::string &perf_name);
180 void pause(
const std::string &perf_name);
183 void reset(
const std::string &perf_name);
189 void report(
const std::string &perf_name,
int precision = 2, std::ostream &output = std::cout);
192 void report_all(
int precision = 2, std::ostream &output = std::cout);
195 long double get_total_time(
const std::string &perf_name);
198 long double get_average_time(
const std::string &perf_name);
201 long double get_min_time(
const std::string &perf_name);
204 long double get_max_time(
const std::string &perf_name);
207 long double get_last_time(
const std::string &perf_name);
212 long double get_time_so_far(
const std::string &perf_name);
222 long double take_time();
228 : clock_start(0), total_time(0), min_time(0), max_time(0), last_time(0), paused(
false), stops(0) {}
250 #pragma GCC visibility pop
bool profiler_active
Indicates if the profiler is enabled.
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.