delphi_cb
 All Classes Namespaces Files Functions Variables Macros
misc_timer.h
Go to the documentation of this file.
1 
8 #ifndef TIMER_H_
9 #define TIMER_H_
10 
11 #include <iostream>
12 #include <time.h> /* or include ctime */
13 #include "../interface/interface_abstractmodule.h"
14 
15 class CTimer
16 {
17  private:
18  //for print out current date and time
19  time_t tStart, tNow;
20  tm * tmStartDateTime, * tmNowDateTime;
21  //for precise calculating elapsed time
22  clock_t clockStart, clockNow, clockElapse;
23 
24  double clockStart_omp, clockNow_omp, clockElapse_omp; // LinWang : added for OpenMP timer
25 
26  void formattedOutElapse(long int &) const;
27 
28  public:
29 
34  {
35 #ifdef DEBUG_OBJECT
36  cout << endl;
37  cout << "****************************************************************\n";
38  cout << "* CTimer is constructed *\n";
39  cout << "****************************************************************\n";
40 #endif
41 
42  tStart = time(0); tmStartDateTime = localtime(&tStart);
43  clockStart = clock();
44 
45  };
46 
51  {
52 #ifdef DEBUG_OBJECT
53  cout << endl;
54  cout << "****************************************************************\n";
55  cout << "* CTimer is destroyed *\n";
56  cout << "****************************************************************\n";
57 #endif
58  };
59 
63  void start();
64 
68  void exit();
69 
73  void showTime();
74 
78  void showElapse();
79 };
80 
81 
82 #endif // TIMER_H_
~CTimer()
Definition: misc_timer.h:50
Definition: misc_timer.h:15
void showElapse()
Definition: misc_timer.cpp:104
void showTime()
Definition: misc_timer.cpp:95
void start()
Definition: misc_timer.cpp:41
void exit()
Definition: misc_timer.cpp:57
CTimer()
Definition: misc_timer.h:33