JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Timer.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 5/31/17.
3 //
4 
5 #ifndef JODA_TIMER_H
6 #define JODA_TIMER_H
7 
8 #include <chrono>
9 #include <string>
10 
11 #define JODA_TIMING_ENABLED
12 
17 class Timer {
18  public:
22  Timer();
23 
27  void start();
28 
32  void stop();
33 
38  double durationSeconds();
39 
44  std::string toString();
45 
52  void log(const std::string &what, const std::string &part);
53 
59  std::string toHumanDuration() const;
60 
61  protected:
62  std::chrono::time_point<std::chrono::system_clock> now();
63  std::chrono::time_point<std::chrono::system_clock> startTime;
64  std::chrono::time_point<std::chrono::system_clock> endTime;
65 };
66 
67 #endif // JODA_TIMER_H
Definition: Timer.h:17
std::chrono::time_point< std::chrono::system_clock > now()
Definition: Timer.cpp:18
void log(const std::string &what, const std::string &part)
Definition: Timer.cpp:36
std::chrono::time_point< std::chrono::system_clock > startTime
Definition: Timer.h:63
void start()
Definition: Timer.cpp:12
Timer()
Definition: Timer.cpp:10
void stop()
Definition: Timer.cpp:22
double durationSeconds()
Definition: Timer.cpp:28
std::chrono::time_point< std::chrono::system_clock > endTime
Definition: Timer.h:64
std::string toHumanDuration() const
Definition: Timer.cpp:60
std::string toString()
Definition: Timer.cpp:49