Belle II Software  release-08-01-10
ModuleStatistics Class Reference

Keep track of time and memory consumption during processing. More...

#include <ModuleStatistics.h>

Collaboration diagram for ModuleStatistics:

Public Types

enum  EStatisticCounters {
  c_Init ,
  c_BeginRun ,
  c_Event ,
  c_EndRun ,
  c_Term ,
  c_Total
}
 Enum to define all counter types. More...
 
typedef double value_type
 type of float variable to use for calculations and storage
 

Public Member Functions

 ModuleStatistics (const std::string &name="")
 Construct with a given name.
 
void add (EStatisticCounters type, value_type time, value_type memory)
 Add a time and memory measurment to the counter of a given type. More...
 
void update (const ModuleStatistics &other)
 Add statistics for each category.
 
void setName (const std::string &name)
 Set the name of the module for display.
 
void setIndex (int index)
 Set the index of the module when displaying statistics.
 
const std::string & getName () const
 Return the previously set name.
 
int getIndex () const
 Return the index.
 
value_type getCalls (EStatisticCounters type=c_Total) const
 return the number of calls for a given counter type
 
value_type getTimeSum (EStatisticCounters type=c_Total) const
 return the sum of all execution times for a given counter
 
value_type getTimeMean (EStatisticCounters type=c_Total) const
 return the mean execution time for a given counter
 
value_type getTimeStddev (EStatisticCounters type=c_Total) const
 return the stddev of the execution times for a given counter
 
value_type getMemorySum (EStatisticCounters type=c_Total) const
 return the total used memory for a given counter
 
value_type getMemoryMean (EStatisticCounters type=c_Total) const
 return the average memory change per call
 
value_type getMemoryStddev (EStatisticCounters type=c_Total) const
 return the stddev of the memory consumption changes per call
 
value_type getTimeMemoryCorrelation (EStatisticCounters type=c_Total) const
 return the pearson correlation coefficient between execution times and memory consumption changes
 
bool operator== (const ModuleStatistics &other) const
 Check if name is identical.
 
bool operator!= (const ModuleStatistics &other) const
 inequality.
 
void clear ()
 Clear all statistics.
 

Private Attributes

int m_index
 display index of the module
 
std::string m_name
 name of module
 
CalcMeanCov< 2, value_typem_stats [c_Total+1]
 array with mean/covariance for all counters
 

Detailed Description

Keep track of time and memory consumption during processing.

This class offers a counter for time and memory consumption for all processing steps (initialize, beginRun, event, endRun, terminate and total). It will automatically calculate a running mean, stddev and correlation factor between time and memory consumption.

Definition at line 26 of file ModuleStatistics.h.

Member Enumeration Documentation

◆ EStatisticCounters

Enum to define all counter types.

Enumerator
c_Init 

Counting time/calls in initialize()

c_BeginRun 

Counting time/calls in beginRun()

c_Event 

Counting time/calls in event()

c_EndRun 

Counting time/calls in endRun()

c_Term 

Counting time/calls in terminate()

c_Total 

Sum of the above.

Definition at line 29 of file ModuleStatistics.h.

29  {
31  c_Init,
33  c_BeginRun,
35  c_Event,
37  c_EndRun,
39  c_Term,
41  c_Total
42  };
@ c_Init
Counting time/calls in initialize()
@ c_EndRun
Counting time/calls in endRun()
@ c_Term
Counting time/calls in terminate()
@ c_BeginRun
Counting time/calls in beginRun()
@ c_Event
Counting time/calls in event()
@ c_Total
Sum of the above.

Member Function Documentation

◆ add()

void add ( EStatisticCounters  type,
value_type  time,
value_type  memory 
)
inline

Add a time and memory measurment to the counter of a given type.

Parameters
typeType of counter to add the value to
timetime used during execution
memorymemory size change during execution

Definition at line 55 of file ModuleStatistics.h.


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