Diana Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
QModuleTimeProfiling Class Reference

Simple base class for time profiling a module. More...

Inheritance diagram for QModuleTimeProfiling:
QBaseModule QNeighboursFiller QReaderEventGeneratorFiller QReaderNeighbour QDriver QFilter QModule QReader QWriter QAllSideNeighbour QNeverNeighbour QSameTimeNeighbour QSideNeighbour QSideOrSameTimeTrigger QTimeNeighbour

Public Member Functions

 QModuleTimeProfiling ()
 ctor initialized internal variables More...
 
virtual ~QModuleTimeProfiling ()
 dtor does nothing More...
 
void SetTimeProfilingOn (bool val)
 Set the time profiling on/off. More...
 
bool GetTimeProfilingOn () const
 Check if the time profiling is on. More...
 
void ResetTimer ()
 Reset the timer to now. More...
 
double GetTimer () const
 return the time since the last reset More...
 
virtual void StartProcessCall ()
 Start of a process call. More...
 
virtual void EndProcessCall ()
 End a process call and increment time and calls. More...
 
unsigned long long GetProcessCalls () const
 Return the total number of process calls. More...
 
double GetTotalProcessTime () const
 Return the total processing time. More...
 
double GetProcessCallTime () const
 Return the average time of a single process call. More...
 
std::string GetTimeProfileReport (const std::string &prefix="") const
 Report the time profiling. More...
 

Protected Attributes

bool fTimeProfilingOn
 Report the time profiling. More...
 
unsigned long long int fProcessCalls
 NUmber of calls to the process. More...
 
double fProcessTime
 Total time spent running the process. More...
 

Private Attributes

clock_t fTimerStartTime
 CLock time of the last timer reset. More...
 

Detailed Description

Simple base class for time profiling a module.

Author
J. Ouellet

This class is inherited by QBaseModules and subcomponents of modules, that wish to be timed.

There are two interfaces, you can either handle the timeprofiling yourself by calling ResetTimer() to start the clock, and later GetTimer() to get the time since the reset. You can then increment the time and calls as you wish. Or you can call StartProcessCall() (equivalent to ResetTimer()) and EndProcessCall() to increment the time and calls automatically.

Definition at line 23 of file QModuleTimeProfiling.hh.

Constructor & Destructor Documentation

◆ QModuleTimeProfiling()

QModuleTimeProfiling::QModuleTimeProfiling ( )

ctor initialized internal variables

Definition at line 7 of file QModuleTimeProfiling.cc.

◆ ~QModuleTimeProfiling()

virtual QModuleTimeProfiling::~QModuleTimeProfiling ( )
inlinevirtual

dtor does nothing

Definition at line 28 of file QModuleTimeProfiling.hh.

Member Function Documentation

◆ EndProcessCall()

void QModuleTimeProfiling::EndProcessCall ( )
virtual

◆ GetProcessCalls()

unsigned long long QModuleTimeProfiling::GetProcessCalls ( ) const
inline

Return the total number of process calls.

Definition at line 42 of file QModuleTimeProfiling.hh.

References fProcessCalls.

Referenced by GetTimeProfileReport().

◆ GetProcessCallTime()

double QModuleTimeProfiling::GetProcessCallTime ( ) const

Return the average time of a single process call.

Definition at line 31 of file QModuleTimeProfiling.cc.

References fProcessCalls, and fProcessTime.

Referenced by GetTimeProfileReport().

◆ GetTimeProfileReport()

std::string QModuleTimeProfiling::GetTimeProfileReport ( const std::string &  prefix = "") const

Report the time profiling.

Definition at line 35 of file QModuleTimeProfiling.cc.

References GetProcessCalls(), and GetProcessCallTime().

Referenced by QReader::End(), and QBaseModule::EndBase().

◆ GetTimeProfilingOn()

bool QModuleTimeProfiling::GetTimeProfilingOn ( ) const
inline

Check if the time profiling is on.

Definition at line 32 of file QModuleTimeProfiling.hh.

References fTimeProfilingOn.

Referenced by QReader::End(), QBaseModule::EndBase(), and QBaseModule::ProcessBase().

◆ GetTimer()

double QModuleTimeProfiling::GetTimer ( ) const

return the time since the last reset

Definition at line 18 of file QModuleTimeProfiling.cc.

References fTimerStartTime.

Referenced by EndProcessCall(), and QBaseModule::ProcessBase().

◆ GetTotalProcessTime()

double QModuleTimeProfiling::GetTotalProcessTime ( ) const
inline

Return the total processing time.

Definition at line 44 of file QModuleTimeProfiling.hh.

References fProcessTime.

◆ ResetTimer()

void QModuleTimeProfiling::ResetTimer ( )

Reset the timer to now.

Definition at line 14 of file QModuleTimeProfiling.cc.

References fTimerStartTime.

Referenced by QBaseModule::ProcessBase(), and StartProcessCall().

◆ SetTimeProfilingOn()

void QModuleTimeProfiling::SetTimeProfilingOn ( bool  val)
inline

Set the time profiling on/off.

Definition at line 30 of file QModuleTimeProfiling.hh.

References fTimeProfilingOn.

Referenced by QBaseModule::BeginBase().

◆ StartProcessCall()

void QModuleTimeProfiling::StartProcessCall ( )
virtual

Member Data Documentation

◆ fProcessCalls

unsigned long long int QModuleTimeProfiling::fProcessCalls
protected

◆ fProcessTime

double QModuleTimeProfiling::fProcessTime
protected

Total time spent running the process.

Definition at line 57 of file QModuleTimeProfiling.hh.

Referenced by QBaseModule::BeginBase(), EndProcessCall(), GetProcessCallTime(), GetTotalProcessTime(), and QBaseModule::ProcessBase().

◆ fTimeProfilingOn

bool QModuleTimeProfiling::fTimeProfilingOn
protected

Report the time profiling.

Definition at line 53 of file QModuleTimeProfiling.hh.

Referenced by GetTimeProfilingOn(), and SetTimeProfilingOn().

◆ fTimerStartTime

clock_t QModuleTimeProfiling::fTimerStartTime
private

CLock time of the last timer reset.

Definition at line 61 of file QModuleTimeProfiling.hh.

Referenced by GetTimer(), and ResetTimer().


The documentation for this class was generated from the following files: