Belle II Software  release-08-01-10
ProcessStatisticsPython.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/core/ModuleStatistics.h>
12 #include <framework/core/ProcessStatistics.h>
13 
14 namespace boost {
15  namespace python {
16  class list;
17  }
18 }
19 
20 namespace Belle2 {
25  class Module;
26 
32  public:
35  const std::vector<ModuleStatistics>& modules = {}): m_type{type}, m_modules{modules} {}
42 
45 
52  std::string getStatisticsString();
53 
60  std::string getStatisticsStringHTML();
61 
63  ProcessStatisticsPython getModuleStatistics(ModuleStatistics::EStatisticCounters type, const boost::python::list& modulesPyList);
64 
66  const ModuleStatistics* get(const std::shared_ptr<Module>& module);
67 
69  const ModuleStatistics* getGlobal();
70 
72  boost::python::list getAll();
73 
75  void clear();
76 
78  static void exposePythonAPI();
79  private:
83  std::vector<ModuleStatistics> m_modules;
84  };
86 } //Belle2 namespace
Keep track of time and memory consumption during processing.
EStatisticCounters
Enum to define all counter types.
@ c_Event
Counting time/calls in event()
Python interface for ProcessStatistics.
std::string getStatisticsStringHTML()
Return string with statistics for all selected modules as html table.
ProcessStatisticsPython getModuleStatistics(ModuleStatistics::EStatisticCounters type, const boost::python::list &modulesPyList)
Get a new statistics object for a different counter/different list of modules.
ProcessStatisticsPython(const ProcessStatisticsPython &)=default
Default copy constructor.
std::vector< ModuleStatistics > m_modules
Which modules to show.
~ProcessStatisticsPython()=default
Default destructor.
ProcessStatisticsPython(ModuleStatistics::EStatisticCounters type=ModuleStatistics::c_Event, const std::vector< ModuleStatistics > &modules={})
Construct a new object to show statistics for a given call type.
ProcessStatisticsPython & operator=(const ProcessStatisticsPython &)=default
Default assignment operator.
const ModuleStatistics * get(const std::shared_ptr< Module > &module)
Get statistics for given module.
std::string getStatisticsString()
Return string with statistics for all selected modules.
static void exposePythonAPI()
Define python wrappers to make functionality avaiable in python.
ModuleStatistics::EStatisticCounters m_type
Which counter to show when printing the statistics.
ProcessStatistics * getWrapped()
Get wrapped ProcessStatistics object.
void clear()
Clear collected statistics but keep names of modules.
boost::python::list getAll()
Get statistics for all modules as python list.
const ModuleStatistics * getGlobal()
Get statistics for the framework itself.
Class to collect call statistics for all modules.
Abstract base class for different kinds of events.