Diana Software
QModuleTimeProfiling.hh
Go to the documentation of this file.
1 
2 #ifndef __Q_MODULE_TIME_PROFILING_HH__
3 #define __Q_MODULE_TIME_PROFILING_HH__
4 
5 #include <ctime>
6 #include <string>
24 public:
28  virtual ~QModuleTimeProfiling() {}
30  void SetTimeProfilingOn(bool val) { fTimeProfilingOn = val; }
32  bool GetTimeProfilingOn() const { return fTimeProfilingOn; }
34  void ResetTimer();
36  double GetTimer() const;
38  virtual void StartProcessCall();
40  virtual void EndProcessCall();
42  unsigned long long GetProcessCalls() const { return fProcessCalls; }
44  double GetTotalProcessTime() const { return fProcessTime; }
46  double GetProcessCallTime() const;
48  std::string GetTimeProfileReport(const std::string &prefix="") const;
49 
50 protected:
51 
55  unsigned long long int fProcessCalls;
57  double fProcessTime;
58 
59 private:
61  clock_t fTimerStartTime;
62 
63 
64 };
65 
66 #endif
67 
Simple base class for time profiling a module.
void ResetTimer()
Reset the timer to now.
double GetProcessCallTime() const
Return the average time of a single process call.
void SetTimeProfilingOn(bool val)
Set the time profiling on/off.
unsigned long long int fProcessCalls
NUmber of calls to the process.
double fProcessTime
Total time spent running the process.
bool GetTimeProfilingOn() const
Check if the time profiling is on.
bool fTimeProfilingOn
Report the time profiling.
virtual void EndProcessCall()
End a process call and increment time and calls.
virtual void StartProcessCall()
Start of a process call.
QModuleTimeProfiling()
ctor initialized internal variables
double GetTimer() const
return the time since the last reset
virtual ~QModuleTimeProfiling()
dtor does nothing
double GetTotalProcessTime() const
Return the total processing time.
unsigned long long GetProcessCalls() const
Return the total number of process calls.
std::string GetTimeProfileReport(const std::string &prefix="") const
Report the time profiling.
clock_t fTimerStartTime
CLock time of the last timer reset.