23#ifndef VCL_MISC_TIMER_H
24#define VCL_MISC_TIMER_H
43 std::string mCaption =
"Timer";
44 bool mIsStopped =
false;
46 std::chrono::high_resolution_clock::time_point mBegin, mEnd;
93 void start() { mBegin = std::chrono::high_resolution_clock::now(); }
110 mEnd = std::chrono::high_resolution_clock::now();
124 std::cout <<
"[" <<
secs <<
" secs]\t" << mCaption << std::endl;
129 std::cout <<
"[" <<
mins <<
" mins; " <<
secs <<
" secs]\t"
130 << mCaption << std::endl;
133 std::cout <<
"[" <<
hours <<
" hours; " <<
mins <<
" mins; "
134 <<
secs <<
" secs]\t" << mCaption << std::endl;
149 (
double) (std::chrono::duration_cast<std::chrono::microseconds>(
155 std::chrono::high_resolution_clock::time_point s =
156 std::chrono::high_resolution_clock::now();
158 (
double) (std::chrono::duration_cast<std::chrono::microseconds>(
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
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:144
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:99
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:170
void print() const
Prints the time passed between the call of start() and this member function. Works also if the timer ...
Definition timer.h:119
void stop()
Stops the timer.
Definition timer.h:108
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