Belle II Software  release-05-02-19
ProcessStatisticsPython.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter, Christian Pulvermacher *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/ModuleStatistics.h>
14 #include <framework/core/ProcessStatistics.h>
15 
16 namespace boost {
17  namespace python {
18  class list;
19  }
20 }
21 
22 namespace Belle2 {
27  class Module;
28 
34  public:
35 
38 
41 
52  const std::vector<ModuleStatistics>* modules = nullptr);
53 
59  std::string getModuleStatistics(const boost::python::list& modulesPyList,
61 
74  void setModuleName(Module* module, const std::string& name)
75  {
76  getWrapped()->getStatistics(module).setName(name);
77  }
78 
80  const ModuleStatistics* get(const std::shared_ptr<Module>& module);
81 
83  const ModuleStatistics* getGlobal();
84 
86  boost::python::list getAll();
87 
89  void clear();
90 
92  static void exposePythonAPI();
93  private:
95  ProcessStatisticsPython() = default;
100 
101  };
103 } //Belle2 namespace
Belle2::ProcessStatisticsPython::operator=
ProcessStatisticsPython & operator=(ProcessStatisticsPython &)=delete
Prohibit assignment operator.
Belle2::ProcessStatisticsPython::get
const ModuleStatistics * get(const std::shared_ptr< Module > &module)
Get statistics for given module.
Definition: ProcessStatisticsPython.cc:77
Belle2::ProcessStatisticsPython::setModuleName
void setModuleName(Module *module, const std::string &name)
Set name for module in statistics.
Definition: ProcessStatisticsPython.h:74
Belle2::ModuleStatistics::c_Event
@ c_Event
Counting time/calls in event()
Definition: ModuleStatistics.h:45
Belle2::ProcessStatisticsPython::getInstance
static ProcessStatisticsPython & getInstance()
Return singleton instance of the statistics.
Definition: ProcessStatisticsPython.cc:23
Belle2::ModuleStatistics::EStatisticCounters
EStatisticCounters
Enum to define all counter types.
Definition: ModuleStatistics.h:39
Belle2::ProcessStatisticsPython::clear
void clear()
Clear collected statistics but keep names of modules.
Definition: ProcessStatisticsPython.cc:91
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::ModuleStatistics::setName
void setName(const std::string &name)
Set the name of the module for display.
Definition: ModuleStatistics.h:81
Belle2::ProcessStatisticsPython::getStatisticsString
std::string getStatisticsString(ModuleStatistics::EStatisticCounters type=ModuleStatistics::c_Event, const std::vector< ModuleStatistics > *modules=nullptr)
Return string with statistics for all modules.
Definition: ProcessStatisticsPython.cc:41
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ProcessStatistics::getStatistics
ModuleStatistics & getStatistics(const Module *module)
Get statistics for single module.
Definition: ProcessStatistics.h:172
Belle2::ProcessStatisticsPython::getGlobal
const ModuleStatistics * getGlobal()
Get statistics for the framework itself.
Definition: ProcessStatisticsPython.cc:84
Belle2::ProcessStatisticsPython::getModuleStatistics
std::string getModuleStatistics(const boost::python::list &modulesPyList, ModuleStatistics::EStatisticCounters type=ModuleStatistics::c_Event)
Return string with statistics for selected modules.
Definition: ProcessStatisticsPython.cc:49
Belle2::ProcessStatisticsPython::exposePythonAPI
static void exposePythonAPI()
Define python wrappers to make functionality avaiable in python.
Definition: ProcessStatisticsPython.cc:113
Belle2::ProcessStatisticsPython::ProcessStatisticsPython
ProcessStatisticsPython()=default
Private constructor due to singleton pattern.
Belle2::ProcessStatisticsPython::getAll
boost::python::list getAll()
Get statistics for all modules as python list.
Definition: ProcessStatisticsPython.cc:66
Belle2::ProcessStatistics
Class to collect call statistics for all modules.
Definition: ProcessStatistics.h:94
Belle2::ProcessStatisticsPython::getWrapped
ProcessStatistics * getWrapped()
Get wrapped ProcessStatistics object.
Definition: ProcessStatisticsPython.cc:29
Belle2::ProcessStatisticsPython
Python interface for ProcessStatistics.
Definition: ProcessStatisticsPython.h:33
Belle2::ModuleStatistics
Keep track of time and memory consumption during processing.
Definition: ModuleStatistics.h:36