Collision Checker
performance_timers.h
Go to the documentation of this file.
1 #ifndef CPP_COLLISION_FCL_PERFOMANCE_TIMERS_H_
2 #define CPP_COLLISION_FCL_PERFOMANCE_TIMERS_H_
3 
4 #define TIME_PROFILE_ENABLED (1)
5 
6 #if TIME_PROFILE_ENABLED
7 #include <sys/time.h>
8 //#include <boost/timer.hpp>
9 
10 namespace test {
11 
13 
14 int report_perfomance();
15 
16 void start_timer(int index);
17 void stop_timer(int index);
18 
19 class StackTimer {
20  public:
21  StackTimer(int index) : m_index_(index) {
22 #if TIME_PROFILE_ENABLED
23  start_timer(index);
24 #endif
25  }
27 #if TIME_PROFILE_ENABLED
29 #endif
30  }
31 
32  protected:
33  int m_index_ = -1;
34 };
35 timespec diff(timespec start, timespec end);
36 
37 class Timer {
38  public:
39  Timer();
40  ~Timer();
41 
42  void start();
43  void stop();
44  double getElapsedTime();
45  double getElapsedTimeInSec();
46  double getElapsedTimeInMilliSec();
48  double getElapsedTimeInMicroSec();
49  unsigned long
50  getElapsedTimeInNanoSec();
51 
52  private:
53  timespec time_start;
54  timespec time_end;
55 
56  double startTimeInMicroSec;
57  double endTimeInMicroSec;
58  int stopped;
59 #ifdef _WIN32
60  LARGE_INTEGER frequency;
61  LARGE_INTEGER startCount;
62  LARGE_INTEGER endCount;
63 #else
64  timeval startCount;
65  timeval endCount;
66 #endif
67 };
68 } // namespace test
69 #endif
70 
71 #endif /* CPP_COLLISION_FCL_PERFOMANCE_TIMERS_H_ */
int init_perfomance_timers()
void stop_timer(int index)
int report_perfomance()
timespec diff(timespec start, timespec end)
void start_timer(int index)