![]() |
Belle II Software light-2505-deimos
|
Keep track of time and memory consumption during processing. More...
#include <ModuleStatistics.h>

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 measurement to the counter of a given type. | |
| 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 | |
| void | csv_header (std::ostream &output) const |
| write csv header to the given stream | |
| void | csv (std::ostream &output) const |
| write data to the given stream in csv format | |
| 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_type > | m_stats [c_Total+1] |
| array with mean/covariance for all counters | |
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 27 of file ModuleStatistics.h.
| typedef double value_type |
type of float variable to use for calculations and storage
Definition at line 46 of file ModuleStatistics.h.
| enum EStatisticCounters |
Enum to define all counter types.
Definition at line 30 of file ModuleStatistics.h.
|
inlineexplicit |
Construct with a given name.
Definition at line 49 of file ModuleStatistics.h.
|
inline |
Add a time and memory measurement to the counter of a given type.
| type | Type of counter to add the value to |
| time | time used during execution |
| memory | memory size change during execution |
Definition at line 56 of file ModuleStatistics.h.
|
inline |
Clear all statistics.
Definition at line 135 of file ModuleStatistics.h.
| void csv | ( | std::ostream & | output | ) | const |
write data to the given stream in csv format
Definition at line 25 of file ModuleStatistics.cc.
| void csv_header | ( | std::ostream & | output | ) | const |
write csv header to the given stream
Definition at line 13 of file ModuleStatistics.cc.
|
inline |
return the number of calls for a given counter type
Definition at line 82 of file ModuleStatistics.h.
|
inline |
|
inline |
return the average memory change per call
Definition at line 108 of file ModuleStatistics.h.
|
inline |
return the stddev of the memory consumption changes per call
Definition at line 113 of file ModuleStatistics.h.
|
inline |
return the total used memory for a given counter
Definition at line 103 of file ModuleStatistics.h.
|
inline |
Return the previously set name.
Definition at line 77 of file ModuleStatistics.h.
|
inline |
return the mean execution time for a given counter
Definition at line 93 of file ModuleStatistics.h.
|
inline |
return the pearson correlation coefficient between execution times and memory consumption changes
Definition at line 119 of file ModuleStatistics.h.
|
inline |
return the stddev of the execution times for a given counter
Definition at line 98 of file ModuleStatistics.h.
|
inline |
return the sum of all execution times for a given counter
Definition at line 88 of file ModuleStatistics.h.
|
inline |
|
inline |
Check if name is identical.
Definition at line 130 of file ModuleStatistics.h.
|
inline |
Set the index of the module when displaying statistics.
Definition at line 74 of file ModuleStatistics.h.
|
inline |
Set the name of the module for display.
Definition at line 72 of file ModuleStatistics.h.
|
inline |
Add statistics for each category.
Definition at line 64 of file ModuleStatistics.h.
|
private |
display index of the module
Definition at line 141 of file ModuleStatistics.h.
|
private |
name of module
Definition at line 143 of file ModuleStatistics.h.
|
private |
array with mean/covariance for all counters
Definition at line 145 of file ModuleStatistics.h.