23#ifndef VCL_BASE_TIMER_H
24#define VCL_BASE_TIMER_H
43 std::string mCaption =
"Timer";
44 bool mIsStopped =
false;
46 std::chrono::high_resolution_clock::time_point mBegin, mEnd;
94 mBegin = std::chrono::high_resolution_clock::now();
113 mEnd = std::chrono::high_resolution_clock::now();
127 std::cout <<
"[" <<
secs <<
" secs]\t" << mCaption << std::endl;
132 std::cout <<
"[" <<
mins <<
" mins; " <<
secs <<
" secs]\t"
133 << mCaption << std::endl;
136 std::cout <<
"[" <<
hours <<
" hours; " <<
mins <<
" mins; "
137 <<
secs <<
" secs]\t" << mCaption << std::endl;
152 (
double) (std::chrono::duration_cast<std::chrono::microseconds>(
158 std::chrono::high_resolution_clock::time_point s =
159 std::chrono::high_resolution_clock::now();
161 (
double) (std::chrono::duration_cast<std::chrono::microseconds>(
A class representing a box in N-dimensional space.
Definition box.h:46
The Timer class allows to instantiate simple Timer objects that can be used everywhere.
Definition timer.h:42
double delay() const
Returns the time passed between the call of start() and this member function. Works also if the timer...
Definition timer.h:147
void start()
Starts the timer.
Definition timer.h:93
void stopAndPrint()
Stops the timer and prints the time passed between the call of start() and this member function....
Definition timer.h:102
Timer(const char *caption, bool _start=true)
Creates a timer with the given caption. If the given boolean is true, the timer starts.
Definition timer.h:70
Timer(bool _start=true)
Creates a timer with the caption "Timer". If the given boolean is true, the timer starts.
Definition timer.h:56
void setCaption(const std::string &caption)
Sets the caption of the timer.
Definition timer.h:173
void print() const
Prints the time passed between the call of start() and this member function. Works also if the timer ...
Definition timer.h:122
void stop()
Stops the timer.
Definition timer.h:111
Timer(const std::string &caption, bool _start=true)
Creates a timer with the given caption. If the given boolean is true, the timer starts.
Definition timer.h:84