MinLCA algorithms
timer.cc
Go to the documentation of this file.
1 #include <utils/timer.hh>
2 
5 
6 namespace minlca
7 {
8 namespace utils
9 {
10 
11 Timer::Timer() : _start(std::chrono::high_resolution_clock::now())
12 {
13 }
14 
16 {
17  _start = std::chrono::high_resolution_clock::now();
18 }
19 
20 double Timer::elapsed() const
21 {
22  std::chrono::time_point<std::chrono::high_resolution_clock> now =
23  std::chrono::high_resolution_clock::now();
24  std::chrono::duration<double> d = now - _start;
25  return d.count();
26 }
27 }
28 }
Default namespace Default namespace for MinLCA algorithms.
Definition: base.hh:15
std::chrono::time_point< std::chrono::high_resolution_clock > _start
Instant when the timer is started.
Definition: timer.hh:18
Description of Timer.
double elapsed() const
Retrieve elapsed time.
Definition: timer.cc:20
void restart()
Restart the timer.
Definition: timer.cc:15
Timer()
Default constructor.
Definition: timer.cc:11