8 #include <hlt/softwaretrigger/modules/dqm/StatisticsTimingHLTDQMModule.h>
9 #include <hlt/softwaretrigger/modules/dqm/SoftwareTriggerHLTDQMModule.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/core/ProcessStatistics.h>
13 #include <framework/core/ModuleStatistics.h>
14 #include <framework/gearbox/Unit.h>
16 #include <TDirectory.h>
23 using namespace SoftwareTrigger;
29 setDescription(
"Monitor reconstruction runtime on HLT");
30 setPropertyFlags(c_ParallelProcessingCertified);
32 addParam(
"histogramDirectoryName", m_param_histogramDirectoryName,
33 "Runtime DQM histograms on HLT will be put into this directory", m_param_histogramDirectoryName);
35 addParam(
"m_param_overviewModuleList", m_param_overviewModuleList,
36 "Which modules should be shown in the overview mean list", m_param_overviewModuleList);
38 addParam(
"createHLTUnitHistograms", m_param_create_hlt_unit_histograms,
39 "Create HLT unit histograms?",
46 TDirectory* oldDirectory =
nullptr;
49 oldDirectory = gDirectory;
134 B2WARNING(
"HLT unit number not found");
143 if (not stats.isValid()) {
147 const std::vector<ModuleStatistics>& moduleStatisticsList = stats->getAll();
153 const std::string& statisticsName = moduleStatistics.getName();
160 const double statisticsTime = moduleStatistics.getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
161 const double statisticsMemory = moduleStatistics.getMemoryMean(ModuleStatistics::EStatisticCounters::c_Total) / 1024;
162 const double statisticsTime_sum = moduleStatistics.getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
163 const double statisticsMemory_sum = moduleStatistics.getMemorySum(ModuleStatistics::EStatisticCounters::c_Total) / 1024;
165 const int m_param_overviewModuleListIndex = std::distance(
m_param_overviewModuleList.begin(), m_param_overviewModuleListIterator);
166 meanTimes[m_param_overviewModuleListIndex] += statisticsTime;
167 meanMemories[m_param_overviewModuleListIndex] += statisticsMemory;
179 double processingTimeSum = 0.0;
180 double processingTimeMean = 0.0;
183 const std::string& statisticsName = moduleStatistics.getName();
189 processingTimeSum += moduleStatistics.getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
190 processingTimeMean += moduleStatistics.getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
196 const double fullTimeSum = fullStatistics.
getTimeSum(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
199 const double fullMemorySum = fullStatistics.
getMemorySum(ModuleStatistics::EStatisticCounters::c_Total) / 1024;
209 const double fullTimeMean = fullStatistics.
getTimeMean(ModuleStatistics::EStatisticCounters::c_Event) /
Unit::ms;
223 B2FATAL(
"Histograms were not created. Did you setup a HistoManager?");
229 [](
auto & it) { it.second->Reset(); });
231 [](
auto & it) { it.second->Reset(); });
239 [](
auto & it) { it.second->Reset(); });
241 [](
auto & it) { it.second->Reset(); });
243 [](
auto & it) { it.second->Reset(); });
@ c_Persistent
Object is available during entire execution time.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Keep track of time and memory consumption during processing.
value_type getMemorySum(EStatisticCounters type=c_Total) const
return the total used memory for a given counter
value_type getTimeSum(EStatisticCounters type=c_Total) const
return the sum of all execution times for a given counter
value_type getTimeMean(EStatisticCounters type=c_Total) const
return the mean execution time for a given counter
Module for Event Time Statistics DQM plots.
std::map< std::string, TH1F * > m_moduleTimeHistograms
Time distribution of certain modules.
TH1F * m_fullMemoryHistogram
Total memory usage distribution of all events.
const double m_processingTimeNBins
Number of bins for the histograms of processingTime.
TH1F * m_meanTimeHistogram
Mean time of certain modules.
std::map< unsigned int, double > m_lastProcessingTimeSumPerUnit
Storage for the last processing time sum per unit.
int m_hlt_unit
Store HLT unit number on initialization.
const double m_processingTimeMax
Maximum for the histograms of processingTime.
std::map< unsigned int, TH1F * > m_processingTimePerUnitHistograms
Processing time distribution of events per unit.
void initialize() override
Define the histograms.
void event() override
Full the histograms.
double m_lastProcessingTimeSum
Storage for the last processing time sum.
const double m_fullMemoryMax
Maximum for the histograms of fullMemory.
std::vector< std::string > m_param_overviewModuleList
Parameter: which modules should be shown in the overview list.
TH1F * m_fullTimeMeanPerUnitHistogram
Mean budget time of events per unit.
const double m_fullTimeNBins
Number of bins for the histograms of fullTime.
TH1F * m_processingTimeHistogram
Processing time distribution of all events.
std::map< std::string, double > m_lastModuleTimeSum
Storage for the last time sum of certain modules.
void beginRun() override
Reset histogram entries.
TH1F * m_processingTimeMeanPerUnitHistogram
Mean processing time of events per unit.
TH1F * m_meanMemoryHistogram
Mean memory of certain modules.
bool m_param_create_hlt_unit_histograms
Parameter: Create HLT unit number histograms?
std::map< unsigned int, double > m_lastFullTimeSumPerUnit
Storage for the last full time sum per unit.
double m_lastFullTimeSum
Storage for the last full time sum.
std::map< unsigned int, TH1F * > m_fullTimePerUnitHistograms
Budget time distribution of events per unit.
const double m_fullTimeMax
Maximum for the histograms of fullTime.
std::string m_param_histogramDirectoryName
Parameter: Directory to put the generated histograms.
std::vector< std::string > m_summaryModuleList
Summary modules of the actual processing.
std::map< std::string, TH1F * > m_moduleMemoryHistograms
Memory distribution of certain modules.
const double m_fullMemoryNBins
Number of bins for the histograms of fullMemory.
TH1F * m_fullTimeHistogram
Budget time distribution of all events.
TH1F * m_processesPerUnitHistogram
Number of processes per unit.
std::map< unsigned int, TH1F * > m_fullMemoryPerUnitHistograms
Total memory distribution of events per unit.
void defineHisto() override
Histogram definition.
Type-safe access to single objects in the data store.
static const double ms
[millisecond]
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
static constexpr char hlt_unit_file[]
Location of HLT unit number information.
static constexpr unsigned int max_hlt_units
Maximum number of HLT units used during the experiment.
Abstract base class for different kinds of events.