WaveBlocksND
timer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <chrono>
4 
5 
6 namespace waveblocks {
7  namespace utilities {
8  class Timer
9  {
10  public:
11  double millis() const
12  {
13  return std::chrono::duration_cast<std::chrono::duration<double,std::ratio<1,1000> > >(stop_ - start_).count();
14  }
15 
16  double seconds() const
17  {
18  return std::chrono::duration_cast<std::chrono::duration<double,std::ratio<1,1> > >(stop_ - start_).count();
19  }
20 
21  void start()
22  {
23  start_ = std::chrono::high_resolution_clock::now();
24  }
25 
26  void stop()
27  {
28  stop_ = std::chrono::high_resolution_clock::now();
29  }
30 
31  private:
32  std::chrono::high_resolution_clock::time_point start_;
33  std::chrono::high_resolution_clock::time_point stop_;
34  };
35  }
36 }
Definition: coefficients_file_parser.cpp:10
std::chrono::high_resolution_clock::time_point start_
Definition: timer.hpp:32
std::chrono::high_resolution_clock::time_point stop_
Definition: timer.hpp:33
double millis() const
Definition: timer.hpp:11
void start()
Definition: timer.hpp:21
double seconds() const
Definition: timer.hpp:16
Definition: timer.hpp:8
void stop()
Definition: timer.hpp:26