 |
Belle II Software
release-05-01-25
|
10 #include <hlt/softwaretrigger/modules/dqm/StatisticsTimingHLTDQMModule.h>
11 #include <hlt/softwaretrigger/modules/dqm/SoftwareTriggerHLTDQMModule.h>
13 #include <framework/datastore/StoreObjPtr.h>
14 #include <framework/core/ProcessStatistics.h>
15 #include <framework/core/ModuleStatistics.h>
16 #include <framework/gearbox/Unit.h>
18 #include <TDirectory.h>
25 using namespace SoftwareTrigger;
31 setDescription(
"Monitor reconstruction runtime on HLT");
32 setPropertyFlags(c_ParallelProcessingCertified);
34 addParam(
"histogramDirectoryName", m_param_histogramDirectoryName,
35 "Runtime DQM histograms on HLT will be put into this directory", m_param_histogramDirectoryName);
37 addParam(
"m_param_overviewModuleList", m_param_overviewModuleList,
38 "Which modules should be shown in the overview mean list", m_param_overviewModuleList);
40 addParam(
"createHLTUnitHistograms", m_param_create_hlt_unit_histograms,
41 "Create HLT unit histograms?",
48 TDirectory* oldDirectory =
nullptr;
51 oldDirectory = gDirectory;
116 new TH1F((
"processingMemoryPerUnitHistogram_HLT" + std::to_string(index)).c_str(),
117 (
"Memory Used For Processing Per Unit: HLT" + std::to_string(index) +
" [KB]").c_str(),
m_processingMemoryNBins,
150 B2WARNING(
"HLT unit number not found");
159 if (not stats.isValid()) {
163 const std::vector<ModuleStatistics>& moduleStatisticsList = stats->getAll();
169 const std::string& statisticsName = moduleStatistics.getName();
176 const double statisticsTime = moduleStatistics.getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
177 const double statisticsMemory = moduleStatistics.getMemoryMean(ModuleStatistics::EStatisticCounters::c_Event);
178 const double statisticsTime_sum = moduleStatistics.getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
179 const double statisticsMemory_sum = moduleStatistics.getMemorySum(ModuleStatistics::EStatisticCounters::c_Event);
181 const int m_param_overviewModuleListIndex = std::distance(
m_param_overviewModuleList.begin(), m_param_overviewModuleListIterator);
182 meanTimes[m_param_overviewModuleListIndex] += statisticsTime;
183 meanMemories[m_param_overviewModuleListIndex] += statisticsMemory;
196 double processingTimeSum = 0.0;
197 double processingTimeMean = 0.0;
198 double processingMemorySum = 0.0;
200 const std::string& statisticsName = moduleStatistics.getName();
206 processingTimeSum += moduleStatistics.getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
207 processingTimeMean += moduleStatistics.getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
208 processingMemorySum += moduleStatistics.getMemorySum(ModuleStatistics::EStatisticCounters::c_Event);
216 const double fullTimeSum = fullStatistics.
getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
219 const double fullMemorySum = fullStatistics.
getMemorySum(ModuleStatistics::EStatisticCounters::c_Event);
233 const double fullTimeMean = fullStatistics.
getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
248 B2FATAL(
"Histograms were not created. Did you setup a HistoManager?");
254 [](
auto & it) { it.second->Reset(); });
256 [](
auto & it) { it.second->Reset(); });
265 [](
auto & it) { it.second->Reset(); });
267 [](
auto & it) { it.second->Reset(); });
269 [](
auto & it) { it.second->Reset(); });
271 [](
auto & it) { it.second->Reset(); });
void event() override
Full the histograms.
static const double ms
[millisecond]
std::vector< std::string > m_param_overviewModuleList
Parameter: which modules should be shown in the overview list.
const double m_processingTimeMax
Maximum for the histograms of processingTime.
TH1F * m_fullMemoryHistogram
Total memory usage distribution of all events.
TH1F * m_processingMemoryHistogram
Memory used for processing distribution of all events.
TH1F * m_processingTimeHistogram
Processing time distribution of all events.
static constexpr unsigned int max_hlt_units
Maximum number of HLT units used during the experiment.
void initialize() override
Define the histograms.
const double m_processingTimeNBins
Number of bins for the histograms of processingTime.
std::map< std::string, double > m_lastModuleTimeSum
Storage for the last time sum of certain modules.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
std::map< unsigned int, double > m_lastFullMemorySumPerUnit
Storage for the last full memory sum per unit.
TH1F * m_fullTimeMeanPerUnitHistogram
Mean budget time of events per unit.
std::map< unsigned int, TH1F * > m_processingTimePerUnitHistograms
Processing time distribution of events per unit.
std::map< unsigned int, TH1F * > m_fullTimePerUnitHistograms
Budget time distribution of events per unit.
const double m_processingMemoryNBins
Number of bins for the histograms of processingMemory.
value_type getMemorySum(EStatisticCounters type=c_Total) const
return the total used memory for a given counter
void defineHisto() override
Histogram definition.
TH1F * m_meanMemoryHistogram
Mean memory of certain modules.
void beginRun() override
Reset histogram entries.
std::map< unsigned int, double > m_lastFullTimeSumPerUnit
Storage for the last full time sum per unit.
const double m_fullTimeNBins
Number of bins for the histograms of fullTime.
std::map< std::string, TH1F * > m_moduleMemoryHistograms
Memory distribution of certain modules.
const double m_fullMemoryMax
Maximum for the histograms of fullMemory.
const double m_fullTimeMax
Maximum for the histograms of fullTime.
std::map< std::string, TH1F * > m_moduleTimeHistograms
Time distribution of certain modules.
bool m_param_create_hlt_unit_histograms
Parameter: Create HLT unit number histograms?
TH1F * m_fullTimeHistogram
Budget time distribution of all events.
double m_lastProcessingTimeSum
Storage for the last processing time sum.
double m_lastProcessingMemorySum
Storage for the last processing memory sum.
static constexpr char hlt_unit_file[]
Location of HLT unit number information.
TH1F * m_processingTimeMeanPerUnitHistogram
Mean processing time of events per unit.
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
const double m_processingMemoryMin
Minimum for the histograms of processingMemory.
TH1F * m_processesPerUnitHistogram
Number of processes per unit.
std::map< std::string, double > m_lastModuleMemorySum
Storage for the last memory sum of certain modules.
std::vector< std::string > m_summaryModuleList
Summary modules of the actual processing.
TH1F * m_meanTimeHistogram
Mean time of certain modules.
@ c_Persistent
Object is available during entire execution time.
std::map< unsigned int, TH1F * > m_processingMemoryPerUnitHistograms
Memory used for processing distribution of events per unit.
int m_hlt_unit
Store HLT unit number on initialization.
std::map< unsigned int, double > m_lastProcessingMemorySumPerUnit
Storage for the last processing memory sum per unit.
std::map< unsigned int, TH1F * > m_fullMemoryPerUnitHistograms
Total memory distribution of events per unit.
std::string m_param_histogramDirectoryName
Parameter: Directory to put the generated histograms.
value_type getTimeMean(EStatisticCounters type=c_Total) const
return the mean execution time for a given counter
const double m_fullMemoryNBins
Number of bins for the histograms of fullMemory.
value_type getTimeSum(EStatisticCounters type=c_Total) const
return the sum of all execution times for a given counter
double m_lastFullMemorySum
Storage for the last full memory sum.
const double m_fullMemoryMin
Minimum for the histograms of fullMemory.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
std::map< unsigned int, double > m_lastProcessingTimeSumPerUnit
Storage for the last processing time sum per unit.
double m_lastFullTimeSum
Storage for the last full time sum.
const double m_processingMemoryMax
Maximum for the histograms of processingMemory.
Module for Event Time Statistics DQM plots.
Keep track of time and memory consumption during processing.