Belle II Software development
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
14namespace boost {
15 namespace python {
16 class list;
17 }
18}
19
20namespace 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
70
72 boost::python::list getAll();
73
75 void clear();
76
78 void csv(const char* filename);
79
81 static void exposePythonAPI();
82 private:
86 std::vector<ModuleStatistics> m_modules;
87 };
89} //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.
void csv(const char *filename)
Write statistics to a csv file.
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.
ProcessStatisticsPython & operator=(const ProcessStatisticsPython &)=default
Default assignment operator.
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.