Go to the documentation of this file.
11 #ifndef TLX_MULTI_TIMER_HEADER
12 #define TLX_MULTI_TIMER_HEADER
55 void start(
const char* timer);
67 double get(
const char* timer);
72 void print(
const char* info, std::ostream& os)
const;
74 void print(
const char* info)
const;
99 std::chrono::time_point<std::chrono::high_resolution_clock>
time_point_;
145 #endif // !TLX_MULTI_TIMER_HEADER
MultiTimer & base_
reference to base timer
void print(const char *info, std::ostream &os) const
print all timers as a TIMER line to os
ScopedMultiTimerSwitch(MultiTimer &timer, const char *new_timer)
construct and timer to switch to
const char * running() const
return name of currently running timer.
~ScopedMultiTimer()
change back timer to previous timer.
MultiTimer can be used to measure time usage of different phases in a program or algorithm.
MultiTimer & operator=(const MultiTimer &)
default assignment operator
MultiTimer & add(const MultiTimer &b)
add all timers from another, internally holds a global mutex lock, because this is used to add thread...
MultiTimer & operator+=(const MultiTimer &b)
add all timers from another, internally holds a global mutex lock, because this is used to add thread...
RAII Scoped MultiTimer switcher: switches the timer of a MultiTimer on construction and back to old o...
std::vector< Entry > timers_
array of timers
MultiTimer & timer_
reference to MultiTimer
Independent RAII Scoped MultiTimer: contains a MultiTimer which is started with the given timer,...
void stop()
stop the currently running timer.
double total() const
return total duration of all timers.
const char * running_
currently running timer name
void start(const char *timer)
start new timer phase, stop the currently running one.
uint32_t running_hash_
hash of running_
Entry & find_or_create(const char *name)
internal methods to find or create new timer entries
std::chrono::time_point< std::chrono::high_resolution_clock > time_point_
start of currently running timer name
~ScopedMultiTimerSwitch()
change back timer to previous timer.
ScopedMultiTimer(MultiTimer &base, const char *timer)
construct and change timer to tm
double get(const char *timer)
return timer duration in seconds of timer.
std::chrono::duration< double > total_duration_
total duration
MultiTimer timer_
contained independent timer
const char * previous_
previous timer, used to switch back to on destruction