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

Python interface for ProcessStatistics. More...

#include <ProcessStatisticsPython.h>

Collaboration diagram for ProcessStatisticsPython:

Public Member Functions

 ProcessStatisticsPython (ModuleStatistics::EStatisticCounters type=ModuleStatistics::c_Event, const std::vector< ModuleStatistics > &modules={})
 Construct a new object to show statistics for a given call type. More...
 
 ProcessStatisticsPython (const ProcessStatisticsPython &)=default
 Default copy constructor.
 
ProcessStatisticsPythonoperator= (const ProcessStatisticsPython &)=default
 Default assignment operator.
 
 ~ProcessStatisticsPython ()=default
 Default destructor.
 
ProcessStatisticsgetWrapped ()
 Get wrapped ProcessStatistics object.
 
std::string getStatisticsString ()
 Return string with statistics for all selected modules. More...
 
std::string getStatisticsStringHTML ()
 Return string with statistics for all selected modules as html table. More...
 
ProcessStatisticsPython getModuleStatistics (ModuleStatistics::EStatisticCounters type, const boost::python::list &modulesPyList)
 Get a new statistics object for a different counter/different list of modules.
 
const ModuleStatisticsget (const std::shared_ptr< Module > &module)
 Get statistics for given module.
 
const ModuleStatisticsgetGlobal ()
 Get statistics for the framework itself.
 
boost::python::list getAll ()
 Get statistics for all modules as python list.
 
void clear ()
 Clear collected statistics but keep names of modules.
 

Static Public Member Functions

static void exposePythonAPI ()
 Define python wrappers to make functionality avaiable in python.
 

Private Attributes

ModuleStatistics::EStatisticCounters m_type {ModuleStatistics::c_Event}
 Which counter to show when printing the statistics.
 
std::vector< ModuleStatisticsm_modules
 Which modules to show. More...
 

Detailed Description

Python interface for ProcessStatistics.

Since ProcessStatistics itself resides in the data store, this wraps around it to export some functionality to python.

Definition at line 31 of file ProcessStatisticsPython.h.

Constructor & Destructor Documentation

◆ ProcessStatisticsPython()

Construct a new object to show statistics for a given call type.

Possibly also restricting the list of modules to be shown

Definition at line 34 of file ProcessStatisticsPython.h.

35  {}): m_type{type}, m_modules{modules} {}
std::vector< ModuleStatistics > m_modules
Which modules to show.
ModuleStatistics::EStatisticCounters m_type
Which counter to show when printing the statistics.

Member Function Documentation

◆ getStatisticsString()

string getStatisticsString ( )

Return string with statistics for all selected modules.

If none are selected show all modules

Can be used in steering file with 'print(statistics)'.

Definition at line 33 of file ProcessStatisticsPython.cc.

34 {
35  if (!getWrapped())
36  return "";
37  return getWrapped()->getStatisticsString(m_type, m_modules.empty() ? nullptr : &m_modules);
38 }
ProcessStatistics * getWrapped()
Get wrapped ProcessStatistics object.
std::string getStatisticsString(ModuleStatistics::EStatisticCounters type=ModuleStatistics::c_Event, const std::vector< Belle2::ModuleStatistics > *modules=nullptr, bool html=false) const
Return string with statistics for all modules.

◆ getStatisticsStringHTML()

string getStatisticsStringHTML ( )

Return string with statistics for all selected modules as html table.

If none are selected show all modules

Is used in Jupyter notebooks

Definition at line 40 of file ProcessStatisticsPython.cc.

Member Data Documentation

◆ m_modules

std::vector<ModuleStatistics> m_modules
private

Which modules to show.

If empty, show all modules

Definition at line 83 of file ProcessStatisticsPython.h.


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