Parasol Planning Library (PPL)
ClockClass.h
Go to the documentation of this file.
1 #ifndef PMPL_CLOCK_CLASS_H_
2 #define PMPL_CLOCK_CLASS_H_
3 
4 #include <iostream>
5 #include <string>
6 
7 
18 class ClockClass {
19 
20  public:
21 
24 
25  ClockClass();
26 
30 
33  void SetName(const std::string& _name);
34 
36  void ClearClock();
37 
40  void StartClock();
41 
44  void StopClock();
45 
47  void StopPrintClock(std::ostream& _os);
48 
51  void PrintClock(std::ostream& _os);
52 
54  double GetSeconds() const;
55 
57  double GetUSeconds() const;
58 
60 
61  private:
62 
65 
66  struct timeval m_startTimeval;
67  struct timeval m_usedTimeval;
68 
69  bool m_running{false};
70 
71  std::string m_clockName;
72 
74 
75 };
76 
77 #endif
Definition: ClockClass.h:18
void StopPrintClock(std::ostream &_os)
Call StopClock and PrintClock.
Definition: ClockClass.cpp:108
ClockClass()
Definition: ClockClass.cpp:52
double GetUSeconds() const
Get the recorded time in microseconds.
Definition: ClockClass.cpp:132
double GetSeconds() const
Get the recorded time in seconds.
Definition: ClockClass.cpp:123
void SetName(const std::string &_name)
Definition: ClockClass.cpp:59
void ClearClock()
Reset the clock.
Definition: ClockClass.cpp:66
void PrintClock(std::ostream &_os)
Definition: ClockClass.cpp:116
void StopClock()
Definition: ClockClass.cpp:88
void StartClock()
Definition: ClockClass.cpp:75