diff --git a/Calibration/IsolatedParticles/test/HLT_IsoTrig_Data_New1.py b/Calibration/IsolatedParticles/test/HLT_IsoTrig_Data_New1.py
index 97920e71d4b85..884b8e0bf8b50 100644
--- a/Calibration/IsolatedParticles/test/HLT_IsoTrig_Data_New1.py
+++ b/Calibration/IsolatedParticles/test/HLT_IsoTrig_Data_New1.py
@@ -171,37 +171,14 @@
# instrument the menu with the FastTimerService
process.load( "HLTrigger.Timer.FastTimerService_cfi" )
-# this is currently ignored in 7.x, and alway uses the real tim clock
-process.FastTimerService.useRealTimeClock = True
-
-# enable specific features
-process.FastTimerService.enableTimingPaths = True
-process.FastTimerService.enableTimingModules = True
-process.FastTimerService.enableTimingExclusive = True
-
# print a text summary at the end of the job
-process.FastTimerService.enableTimingSummary = True
-
-# skip the first path (useful for HLT timing studies to disregard the time spent loading event and conditions data)
-process.FastTimerService.skipFirstPath = False
+process.FastTimerService.printJobSummary = True
# enable per-event DQM plots
process.FastTimerService.enableDQM = True
-# enable per-path DQM plots
-process.FastTimerService.enableDQMbyPathActive = True
-process.FastTimerService.enableDQMbyPathTotal = True
-process.FastTimerService.enableDQMbyPathOverhead = True
-process.FastTimerService.enableDQMbyPathDetails = True
-process.FastTimerService.enableDQMbyPathCounters = True
-process.FastTimerService.enableDQMbyPathExclusive = True
-
# enable per-module DQM plots
process.FastTimerService.enableDQMbyModule = True
-process.FastTimerService.enableDQMbyModuleType = True
-
-# enable per-event DQM sumary plots
-process.FastTimerService.enableDQMSummary = True
# enable per-event DQM plots by lumisection
process.FastTimerService.enableDQMbyLumiSection = True
diff --git a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New0.py b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New0.py
index 3d49d0b7d81c8..36acb6b7fa710 100644
--- a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New0.py
+++ b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New0.py
@@ -133,37 +133,14 @@
process.load( "HLTrigger.Timer.FastTimerService_cfi" )
process.load ("HLTrigger.Timer.fastTimerServiceClient_cfi" )
-# this is currently ignored in 7.x, and alway uses the real tim clock
-process.FastTimerService.useRealTimeClock = False
-
-# enable specific features
-process.FastTimerService.enableTimingPaths = True
-process.FastTimerService.enableTimingModules = True
-process.FastTimerService.enableTimingExclusive = True
-
# print a text summary at the end of the job
-process.FastTimerService.enableTimingSummary = True
-
-# skip the first path (useful for HLT timing studies to disregard the time spent loading event and conditions data)
-process.FastTimerService.skipFirstPath = False
+process.FastTimerService.printJobSummary = True
# enable per-event DQM plots
process.FastTimerService.enableDQM = True
-# enable per-path DQM plots
-process.FastTimerService.enableDQMbyPathActive = True
-process.FastTimerService.enableDQMbyPathTotal = True
-process.FastTimerService.enableDQMbyPathOverhead = True
-process.FastTimerService.enableDQMbyPathDetails = True
-process.FastTimerService.enableDQMbyPathCounters = True
-process.FastTimerService.enableDQMbyPathExclusive = True
-
# enable per-module DQM plots
process.FastTimerService.enableDQMbyModule = True
-#process.FastTimerService.enableDQMbyModuleType = True
-
-# enable per-event DQM sumary plots
-process.FastTimerService.enableDQMSummary = True
# enable per-event DQM plots by lumisection
process.FastTimerService.enableDQMbyLumiSection = True
diff --git a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New1.py b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New1.py
index e4fae8c598296..f7e463bb1fe4a 100644
--- a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New1.py
+++ b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New1.py
@@ -144,37 +144,14 @@
process.load( "HLTrigger.Timer.FastTimerService_cfi" )
process.load ("HLTrigger.Timer.fastTimerServiceClient_cfi" )
-# this is currently ignored in 7.x, and alway uses the real tim clock
-process.FastTimerService.useRealTimeClock = False
-
-# enable specific features
-process.FastTimerService.enableTimingPaths = True
-process.FastTimerService.enableTimingModules = True
-process.FastTimerService.enableTimingExclusive = True
-
# print a text summary at the end of the job
-process.FastTimerService.enableTimingSummary = True
-
-# skip the first path (useful for HLT timing studies to disregard the time spent loading event and conditions data)
-process.FastTimerService.skipFirstPath = False
+process.FastTimerService.printJobSummary = True
# enable per-event DQM plots
process.FastTimerService.enableDQM = True
-# enable per-path DQM plots
-process.FastTimerService.enableDQMbyPathActive = True
-process.FastTimerService.enableDQMbyPathTotal = True
-process.FastTimerService.enableDQMbyPathOverhead = True
-process.FastTimerService.enableDQMbyPathDetails = True
-process.FastTimerService.enableDQMbyPathCounters = True
-process.FastTimerService.enableDQMbyPathExclusive = True
-
# enable per-module DQM plots
process.FastTimerService.enableDQMbyModule = True
-#process.FastTimerService.enableDQMbyModuleType = True
-
-# enable per-event DQM sumary plots
-process.FastTimerService.enableDQMSummary = True
# enable per-event DQM plots by lumisection
process.FastTimerService.enableDQMbyLumiSection = True
diff --git a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New2.py b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New2.py
index 331b900f6cadb..7ddfc17972764 100644
--- a/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New2.py
+++ b/Calibration/IsolatedParticles/test/HLT_IsoTrig_MC_New2.py
@@ -247,37 +247,14 @@
process.load( "HLTrigger.Timer.FastTimerService_cfi" )
process.load ("HLTrigger.Timer.fastTimerServiceClient_cfi" )
-# this is currently ignored in 7.x, and alway uses the real tim clock
-process.FastTimerService.useRealTimeClock = False
-
-# enable specific features
-process.FastTimerService.enableTimingPaths = True
-process.FastTimerService.enableTimingModules = True
-process.FastTimerService.enableTimingExclusive = True
-
# print a text summary at the end of the job
-process.FastTimerService.enableTimingSummary = True
-
-# skip the first path (useful for HLT timing studies to disregard the time spent loading event and conditions data)
-process.FastTimerService.skipFirstPath = False
+process.FastTimerService.printJobSummary = True
# enable per-event DQM plots
process.FastTimerService.enableDQM = True
-# enable per-path DQM plots
-process.FastTimerService.enableDQMbyPathActive = True
-process.FastTimerService.enableDQMbyPathTotal = True
-process.FastTimerService.enableDQMbyPathOverhead = True
-process.FastTimerService.enableDQMbyPathDetails = True
-process.FastTimerService.enableDQMbyPathCounters = True
-process.FastTimerService.enableDQMbyPathExclusive = True
-
# enable per-module DQM plots
process.FastTimerService.enableDQMbyModule = True
-#process.FastTimerService.enableDQMbyModuleType = True
-
-# enable per-event DQM sumary plots
-process.FastTimerService.enableDQMSummary = True
# enable per-event DQM plots by lumisection
process.FastTimerService.enableDQMbyLumiSection = True
diff --git a/DQMOffline/Configuration/python/DQMOffline_cff.py b/DQMOffline/Configuration/python/DQMOffline_cff.py
index c78c1479f9131..7cf3d2ba65c64 100644
--- a/DQMOffline/Configuration/python/DQMOffline_cff.py
+++ b/DQMOffline/Configuration/python/DQMOffline_cff.py
@@ -3,7 +3,6 @@
from DQMServices.Components.DQMMessageLogger_cfi import *
from DQMServices.Components.DQMDcsInfo_cfi import *
from DQMServices.Components.DQMFastTimerService_cff import *
-from DQMServices.Components.DQMFastTimerServiceLuminosity_cfi import *
from DQMOffline.Ecal.ecal_dqm_source_offline_cff import *
from DQM.HcalTasks.OfflineSourceSequence_pp import *
@@ -75,7 +74,7 @@
DQMOffline = cms.Sequence( DQMOfflinePreDPG *
DQMOfflinePrePOG *
HLTMonitoring *
- dqmFastTimerServiceLuminosity *
+ # dqmFastTimerServiceLuminosity *
DQMMessageLogger )
_ctpps_2016_DQMOffline = DQMOffline.copy()
diff --git a/DQMServices/Components/python/DQMFastTimerServiceLuminosity_cfi.py b/DQMServices/Components/python/DQMFastTimerServiceLuminosity_cfi.py
deleted file mode 100644
index e384d247c83f1..0000000000000
--- a/DQMServices/Components/python/DQMFastTimerServiceLuminosity_cfi.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import FWCore.ParameterSet.Config as cms
-
-# set the luminosity for the FastTimerService from SCAL
-import HLTrigger.Timer.ftsLuminosityFromScalers_cfi as __ftsLuminosityFromScalers_cfi
-dqmFastTimerServiceLuminosity = __ftsLuminosityFromScalers_cfi.ftsLuminosityFromScalers.clone()
-dqmFastTimerServiceLuminosity.name = 'luminosity'
-dqmFastTimerServiceLuminosity.title = 'instantaneous luminosity (from SCAL)'
-dqmFastTimerServiceLuminosity.source = 'scalersRawToDigi'
-dqmFastTimerServiceLuminosity.range = 1.e34
-dqmFastTimerServiceLuminosity.resolution = 1.e31
diff --git a/DQMServices/Components/python/DQMFastTimerService_cff.py b/DQMServices/Components/python/DQMFastTimerService_cff.py
index 56c3975c62083..d706d2e9823ad 100644
--- a/DQMServices/Components/python/DQMFastTimerService_cff.py
+++ b/DQMServices/Components/python/DQMFastTimerService_cff.py
@@ -3,37 +3,16 @@
# instrument the process with the FastTimerService
from HLTrigger.Timer.FastTimerService_cfi import FastTimerService
-# this is currently ignored in 7.x, and always uses the real time clock
-FastTimerService.useRealTimeClock = False
-
-# enable specific features
-FastTimerService.enableTimingPaths = True
-FastTimerService.enableTimingModules = False
-FastTimerService.enableTimingExclusive = False
-
# print a text summary at the end of the job
-FastTimerService.enableTimingSummary = True
-
-# skip the first path (useful for HLT timing studies to disregard the time spent loading event and conditions data)
-FastTimerService.skipFirstPath = False
+FastTimerService.printEventSummary = False
+FastTimerService.printRunSummary = False
+FastTimerService.printJobSummary = True
# enable per-event DQM plots
FastTimerService.enableDQM = True
-# enable per-path DQM plots
-FastTimerService.enableDQMbyPathActive = True
-FastTimerService.enableDQMbyPathTotal = True
-FastTimerService.enableDQMbyPathOverhead = False
-FastTimerService.enableDQMbyPathDetails = True
-FastTimerService.enableDQMbyPathCounters = True
-FastTimerService.enableDQMbyPathExclusive = False
-
-# enable per-module DQM plots
+# disable per-module DQM plots
FastTimerService.enableDQMbyModule = False
-FastTimerService.enableDQMbyModuleType = False
-
-# enable per-event DQM sumary plots
-FastTimerService.enableDQMSummary = True
# enable per-event DQM plots by lumisection
FastTimerService.enableDQMbyLumiSection = True
diff --git a/HLTrigger/Configuration/python/Tools/confdb.py b/HLTrigger/Configuration/python/Tools/confdb.py
index a3b93eed4f218..f7d40f52fa7bd 100755
--- a/HLTrigger/Configuration/python/Tools/confdb.py
+++ b/HLTrigger/Configuration/python/Tools/confdb.py
@@ -661,39 +661,23 @@ def instrumentTiming(self):
# instrument the menu with the modules and EndPath needed for timing studies
"""
+ self.data += '\n# configure the FastTimerService\n'
if not 'FastTimerService' in self.data:
- self.data += '\n# configure the FastTimerService\n'
self.loadCff('HLTrigger.Timer.FastTimerService_cfi')
- else:
- self.data += '\n# configure the FastTimerService\n'
-
- self.data += """# this is currently ignored in CMSSW 7.x, always using the real time clock
-%(process)s.FastTimerService.useRealTimeClock = True
-# enable specific features
-%(process)s.FastTimerService.enableTimingPaths = True
-%(process)s.FastTimerService.enableTimingModules = True
-%(process)s.FastTimerService.enableTimingExclusive = True
-# print a text summary at the end of the job
-%(process)s.FastTimerService.enableTimingSummary = True
-# skip the first path (disregard the time spent loading event and conditions data)
-%(process)s.FastTimerService.skipFirstPath = True
+
+ self.data += """# print a text summary at the end of the job
+%(process)s.FastTimerService.printJobSummary = True
+
# enable DQM plots
%(process)s.FastTimerService.enableDQM = True
-# enable most per-path DQM plots
-%(process)s.FastTimerService.enableDQMbyPathActive = True
-%(process)s.FastTimerService.enableDQMbyPathTotal = True
-%(process)s.FastTimerService.enableDQMbyPathOverhead = False
-%(process)s.FastTimerService.enableDQMbyPathDetails = True
-%(process)s.FastTimerService.enableDQMbyPathCounters = True
-%(process)s.FastTimerService.enableDQMbyPathExclusive = True
+
# disable per-module DQM plots
%(process)s.FastTimerService.enableDQMbyModule = False
-%(process)s.FastTimerService.enableDQMbyModuleType = False
-# enable per-event DQM sumary plots
-%(process)s.FastTimerService.enableDQMSummary = True
+
# enable per-event DQM plots by lumisection
%(process)s.FastTimerService.enableDQMbyLumiSection = True
%(process)s.FastTimerService.dqmLumiSectionsRange = 2500
+
# set the time resolution of the DQM plots
%(process)s.FastTimerService.dqmTimeRange = 1000.
%(process)s.FastTimerService.dqmTimeResolution = 5.
@@ -701,6 +685,7 @@ def instrumentTiming(self):
%(process)s.FastTimerService.dqmPathTimeResolution = 0.5
%(process)s.FastTimerService.dqmModuleTimeRange = 40.
%(process)s.FastTimerService.dqmModuleTimeResolution = 0.2
+
# set the base DQM folder for the plots
%(process)s.FastTimerService.dqmPath = 'HLT/TimerService'
%(process)s.FastTimerService.enableDQMbyProcesses = True
diff --git a/HLTrigger/Timer/BuildFile.xml b/HLTrigger/Timer/BuildFile.xml
index 6a65e680ce30c..065b6fd72d825 100644
--- a/HLTrigger/Timer/BuildFile.xml
+++ b/HLTrigger/Timer/BuildFile.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/HLTrigger/Timer/interface/EDMModuleType.h b/HLTrigger/Timer/interface/EDMModuleType.h
new file mode 100644
index 0000000000000..34f16b72a6a0c
--- /dev/null
+++ b/HLTrigger/Timer/interface/EDMModuleType.h
@@ -0,0 +1,37 @@
+#ifndef HLTrigger_Timer_interface_EDMModuleType_h
+#define HLTrigger_Timer_interface_EDMModuleType_h
+
+#include "DataFormats/Provenance/interface/ModuleDescription.h"
+
+namespace edm {
+
+enum class EDMModuleType {
+ kUnknown,
+ kSource,
+ kESSource,
+ kESProducer,
+ kEDAnalyzer,
+ kEDProducer,
+ kEDFilter,
+ kOutputModule
+};
+
+constexpr
+const char * module_type_desc[] {
+ "Unknown",
+ "Source",
+ "ESSource",
+ "ESProducer",
+ "EDAnalyzer",
+ "EDProducer",
+ "EDFilter",
+ "OutputModule"
+};
+
+EDMModuleType edmModuleTypeEnum(edm::ModuleDescription const & module);
+
+const char * edmModuleType(edm::ModuleDescription const & module);
+
+} // namespace edm
+
+#endif // not defined HLTrigger_Timer_interface_EDMModuleType_h
diff --git a/HLTrigger/Timer/interface/FastTimer.h b/HLTrigger/Timer/interface/FastTimer.h
deleted file mode 100644
index 491fdb48749d8..0000000000000
--- a/HLTrigger/Timer/interface/FastTimer.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef FastTimer_h
-#define FastTimer_h
-
-// C++ headers
-#include
-
-class FastTimer {
-public:
- typedef std::chrono::high_resolution_clock Clock;
- typedef std::chrono::nanoseconds Duration;
- enum class State {
- kStopped,
- kRunning,
- kPaused
- };
-
- FastTimer();
-
- void start();
- void pause();
- void resume();
- void stop();
- void reset();
-
- Duration value() const;
- Duration untilNow() const;
- double seconds() const;
- double secondsUntilNow() const;
- State state() const;
- Clock::time_point const & getStartTime() const;
- Clock::time_point const & getStopTime() const;
- void setStartTime(Clock::time_point const &);
- void setStopTime(Clock::time_point const &);
-
-private:
- std::string const & describe() const;
-
- Clock::time_point m_start;
- Clock::time_point m_stop;
- Duration m_duration;
- State m_state;
-};
-
-#endif // ! FastTimer_h
diff --git a/HLTrigger/Timer/interface/FastTimerService.h b/HLTrigger/Timer/interface/FastTimerService.h
index cbd18929caa5b..2d8035ce5f55e 100644
--- a/HLTrigger/Timer/interface/FastTimerService.h
+++ b/HLTrigger/Timer/interface/FastTimerService.h
@@ -10,6 +10,14 @@
#include
#include
+// boost headers
+#include
+
+// tbb headers
+#include
+#include
+
+
// CMSSW headers
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
@@ -28,23 +36,13 @@
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
-#include "HLTrigger/Timer/interface/FastTimer.h"
+#include "HLTrigger/Timer/interface/ProcessCallGraph.h"
/*
-procesing time is diveded into
+procesing time is divided into
- source
- - pre-event processing overhead
- - event processing
- - post-event processing overhead
-
-until lumi-processing and run-processing are taken into account, they will count as inter-event overhead
-
-event processing time is diveded into
- - trigger processing (from the begin of the first path to the end of the last path)
- - trigger overhead
- - endpath processing (from the begin of the first endpath to the end of the last endpath)
- - endpath overhead
+ - event processing, sum of the time spent in all the modules
*/
/*
@@ -86,690 +84,383 @@ class FastTimerService {
FastTimerService(const edm::ParameterSet &, edm::ActivityRegistry & );
~FastTimerService();
- // reserve plots for timing vs. luminosity - these should only be called before any begin run (actually, before any preStreamBeginRun)
- unsigned int reserveLuminosityPlots(std::string const & name, std::string const & title, std::string const & label, double range, double resolution);
- unsigned int reserveLuminosityPlots(std::string && name, std::string && title, std::string && label, double range, double resolution);
-
- // set the event luminosity
- void setLuminosity(unsigned int stream_id, unsigned int luminosity_id, double value);
-
- // query the current module/path/event
- // Note: these functions incur in a "per-call timer overhead" (see above), currently of the order of 340ns
- double currentModuleTime(edm::StreamID) const; // return the time spent since the last preModuleEvent() event
- double currentPathTime(edm::StreamID) const; // return the time spent since the last prePathEvent() event
- double currentEventTime(edm::StreamID) const; // return the time spent since the last preEvent() event
+private:
+ double queryModuleTime_(edm::StreamID, unsigned int id) const;
- // query the time spent in a module/path (available after it has run)
- double queryModuleTime(edm::StreamID, const edm::ModuleDescription &) const;
- double queryModuleTime(edm::StreamID, unsigned int id) const;
- double queryModuleTimeByLabel(edm::StreamID, const std::string &) const;
- double queryModuleTimeByType(edm::StreamID, const std::string &) const;
- /* FIXME re-implement taking into account subprocesses
- double queryPathActiveTime(edm::StreamID, const std::string &) const;
- double queryPathExclusiveTime(edm::StreamID, const std::string &) const;
- double queryPathTotalTime(edm::StreamID, const std::string &) const;
- */
-
- // query the time spent in the current event's
- // - source (available during event processing)
- // - all paths (available during endpaths)
- // - all endpaths (available after all endpaths have run)
- // - processing (available after the event has been processed)
+public:
+ // query the time spent in a module/path/process (available after it has run)
double querySourceTime(edm::StreamID) const;
double queryEventTime(edm::StreamID) const;
- /* FIXME re-implement taking into account subprocesses
- double queryPathsTime(edm::StreamID) const;
- double queryEndPathsTime(edm::StreamID) const;
- */
-
- /* FIXME not yet implemented
- // try to assess the overhead which may not be included in the source, paths and event timers
- double queryPreSourceOverhead(edm::StreamID) const; // time spent after the previous event's postEvent and this event's preSource
- double queryPreEventOverhead(edm::StreamID) const; // time spent after this event's postSource and preEvent
- double queryPreEndPathsOverhead(edm::StreamID) const; // time spent after the last path's postPathEvent and the first endpath's prePathEvent
- */
+ double queryEventTime(edm::StreamID, std::string const& process) const;
+ double queryModuleTime(edm::StreamID, const edm::ModuleDescription & module) const;
+ double queryModuleTime(edm::StreamID, unsigned int id) const;
+ double queryModuleTimeByLabel(edm::StreamID, std::string const& module) const;
+ double queryModuleTimeByLabel(edm::StreamID, std::string const& process, const std::string & module) const;
+ double queryPathTime(edm::StreamID, std::string const& path) const;
+ double queryPathTime(edm::StreamID, std::string const& process, std::string const& path) const;
+ double queryHighlightTime(edm::StreamID sid, std::string const& label) const;
private:
- void preallocate(edm::service::SystemBounds const &);
+ void ignoredSignal(std::string signal) const;
+ void unsupportedSignal(std::string signal) const;
+
+ // these signal pairs are not guaranteed to happen in the same thread
+
+ void preallocate(edm::service::SystemBounds const&);
+
+ void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
+ void postBeginJob();
+
void postEndJob();
- void preGlobalBeginRun(edm::GlobalContext const &);
- void preStreamBeginRun(edm::StreamContext const &);
- void postStreamBeginRun(edm::StreamContext const &);
- void postStreamEndRun(edm::StreamContext const &);
- void postStreamBeginLumi(edm::StreamContext const &);
- void postStreamEndLumi(edm::StreamContext const& );
- void postGlobalEndRun(edm::GlobalContext const &);
- void preModuleBeginJob(edm::ModuleDescription const &);
- void preSourceEvent( edm::StreamID );
- void postSourceEvent( edm::StreamID );
- void preEvent(edm::StreamContext const &);
- void postEvent(edm::StreamContext const &);
- void prePathEvent(edm::StreamContext const &, edm::PathContext const &);
- void postPathEvent(edm::StreamContext const &, edm::PathContext const &,edm:: HLTPathStatus const &);
- void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &);
- void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &);
- void preModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &);
- void postModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &);
-public:
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
+ void preGlobalBeginRun(edm::GlobalContext const&);
+ void postGlobalBeginRun(edm::GlobalContext const&);
-private:
+ void preGlobalEndRun(edm::GlobalContext const&);
+ void postGlobalEndRun(edm::GlobalContext const&);
- struct LuminosityDescription {
- std::string name;
- std::string title;
- std::string label;
- double range;
- double resolution;
-
- LuminosityDescription(std::string const & _name, std::string const & _title, std::string const & _label, double _range, double _resolution) :
- name(_name),
- title(_title),
- label(_label),
- range(_range),
- resolution(_resolution)
- { }
-
- LuminosityDescription(std::string && _name, std::string && _title, std::string const & _label, double _range, double _resolution) :
- name(_name),
- title(_title),
- label(_label),
- range(_range),
- resolution(_resolution)
- { }
- };
+ void preStreamBeginRun(edm::StreamContext const&);
+ void postStreamBeginRun(edm::StreamContext const&);
+ void preStreamEndRun(edm::StreamContext const&);
+ void postStreamEndRun(edm::StreamContext const&);
- struct PathInfo;
+ void preGlobalBeginLumi(edm::GlobalContext const&);
+ void postGlobalBeginLumi(edm::GlobalContext const&);
- struct ModuleInfo {
- FastTimer timer; // per-event timer
- double time_active; // time actually spent in this module
- double summary_active;
- TH1F * dqm_active;
- PathInfo * run_in_path; // the path inside which the module was atually active
- uint32_t counter; // count how many times the module was scheduled to run
+ void preGlobalEndLumi(edm::GlobalContext const&);
+ void postGlobalEndLumi(edm::GlobalContext const&);
- public:
- ModuleInfo() :
- timer(),
- time_active(0.),
- summary_active(0.),
- dqm_active(nullptr),
- run_in_path(nullptr),
- counter(0)
- { }
-
- ~ModuleInfo() {
- reset();
- }
-
- // reset the timers and DQM plots
- void reset() {
- timer.reset();
- time_active = 0.;
- summary_active = 0.;
- // the DQM plots are owned by the DQMStore
- dqm_active = nullptr;
- run_in_path = nullptr;
- counter = 0;
- }
- };
+ void preStreamBeginLumi(edm::StreamContext const&);
+ void postStreamBeginLumi(edm::StreamContext const&);
- struct PathInfo {
- std::vector modules; // list of all modules contributing to the path (duplicate modules stored as null pointers)
- ModuleInfo * first_module; // first module actually run in this path
- FastTimer timer; // per-event timer
- double time_active; // time actually spent in this path
- double time_exclusive; // time actually spent in this path, in modules that are not run on any other paths
- double time_premodules; // time spent between "begin path" and the first "begin module"
- double time_intermodules; // time spent between modules
- double time_postmodules; // time spent between the last "end module" and "end path"
- double time_overhead; // sum of time_premodules, time_intermodules, time_postmodules
- double time_total; // sum of the time spent in all modules which would have run in this path (plus overhead)
- double summary_active;
- double summary_premodules;
- double summary_intermodules;
- double summary_postmodules;
- double summary_overhead;
- double summary_total;
- uint32_t last_run; // index of the last module run in this path, plus one
- uint32_t index; // index of the Path or EndPath in the "schedule"
- bool accept; // flag indicating if the path acepted the event
- TH1F * dqm_active; // see time_active
- TH1F * dqm_exclusive; // see time_exclusive
- TH1F * dqm_premodules; // see time_premodules
- TH1F * dqm_intermodules; // see time_intermodules
- TH1F * dqm_postmodules; // see time_postmodules
- TH1F * dqm_overhead; // see time_overhead
- TH1F * dqm_total; // see time_total
- TH1F * dqm_module_counter; // for each module in the path, track how many times it ran
- TH1F * dqm_module_active; // for each module in the path, track the active time spent
- TH1F * dqm_module_total; // for each module in the path, track the total time spent
+ void preStreamEndLumi(edm::StreamContext const&);
+ void postStreamEndLumi(edm::StreamContext const&);
- public:
- PathInfo() :
- modules(),
- first_module(nullptr),
- timer(),
- time_active(0.),
- time_exclusive(0.),
- time_premodules(0.),
- time_intermodules(0.),
- time_postmodules(0.),
- time_overhead(0.),
- time_total(0.),
- summary_active(0.),
- summary_premodules(0.),
- summary_intermodules(0.),
- summary_postmodules(0.),
- summary_overhead(0.),
- summary_total(0.),
- last_run(0),
- index(0),
- accept(false),
- dqm_active(nullptr),
- dqm_exclusive(nullptr),
- dqm_premodules(nullptr),
- dqm_intermodules(nullptr),
- dqm_postmodules(nullptr),
- dqm_overhead(nullptr),
- dqm_total(nullptr),
- dqm_module_counter(nullptr),
- dqm_module_active(nullptr),
- dqm_module_total(nullptr)
- { }
-
- ~PathInfo() {
- reset();
- }
-
- // reset the timers and DQM plots
- void reset() {
- first_module = nullptr;
- timer.reset();
- time_active = 0.;
- time_exclusive = 0.;
- time_premodules = 0.;
- time_intermodules = 0.;
- time_postmodules = 0.;
- time_overhead = 0.;
- time_total = 0.;
- summary_active = 0.;
- summary_premodules = 0.;
- summary_intermodules = 0.;
- summary_postmodules = 0.;
- summary_overhead = 0.;
- summary_total = 0.;
- last_run = 0;
- index = 0;
- accept = false;
-
- // the DQM plots are owned by the DQMStore
- dqm_active = nullptr;
- dqm_premodules = nullptr;
- dqm_intermodules = nullptr;
- dqm_postmodules = nullptr;
- dqm_overhead = nullptr;
- dqm_total = nullptr;
- dqm_module_counter = nullptr;
- dqm_module_active = nullptr;
- dqm_module_total = nullptr;
- }
- };
+ void preEvent(edm::StreamContext const&);
+ void postEvent(edm::StreamContext const&);
- // the vector is indexed by the peudo-process id, the paths by their path name
- template
- using PathMap = std::vector>;
+ void prePathEvent(edm::StreamContext const&, edm::PathContext const&);
+ void postPathEvent(edm::StreamContext const&, edm::PathContext const&, edm::HLTPathStatus const&);
- // key on ModuleDescription::id()
- template
- using ModuleMap = std::vector;
+ void preModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleEventPrefetching(edm::StreamContext const&, edm::ModuleCallingContext const&);
- // timer configuration
- bool m_use_realtime;
- bool m_enable_timing_paths;
- bool m_enable_timing_modules;
- bool m_enable_timing_exclusive;
- const bool m_enable_timing_summary;
- const bool m_skip_first_path;
+ // these signal pairs are guaranteed to be called within the same thread
- // dqm configuration
- bool m_enable_dqm; // non const because the availability of the DQMStore can only be checked during the begin job
- const bool m_enable_dqm_bypath_active; // require per-path timers
- const bool m_enable_dqm_bypath_total; // require per-path and per-module timers
- const bool m_enable_dqm_bypath_overhead; // require per-path and per-module timers
- const bool m_enable_dqm_bypath_details; // require per-path and per-module timers
- const bool m_enable_dqm_bypath_counters;
- const bool m_enable_dqm_bypath_exclusive;
- const bool m_enable_dqm_bymodule; // require per-module timers
- const bool m_enable_dqm_bymoduletype; // require per-module timers
- const bool m_enable_dqm_summary;
- const bool m_enable_dqm_byls;
- const bool m_enable_dqm_bynproc;
-
- unsigned int m_concurrent_runs;
- unsigned int m_concurrent_streams;
- unsigned int m_concurrent_threads;
- unsigned int m_module_id; // pseudo module id for the FastTimerService, needed by the thread-safe DQMStore
-
- const double m_dqm_eventtime_range;
- const double m_dqm_eventtime_resolution;
- const double m_dqm_pathtime_range;
- const double m_dqm_pathtime_resolution;
- const double m_dqm_moduletime_range;
- const double m_dqm_moduletime_resolution;
- std::string m_dqm_path;
-
- struct ProcessDescription {
- std::string name;
- std::string first_path; // the framework does not provide a pre/postPaths or pre/postEndPaths signal,
- std::string last_path; // so we emulate them keeping track of the first and last non-empty Path and EndPath
- std::string first_endpath;
- std::string last_endpath;
- edm::ParameterSetID pset;
+ //void preOpenFile(std::string const&, bool);
+ //void postOpenFile(std::string const&, bool);
+
+ //void preCloseFile(std::string const&, bool);
+ //void postCloseFile(std::string const&, bool);
+
+ void preSourceConstruction(edm::ModuleDescription const&);
+ //void postSourceConstruction(edm::ModuleDescription const&);
+
+ void preSourceRun();
+ void postSourceRun();
+
+ void preSourceLumi();
+ void postSourceLumi();
+
+ void preSourceEvent(edm::StreamID);
+ void postSourceEvent(edm::StreamID);
+
+ //void preModuleConstruction(edm::ModuleDescription const&);
+ //void postModuleConstruction(edm::ModuleDescription const&);
+
+ //void preModuleBeginJob(edm::ModuleDescription const&);
+ //void postModuleBeginJob(edm::ModuleDescription const&);
+
+ //void preModuleEndJob(edm::ModuleDescription const&);
+ //void postModuleEndJob(edm::ModuleDescription const&);
+
+ //void preModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ //void postModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ //void preModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ //void postModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+ void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+ void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+ void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+ void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postModuleEventDelayedGet(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+ void preEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
+ void postEventReadFromSource(edm::StreamContext const&, edm::ModuleCallingContext const&);
+
+public:
+ static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
+
+private:
+ // highlight a group of modules
+ struct GroupOfModules {
+ public:
+ std::string label;
+ std::vector modules;
};
- struct Timing {
- double presource; // time spent between the end of the previous Event, LumiSection or Run, and the beginning of the Source
- double source; // time spent processing the Source
- double preevent; // time spent between the end of the Source and the new Event, LumiSection or Run
- double event; // time spent processing the Event
- unsigned int count; // number of processed events (used by the per-run and per-job accounting)
-
- Timing() :
- presource (0.),
- source (0.),
- preevent (0.),
- event (0.),
- count (0)
- { }
-
- void reset() {
- presource = 0.;
- source = 0.;
- preevent = 0.;
- event = 0.;
- count = 0;
- }
-
- Timing & operator+=(Timing const & other) {
- presource += other.presource;
- source += other.source;
- preevent += other.preevent;
- event += other.event;
- count += other.count;
-
- return *this;
- }
-
- Timing operator+(Timing const & other) const {
- Timing result = *this;
- result += other;
- return result;
- }
+ // resources being monitored by the service
+ struct Resources {
+ public:
+ Resources();
+ void reset();
+ Resources & operator+=(Resources const& other);
+ Resources operator+(Resources const& other) const;
+ public:
+ boost::chrono::nanoseconds time_thread;
+ boost::chrono::nanoseconds time_real;
};
- struct TimingPerProcess {
- double preevent; // time spent between the end of the Source and the new Event, Lumisection or Run
- double event; // time spent processing the Event
- double all_paths; // time spent processing all Paths
- double all_endpaths; // time spent processing all EndPaths
- double interpaths; // time spent between the Paths (and EndPaths - i.e. the sum of all the entries in the following vector)
- std::vector paths_interpaths; // time spent between the beginning of the Event and the first Path, between Paths, and between the last (End)Path and the end of the Event
-
- TimingPerProcess() :
- preevent (0.),
- event (0.),
- all_paths (0.),
- all_endpaths (0.),
- interpaths (0.),
- paths_interpaths()
- { }
-
- void reset() {
- preevent = 0.;
- event = 0.;
- all_paths = 0.;
- all_endpaths = 0.;
- interpaths = 0.;
- paths_interpaths.assign(paths_interpaths.size(), 0.);
- }
-
- TimingPerProcess & operator+=(TimingPerProcess const & other) {
- assert( paths_interpaths.size() == other.paths_interpaths.size() );
-
- preevent += other.preevent;
- event += other.event;
- all_paths += other.all_paths;
- all_endpaths += other.all_endpaths;
- interpaths += other.interpaths;
- for (unsigned int i = 0; i < paths_interpaths.size(); ++i)
- paths_interpaths[i] += other.paths_interpaths[i];
- return *this;
- }
-
- TimingPerProcess operator+(TimingPerProcess const & other) const {
- TimingPerProcess result = *this;
- result += other;
- return result;
- }
+ struct ResourcesPerModule {
+ public:
+ ResourcesPerModule();
+ void reset();
+ ResourcesPerModule & operator+=(ResourcesPerModule const& other);
+ ResourcesPerModule operator+(ResourcesPerModule const& other) const;
+ public:
+ Resources total;
+ unsigned events;
};
- // set of summary plots, over all subprocesses
- struct SummaryPlots {
- TH1F * presource;
- TH1F * source;
- TH1F * preevent;
- TH1F * event;
-
- SummaryPlots() :
- presource (nullptr),
- source (nullptr),
- preevent (nullptr),
- event (nullptr)
- { }
-
- void reset() {
- // the DQM plots are owned by the DQMStore
- presource = nullptr;
- source = nullptr;
- preevent = nullptr;
- event = nullptr;
- }
-
- void fill(Timing const & value) {
- // convert on the fly from seconds to ms
- presource ->Fill( 1000. * value.presource );
- source ->Fill( 1000. * value.source );
- preevent ->Fill( 1000. * value.preevent );
- event ->Fill( 1000. * value.event );
- }
+ struct ResourcesPerPath {
+ public:
+ ResourcesPerPath();
+ void reset();
+ ResourcesPerPath & operator+=(ResourcesPerPath const& other);
+ ResourcesPerPath operator+(ResourcesPerPath const& other) const;
+ public:
+ Resources active; // resources used by all modules on this path
+ Resources total; // resources used by all modules on this path, and their dependencies
+ unsigned last; // one-past-the last module that ran on this path
+ bool status; // whether the path accepted or rejected the event
};
- // set of summary plots, per subprocess
- struct SummaryPlotsPerProcess {
- TH1F * preevent;
- TH1F * event;
- TH1F * all_paths;
- TH1F * all_endpaths;
- TH1F * interpaths;
-
- SummaryPlotsPerProcess() :
- preevent (nullptr),
- event (nullptr),
- all_paths (nullptr),
- all_endpaths (nullptr),
- interpaths (nullptr)
- { }
-
- void reset() {
- // the DQM plots are owned by the DQMStore
- preevent = nullptr;
- event = nullptr;
- all_paths = nullptr;
- all_endpaths = nullptr;
- interpaths = nullptr;
- }
-
- void fill(TimingPerProcess const & value) {
- // convert on the fly from seconds to ms
- preevent ->Fill( 1000. * value.preevent );
- event ->Fill( 1000. * value.event );
- all_paths ->Fill( 1000. * value.all_paths );
- all_endpaths ->Fill( 1000. * value.all_endpaths );
- interpaths ->Fill( 1000. * value.interpaths );
- }
+ struct ResourcesPerProcess {
+ public:
+ ResourcesPerProcess(ProcessCallGraph::ProcessType const& process);
+ void reset();
+ ResourcesPerProcess & operator+=(ResourcesPerProcess const& other);
+ ResourcesPerProcess operator+(ResourcesPerProcess const& other) const;
+ public:
+ Resources total;
+ std::vector paths;
+ std::vector endpaths;
};
- // set of summary profiles vs. luminosity, over all subprocesses
- struct SummaryProfiles {
- TProfile * presource;
- TProfile * source;
- TProfile * preevent;
- TProfile * event;
-
- SummaryProfiles() :
- presource (nullptr),
- source (nullptr),
- preevent (nullptr),
- event (nullptr)
- { }
-
- void reset() {
- // the DQM plots are owned by the DQMStore
- presource = nullptr;
- source = nullptr;
- preevent = nullptr;
- event = nullptr;
- }
-
- void fill(double x, Timing const & value) {
- presource ->Fill( x, 1000. * value.presource );
- source ->Fill( x, 1000. * value.source );
- preevent ->Fill( x, 1000. * value.preevent );
- event ->Fill( x, 1000. * value.event );
- }
+ struct ResourcesPerJob {
+ public:
+ ResourcesPerJob();
+ ResourcesPerJob(ProcessCallGraph const& job, std::vector const& groups);
+ void reset();
+ ResourcesPerJob & operator+=(ResourcesPerJob const& other);
+ ResourcesPerJob operator+(ResourcesPerJob const& other) const;
+ public:
+ Resources total;
+ std::vector highlight;
+ std::vector modules;
+ std::vector processes;
+ unsigned events;
};
- // set of summary profiles vs. luminosity, per subprocess
- struct SummaryProfilesPerProcess {
- TProfile * preevent;
- TProfile * event;
- TProfile * all_paths;
- TProfile * all_endpaths;
- TProfile * interpaths;
-
- SummaryProfilesPerProcess() :
- preevent (nullptr),
- event (nullptr),
- all_paths (nullptr),
- all_endpaths (nullptr),
- interpaths (nullptr)
- { }
-
- ~SummaryProfilesPerProcess() {
- reset();
- }
-
- void reset() {
- // the DQM plots are owned by the DQMStore
- preevent = nullptr;
- event = nullptr;
- all_paths = nullptr;
- all_endpaths = nullptr;
- interpaths = nullptr;
- }
-
- void fill(double x, TimingPerProcess const & value) {
- preevent ->Fill( x, 1000. * value.preevent );
- event ->Fill( x, 1000. * value.event );
- all_paths ->Fill( x, 1000. * value.all_paths );
- all_endpaths ->Fill( x, 1000. * value.all_endpaths );
- interpaths ->Fill( x, 1000. * value.interpaths );
- }
+ // per-thread measurements
+ struct Measurement {
+ public:
+ Measurement();
+ void measure();
+ void measure_and_store(Resources & store);
+
+ public:
+ #ifdef DEBUG_THREAD_CONCURRENCY
+ std::thread::id id;
+ #endif // DEBUG_THREAD_CONCURRENCY
+ boost::chrono::thread_clock::time_point time_thread;
+ boost::chrono::high_resolution_clock::time_point time_real;
};
- // set of profile plots by path, per subprocess
- struct PathProfilesPerProcess {
- TProfile * active_time;
- TProfile * total_time;
- TProfile * exclusive_time;
- TProfile * interpaths;
-
- PathProfilesPerProcess() :
- active_time (nullptr),
- total_time (nullptr),
- exclusive_time(nullptr),
- interpaths (nullptr)
- {}
-
- ~PathProfilesPerProcess() {
- reset();
- }
-
- void reset() {
- // the DQM plots are owned by the DQMStore
- active_time = nullptr;
- total_time = nullptr;
- exclusive_time = nullptr;
- interpaths = nullptr;
- }
+ // plots associated to each module or other element (path, process, etc)
+ class PlotsPerElement {
+ public:
+ PlotsPerElement();
+ void reset();
+ void book(DQMStore::IBooker &, std::string const& name, std::string const& title, double range, double resolution, unsigned int lumisections, bool byls);
+ void fill(Resources const&, unsigned int lumisection);
+ void fill_fraction(Resources const&, Resources const&, unsigned int lumisection);
+
+ private:
+ // resources spent in the module
+ TH1F * time_thread_;
+ TProfile * time_thread_byls_;
+ TH1F * time_real_;
+ TProfile * time_real_byls_;
+ };
+ // plots associated to each path or endpath
+ class PlotsPerPath {
+ public:
+ PlotsPerPath();
+ void reset();
+ void book(DQMStore::IBooker &, ProcessCallGraph const&, ProcessCallGraph::PathType const&, double range, double resolution, unsigned int lumisections, bool byls);
+ void fill(ProcessCallGraph::PathType const&, ResourcesPerJob const&, ResourcesPerPath const&, unsigned int lumisection);
+
+ private:
+ // resources spent in all the modules in the path, including their dependencies
+ PlotsPerElement total_;
+
+ // Note:
+ // a TH1F has 7 significant digits, while a 24-hour long run could process
+ // order of 10 billion events; a 64-bit long integer would work and might
+ // be better suited than a double, but there is no "TH1L" in ROOT.
+
+ // how many times each module and their dependencies has run
+ TH1D * module_counter_;
+ // resources spent in each module and their dependencies
+ TH1D * module_time_thread_total_;
+ TH1D * module_time_real_total_;
};
- struct StreamData {
- // timers
- FastTimer timer_event; // track time spent in each event
- FastTimer timer_source; // track time spent in the source
- FastTimer timer_paths; // track time spent in all paths
- FastTimer timer_endpaths; // track time spent in all endpaths
- FastTimer timer_path; // track time spent in each path
- FastTimer::Clock::time_point timer_last_path; // record the stop of the last path run
- FastTimer::Clock::time_point timer_last_transition; // record the last transition (end source, end event, end lumi, end run)
-
- // time accounting per-event
- Timing timing;
- std::vector timing_perprocess;
-
- // luminosity per event
- std::vector luminosity;
-
- // overall plots
- SummaryPlots dqm; // whole event summary plots
- std::vector dqm_byluminosity; // whole event plots vs. "luminosity"
- std::vector dqm_perprocess; // per-process event summary plots
- std::vector> dqm_perprocess_byluminosity; // per-process plots vs. "luminosity"
-
- // plots by path
- std::vector dqm_paths;
-
- // per-path, per-module and per-module-type accounting
- PathInfo * current_path;
- ModuleInfo * current_module;
- PathMap paths;
- std::unordered_map modules;
- std::unordered_map moduletypes;
- ModuleMap fast_modules; // these assume that module ids are constant throughout the whole job,
- ModuleMap fast_moduletypes;
-
- StreamData() :
- // timers
- timer_event(),
- timer_source(),
- timer_paths(),
- timer_endpaths(),
- timer_path(),
- timer_last_path(),
- timer_last_transition(),
- // time accounting per-event
- timing(),
- timing_perprocess(),
- // luminosity per event
- luminosity(),
- // overall plots
- dqm(),
- dqm_byluminosity(),
- dqm_perprocess(),
- dqm_perprocess_byluminosity(),
- // plots by path
- dqm_paths(),
- // per-path, per-module and per-module-type accounting
- current_path(nullptr),
- current_module(nullptr),
- paths(),
- modules(),
- moduletypes(),
- fast_modules(),
- fast_moduletypes()
- { }
-
- // called in FastTimerService::postStreamEndRun()
- void reset() {
- // timers
- timer_event.reset();
- timer_source.reset();
- timer_paths.reset();
- timer_endpaths.reset();
- timer_path.reset();
- timer_last_path = FastTimer::Clock::time_point();
- timer_last_transition = FastTimer::Clock::time_point();
- // time accounting per-event
- timing.reset();
- for (auto & timing: timing_perprocess)
- timing.reset();
- // luminosity per event
- for (auto & lumi: luminosity)
- lumi = 0;
- // overall plots
- dqm.reset();
- for (auto & plots: dqm_byluminosity)
- plots.reset();
- for (auto & perprocess_plots: dqm_perprocess)
- perprocess_plots.reset();
- for (auto & process_plots: dqm_perprocess_byluminosity)
- for (auto & plots: process_plots)
- plots.reset();
- // plots by path
- for (auto & plots: dqm_paths)
- plots.reset();
- // per-path, per-module and per-module-type accounting
- current_path = nullptr;
- current_module = nullptr;
- for (auto & map: paths)
- for (auto & keyval: map)
- keyval.second.reset();
- for (auto & keyval: modules)
- keyval.second.reset();
- for (auto & keyval: moduletypes)
- keyval.second.reset();
- }
+ class PlotsPerProcess {
+ public:
+ PlotsPerProcess(ProcessCallGraph::ProcessType const&);
+ void reset();
+ void book(DQMStore::IBooker &, ProcessCallGraph const&, ProcessCallGraph::ProcessType const&,
+ double event_range, double event_resolution, double path_range, double path_resolution,
+ unsigned int lumisections, bool byls);
+ void fill(ProcessCallGraph::ProcessType const&, ResourcesPerJob const&, ResourcesPerProcess const&, unsigned int ls);
+
+ private:
+ // resources spent in all the modules of the (sub)process
+ PlotsPerElement event_;
+ // resources spent in each path and endpath
+ std::vector paths_;
+ std::vector endpaths_;
+ };
+ class PlotsPerJob {
+ public:
+ PlotsPerJob(ProcessCallGraph const& job, std::vector const& groups);
+ void reset();
+ void book(DQMStore::IBooker &, ProcessCallGraph const&, std::vector const&,
+ double event_range, double event_resolution, double path_range, double path_resolution,
+ double module_range, double module_resolution, unsigned int lumisections,
+ bool bymodule, bool byls);
+ void fill(ProcessCallGraph const&, ResourcesPerJob const&, unsigned int ls);
+
+ private:
+ // resources spent in all the modules of the job
+ PlotsPerElement event_;
+ // resources spent in the highlighted modules
+ std::vector highlight_;
+ // resources spent in each module
+ std::vector modules_;
+ // resources spent in each (sub)process
+ std::vector processes_;
};
- // process descriptions
- std::vector m_process;
- // description of the luminosity axes
- std::vector m_dqm_luminosity;
+ // keep track of the dependencies among modules
+ ProcessCallGraph callgraph_;
- // stream data
- std::vector m_stream;
+ // per-stream information
+ std::vector streams_;
+ std::vector stream_plots_;
// summary data
- std::vector m_run_summary; // whole event time accounting per-run
- Timing m_job_summary; // whole event time accounting per-run
- std::vector> m_run_summary_perprocess; // per-process time accounting per-job
- std::vector m_job_summary_perprocess; // per-process time accounting per-job
- std::mutex m_summary_mutex; // synchronise access to the summary objects across different threads
+ ResourcesPerJob job_summary_; // whole event time accounting per-job
+ std::vector run_summary_; // whole event time accounting per-run
+ std::mutex summary_mutex_; // synchronise access to the summary objects across different threads
+
+ // per-thread quantities, lazily allocated
+ tbb::enumerable_thread_specific, tbb::ets_key_per_instance>
+ threads_;
+
+ // atomic variables to keep track of the completion of each step, process by process
+ std::unique_ptr[]> subprocess_event_check_;
+ std::unique_ptr[]> subprocess_lumisection_check_;
+ std::unique_ptr[]> subprocess_run_check_;
+ std::unique_ptr[]> subprocess_global_run_check_;
- static
- double delta(FastTimer::Clock::time_point const & first, FastTimer::Clock::time_point const & second)
- {
- return std::chrono::duration_cast>(second - first).count();
- }
+ // retrieve the current thread's per-thread quantities
+ Measurement & thread();
- // associate to a path all the modules it contains
- void fillPathMap(unsigned int pid, std::string const & name, std::vector const & modules);
+ // job configuration
+ unsigned int concurrent_runs_;
+ unsigned int concurrent_streams_;
+ unsigned int concurrent_threads_;
- // find the first and last non-empty paths, optionally skipping the first one
- std::pair findFirstLast(unsigned int pid, std::vector const & paths, bool skip = false);
+ // logging configuration
+ const bool print_event_summary_; // print the time spent in each process, path and module after every event
+ const bool print_run_summary_; // print the time spent in each process, path and module for each run
+ const bool print_job_summary_; // print the time spent in each process, path and module for the whole job
- // print a timing summary for the run or job
- void printSummary(Timing const & summary, std::string const & label) const;
- void printProcessSummary(Timing const & total, TimingPerProcess const & summary, std::string const & label, std::string const & process) const;
+ // dqm configuration
+ unsigned int module_id_; // pseudo module id for the FastTimerService, needed by the thread-safe DQMStore
+
+ bool enable_dqm_; // non const, depends on the availability of the DQMStore
+ const bool enable_dqm_bymodule_;
+ const bool enable_dqm_byls_;
+ const bool enable_dqm_bynproc_;
+
+ const double dqm_eventtime_range_;
+ const double dqm_eventtime_resolution_;
+ const double dqm_pathtime_range_;
+ const double dqm_pathtime_resolution_;
+ const double dqm_moduletime_range_;
+ const double dqm_moduletime_resolution_;
+ const unsigned int dqm_lumisections_range_;
+ std::string dqm_path_;
+
+ std::vector
+ highlight_module_psets_; // non-const, cleared in postBeginJob()
+ std::vector highlight_modules_; // non-const, filled in postBeginJob()
+
+ // log unsupported signals
+ mutable tbb::concurrent_unordered_set unsupported_signals_; // keep track of unsupported signals received
+
+ // print the resource usage summary for en event, a run, or the while job
+ template
+ void printEvent(T& out, ResourcesPerJob const&) const;
+
+ template
+ void printSummary(T& out, ResourcesPerJob const&, std::string const& label) const;
- // assign a "process id" to a process, given its ProcessContext
- static
- unsigned int processID(edm::ProcessContext const *);
+ // check if this is the first process being signalled
+ bool isFirstSubprocess(edm::StreamContext const&);
+ bool isFirstSubprocess(edm::GlobalContext const&);
+ // check if this is the lest process being signalled
+ bool isLastSubprocess(std::atomic& check);
};
#endif // ! FastTimerService_h
diff --git a/HLTrigger/Timer/interface/ProcessCallGraph.h b/HLTrigger/Timer/interface/ProcessCallGraph.h
new file mode 100644
index 0000000000000..5813ff74817d5
--- /dev/null
+++ b/HLTrigger/Timer/interface/ProcessCallGraph.h
@@ -0,0 +1,199 @@
+#ifndef HLTrigger_Timer_interface_ProcessCallGraph_h
+#define HLTrigger_Timer_interface_ProcessCallGraph_h
+
+/*
+ *
+ */
+
+#include
+#include
+#include
+#include
+
+// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#include
+#include
+#include
+#pragma GCC diagnostic pop
+
+#include "DataFormats/Provenance/interface/ModuleDescription.h"
+#include "FWCore/ServiceRegistry/interface/PathsAndConsumesOfModulesBase.h"
+#include "FWCore/ServiceRegistry/interface/ProcessContext.h"
+#include "HLTrigger/Timer/interface/EDMModuleType.h"
+
+class ProcessCallGraph {
+public:
+
+ struct NodeType {
+ edm::ModuleDescription module_;
+ edm::EDMModuleType type_;
+ bool scheduled_;
+ };
+
+ // directed graph, with `NodeType` properties attached to each vertex
+ using GraphType = boost::subgraph,
+ // graph properties, used to name each boost::subgraph
+ boost::property
+ >>;
+
+ // store the details of each path: name, modules on the path, and their dependencies
+ struct PathType {
+ std::string name_;
+ std::vector modules_on_path_;
+ std::vector modules_and_dependencies_;
+ std::vector last_dependency_of_module_; // one-after-the-last dependency of each module, as indices into modules_and_dependencies_
+
+ PathType() = default;
+
+ PathType(std::string const & name, std::vector const & mop, std::vector const & mad, std::vector const & ldom) :
+ name_(name),
+ modules_on_path_(mop),
+ modules_and_dependencies_(mad),
+ last_dependency_of_module_(ldom)
+ { }
+
+ PathType(std::string && name, std::vector && mop, std::vector && mad, std::vector && ldom) :
+ name_(std::move(name)),
+ modules_on_path_(std::move(mop)),
+ modules_and_dependencies_(std::move(mad)),
+ last_dependency_of_module_(std::move(ldom))
+ { }
+
+ PathType(PathType const & other) = default;
+
+ PathType(PathType && other) = default;
+
+ ~PathType() = default;
+
+ PathType & operator=(PathType const & other) = default;
+
+ };
+
+ // store the details of each process: name, modules call subgraph, modules, paths and endpaths, subprocess pids
+ struct ProcessType {
+ std::string name_;
+ GraphType const & graph_;
+ std::vector modules_;
+ std::vector paths_;
+ std::vector endPaths_;
+ std::vector subprocesses_;
+
+ ProcessType() = delete;
+
+ ProcessType(
+ std::string const & name,
+ GraphType const & graph,
+ std::vector const & modules,
+ std::vector const & paths,
+ std::vector const & endPaths,
+ std::vector const & subprocesses = {}
+ ) :
+ name_(name),
+ graph_(graph),
+ modules_(modules),
+ paths_(paths),
+ endPaths_(endPaths),
+ subprocesses_(subprocesses)
+ { }
+
+ ProcessType(
+ std::string && name,
+ GraphType const & graph,
+ std::vector && modules,
+ std::vector && paths,
+ std::vector && endPaths,
+ std::vector && subprocesses = {}
+ ) :
+ name_(std::move(name)),
+ graph_(graph),
+ modules_(std::move(modules)),
+ paths_(std::move(paths)),
+ endPaths_(std::move(endPaths)),
+ subprocesses_(std::move(subprocesses))
+ { }
+
+ ProcessType(ProcessType const & other) = default;
+ ProcessType(ProcessType && other) = default;
+
+ ProcessType & operator=(ProcessType const & other) = default;
+ ProcessType & operator=(ProcessType && other) = default;
+ };
+
+public:
+ // default c'tor
+ ProcessCallGraph();
+
+ // to be called from preSourceConstruction(...)
+ void preSourceConstruction(edm::ModuleDescription const &);
+
+ // to be called from preBeginJob(...)
+ void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &);
+
+ // number of modules stored in the call graph
+ unsigned int size() const;
+
+ // retrieve the ModuleDescription associated to the Source
+ edm::ModuleDescription const & source() const;
+
+ // retrieve the ModuleDescription associated to the given id
+ edm::ModuleDescription const & module(unsigned int module) const;
+
+ // retrieve the full information for a given module
+ NodeType const & operator[](unsigned int module) const;
+
+ // find the dependencies of the given module
+ std::vector depends(unsigned int module) const;
+
+ // find the dependencies of all modules in the given path
+ std::pair, std::vector> dependencies(std::vector const & path);
+
+ // retrieve the "process id" of a process, given its ProcessContex
+ unsigned int processId(edm::ProcessContext const &) const;
+
+ // retrieve the "process id" of a process, given its name
+ unsigned int processId(std::string const &) const;
+
+ // retrieve the processes
+ std::vector const & processes() const;
+
+ // retrieve information about a process, given its "process id"
+ ProcessType const & processDescription(unsigned int) const;
+
+ // retrieve information about a process, given its ProcessContex
+ ProcessType const & processDescription(edm::ProcessContext const &) const;
+
+ // retrieve information about a process, given its name
+ ProcessType const & processDescription(std::string const &) const;
+
+private:
+
+ // register a (sub)process and assigns it a "process id"
+ unsigned int registerProcess(edm::ProcessContext const &);
+
+private:
+
+ GraphType graph_;
+
+ // module id of the Source
+ unsigned int source_;
+
+ // map each (sub)process name to a "process id"
+ std::unordered_map process_id_;
+
+ // description of each process
+ std::vector process_description_;
+
+};
+
+#endif // not defined HLTrigger_Timer_interface_ProcessCallGraph_h
diff --git a/HLTrigger/Timer/plugins/FTSLuminosityFromLumiSummary.cc b/HLTrigger/Timer/plugins/FTSLuminosityFromLumiSummary.cc
deleted file mode 100644
index 8273ca0dd049a..0000000000000
--- a/HLTrigger/Timer/plugins/FTSLuminosityFromLumiSummary.cc
+++ /dev/null
@@ -1,163 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDAnalyzer.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/Framework/interface/EventSetup.h"
-#include "FWCore/Framework/interface/ESHandle.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-#include "DataFormats/Luminosity/interface/LumiSummary.h"
-#include "RecoLuminosity/LumiProducer/interface/LumiCorrectionParam.h"
-
-class FTSLuminosityFromLumiSummary : public edm::global::EDAnalyzer<> {
-public:
- explicit FTSLuminosityFromLumiSummary(edm::ParameterSet const &);
- ~FTSLuminosityFromLumiSummary();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- enum class Type {
- InstantaneousLuminosity,
- Pileup,
- Invalid = -1
- };
-
- static Type parse(std::string const & type) {
- if (type == "InstantaneousLuminosity")
- return Type::InstantaneousLuminosity;
- else if (type == "Pileup")
- return Type::Pileup;
- else
- return Type::Invalid;
- }
-
- edm::EDGetTokenT m_token;
- double m_cross_section;
- Type m_type;
- unsigned int m_lumi_id;
- std::vector m_value; // values are per-stream, computed in the StreamBeginLuminosityBlock and used in each event
-
- virtual void preallocStreams(unsigned int size) override;
- virtual void doStreamBeginLuminosityBlock_(edm::StreamID id, edm::LuminosityBlock const & lumi, edm::EventSetup const & setup) override;
- virtual void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
-};
-
-FTSLuminosityFromLumiSummary::FTSLuminosityFromLumiSummary(edm::ParameterSet const & config) :
- m_token(consumes(config.getParameter("source"))),
- m_cross_section(config.getParameter("crossSection")),
- m_type(parse(config.getParameter("type"))),
- m_lumi_id((unsigned int) -1)
-{
- if (not edm::Service().isAvailable())
- return;
-
- std::string const & name = config.getParameter("name");
- std::string const & title = config.getParameter("title");
- std::string const & label = config.getParameter("label");
- double range = config.getParameter("range");
- double resolution = config.getParameter("resolution");
-
- m_lumi_id = edm::Service()->reserveLuminosityPlots(name, title, label, range, resolution);
-}
-
-FTSLuminosityFromLumiSummary::~FTSLuminosityFromLumiSummary()
-{
-}
-
-void FTSLuminosityFromLumiSummary::preallocStreams(unsigned int size)
-{
- m_value.resize(size, 0.);
-}
-
-void FTSLuminosityFromLumiSummary::doStreamBeginLuminosityBlock_(edm::StreamID sid, edm::LuminosityBlock const & lumi, edm::EventSetup const & setup)
-{
- m_value[sid] = 0.;
-
- edm::ESHandle corrector;
- setup.getData(corrector);
- if (not corrector.isValid()) {
- edm::LogError("FTSLuminosityFromLumiSummary") << "unable to calibrate the raw luminosity values, please add a LumiCorrectionSource ESProducer to your configuration";
- return;
- }
-
- edm::Handle h_summary;
- if (lumi.getByToken(m_token, h_summary)) {
- double correction = corrector->getCorrection(h_summary->avgInsDelLumi());
- /*
- std::cerr << "LumiSummary loaded" << std::endl;
- std::cerr << " uncorrected luminosity: " << h_summary->avgInsDelLumi() << std::endl;
- std::cerr << " correction factor: " << correction << std::endl;
- std::cerr << " corrected luminosity: " << h_summary->avgInsDelLumi() * correction * 1.e30 << std::endl;
- std::cerr << " integrated luminosity: " << h_summary->intgDelLumi() * correction * 1.e30 << std::endl;
- std::cerr << " colliding bunches: " << corrector->ncollidingbunches() << std::endl;
- std::cerr << " orbits: " << h_summary->numOrbit() << std::endl;
- std::cerr << " pileup: " << h_summary->intgDelLumi() * correction * m_cross_section * 1.e3 / h_summary->numOrbit() / corrector->ncollidingbunches() << std::endl;
- */
- switch (m_type) {
- case Type::InstantaneousLuminosity:
- m_value[sid] = h_summary->avgInsDelLumi() * correction * 1.e30;
- break;
- case Type::Pileup:
- // integrated luminosity [nb-1] * pp cross section [mb] * 10^6 nb/mb / 2^18 orbits / number of colliding bunches
- m_value[sid] = h_summary->intgDelLumi() * correction * m_cross_section * 1.e3 / h_summary->numOrbit() / corrector->ncollidingbunches();
- break;
- case Type::Invalid:
- m_value[sid] = 0.;
- break;
- }
- }
-}
-
-void
-FTSLuminosityFromLumiSummary::analyze(edm::StreamID sid, edm::Event const & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return;
-
- edm::Service()->setLuminosity(sid, m_lumi_id, m_value[sid]);
-}
-
-void
-FTSLuminosityFromLumiSummary::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- // instantaneous luminosity
- {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("lumiProducer"));
- desc.add("crossSection", 69.3);
- desc.add("type", "InstantaneousLuminosity");
- desc.add("name", "luminosity");
- desc.add("title", "instantaneous luminosity");
- desc.add("label", "instantaneous luminosity [cm^{-2}s^{-1}]");
- desc.add("range", 8.e33);
- desc.add("resolution", 1.e31);
- descriptions.add("ftsLuminosityFromLumiSummary", desc);
- }
- // pileup
- {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("lumiProducer"));
- desc.add("crossSection", 69.3);
- desc.add("type", "Pileup");
- desc.add("name", "pileup");
- desc.add("title", "pileup");
- desc.add("label", "pileup");
- desc.add("range", 40);
- desc.add("resolution", 1);
- descriptions.add("ftsPileupFromLumiSummary", desc);
- }
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FTSLuminosityFromLumiSummary);
diff --git a/HLTrigger/Timer/plugins/FTSLuminosityFromPileupSummaryInfo.cc b/HLTrigger/Timer/plugins/FTSLuminosityFromPileupSummaryInfo.cc
deleted file mode 100644
index f6604ce214aa7..0000000000000
--- a/HLTrigger/Timer/plugins/FTSLuminosityFromPileupSummaryInfo.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDAnalyzer.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
-
-class FTSLuminosityFromPileupSummaryInfo : public edm::global::EDAnalyzer<> {
-public:
- explicit FTSLuminosityFromPileupSummaryInfo(edm::ParameterSet const &);
- ~FTSLuminosityFromPileupSummaryInfo();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- edm::EDGetTokenT> m_token;
- unsigned int m_lumi_id;
-
- void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
-};
-
-FTSLuminosityFromPileupSummaryInfo::FTSLuminosityFromPileupSummaryInfo(edm::ParameterSet const & config) :
- m_token(consumes>(config.getParameter("source"))),
- m_lumi_id((unsigned int) -1)
-{
- if (not edm::Service().isAvailable())
- return;
-
- std::string const & name = config.getParameter("name");
- std::string const & title = config.getParameter("title");
- std::string const & label = config.getParameter("label");
- double range = config.getParameter("range");
- double resolution = config.getParameter("resolution");
-
- m_lumi_id = edm::Service()->reserveLuminosityPlots(name, title, label, range, resolution);
-}
-
-FTSLuminosityFromPileupSummaryInfo::~FTSLuminosityFromPileupSummaryInfo()
-{
-}
-
-void
-FTSLuminosityFromPileupSummaryInfo::analyze(edm::StreamID sid, edm::Event const & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return;
-
- double value = 0.;
- edm::Handle> h_summary;
- if (event.getByToken(m_token, h_summary)) {
- for (PileupSummaryInfo const & pileup: *h_summary) {
- // only use the in-time pileup
- if (pileup.getBunchCrossing() == 0) {
- // use the per-event in-time pileup
- value = pileup.getPU_NumInteractions();
- // use the average pileup
- // value = pileup.getTrueNumInteractions();
- break;
- }
- }
- }
-
- edm::Service()->setLuminosity(sid, m_lumi_id, value);
-}
-
-void
-FTSLuminosityFromPileupSummaryInfo::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("addPileupInfo"));
- desc.add("name", "pileup");
- desc.add("title", "in-time pileup");
- desc.add("label", "in-time pileup");
- desc.add("range", 40);
- desc.add("resolution", 1);
- descriptions.add("ftsLuminosityFromPileupSummaryInfo", desc);
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FTSLuminosityFromPileupSummaryInfo);
diff --git a/HLTrigger/Timer/plugins/FTSLuminosityFromPixelClusters.cc b/HLTrigger/Timer/plugins/FTSLuminosityFromPixelClusters.cc
deleted file mode 100644
index c61a8e9b42160..0000000000000
--- a/HLTrigger/Timer/plugins/FTSLuminosityFromPixelClusters.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDAnalyzer.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
-
-class FTSLuminosityFromPixelClusters : public edm::global::EDAnalyzer<> {
-public:
- explicit FTSLuminosityFromPixelClusters(edm::ParameterSet const &);
- ~FTSLuminosityFromPixelClusters();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- edm::EDGetTokenT m_token;
- unsigned int m_lumi_id;
-
- void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
-};
-
-FTSLuminosityFromPixelClusters::FTSLuminosityFromPixelClusters(edm::ParameterSet const & config) :
- m_token(consumes(config.getParameter("source"))),
- m_lumi_id((unsigned int) -1)
-{
- if (not edm::Service().isAvailable())
- return;
-
- std::string const & name = config.getParameter("name");
- std::string const & title = config.getParameter("title");
- std::string const & label = config.getParameter("label");
- double range = config.getParameter("range");
- double resolution = config.getParameter("resolution");
-
- m_lumi_id = edm::Service()->reserveLuminosityPlots(name, title, label, range, resolution);
-}
-
-FTSLuminosityFromPixelClusters::~FTSLuminosityFromPixelClusters()
-{
-}
-
-void
-FTSLuminosityFromPixelClusters::analyze(edm::StreamID sid, edm::Event const & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return;
-
- double value = 0.;
- edm::Handle h_clusters;
- if (event.getByToken(m_token, h_clusters))
- value = h_clusters->dataSize();
-
- edm::Service()->setLuminosity(sid, m_lumi_id, value);
-}
-
-void
-FTSLuminosityFromPixelClusters::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("siPixelClusters"));
- desc.add("name", "clusters");
- desc.add("title", "pixel clusters");
- desc.add("label", "pixel clusters");
- desc.add("range", 20000);
- desc.add("resolution", 500);
- descriptions.add("ftsLuminosityFromPixelClusters", desc);
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FTSLuminosityFromPixelClusters);
diff --git a/HLTrigger/Timer/plugins/FTSLuminosityFromScalers.cc b/HLTrigger/Timer/plugins/FTSLuminosityFromScalers.cc
deleted file mode 100644
index 719d207bc4d4b..0000000000000
--- a/HLTrigger/Timer/plugins/FTSLuminosityFromScalers.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDAnalyzer.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-#include "DataFormats/Scalers/interface/LumiScalers.h"
-
-class FTSLuminosityFromScalers : public edm::global::EDAnalyzer<> {
-public:
- explicit FTSLuminosityFromScalers(edm::ParameterSet const &);
- ~FTSLuminosityFromScalers();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- enum class Type {
- InstantaneousLuminosity,
- Pileup,
- Invalid = -1
- };
-
- static Type parse(std::string const & type) {
- if (type == "InstantaneousLuminosity")
- return Type::InstantaneousLuminosity;
- else if (type == "Pileup")
- return Type::Pileup;
- else
- return Type::Invalid;
- }
-
- edm::EDGetTokenT m_token;
- Type m_type;
- unsigned int m_lumi_id;
-
- void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
-};
-
-FTSLuminosityFromScalers::FTSLuminosityFromScalers(edm::ParameterSet const & config) :
- m_token(consumes(config.getParameter("source"))),
- m_type(parse(config.getParameter("type"))),
- m_lumi_id((unsigned int) -1)
-{
- if (not edm::Service().isAvailable())
- return;
-
- std::string const & name = config.getParameter("name");
- std::string const & title = config.getParameter("title");
- std::string const & label = config.getParameter("label");
- double range = config.getParameter("range");
- double resolution = config.getParameter("resolution");
-
- m_lumi_id = edm::Service()->reserveLuminosityPlots(name, title, label, range, resolution);
-}
-
-FTSLuminosityFromScalers::~FTSLuminosityFromScalers()
-{
-}
-
-void
-FTSLuminosityFromScalers::analyze(edm::StreamID sid, edm::Event const & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return;
-
- double value = 0.;
- edm::Handle h_luminosity;
- if (event.getByToken(m_token, h_luminosity) and not h_luminosity->empty()) {
- switch (m_type) {
- case Type::InstantaneousLuminosity:
- value = h_luminosity->front().instantLumi() * 1.e30;
- break;
- case Type::Pileup:
- value = h_luminosity->front().pileup();
- break;
- case Type::Invalid:
- value = 0.;
- break;
- }
- }
-
- edm::Service()->setLuminosity(sid, m_lumi_id, value);
-}
-
-void
-FTSLuminosityFromScalers::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- // instantaneous luminosity
- {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("scalersRawToDigi"));
- desc.add("type", "InstantaneousLuminosity");
- desc.add("name", "luminosity");
- desc.add("title", "instantaneous luminosity");
- desc.add("label", "instantaneous luminosity [cm^{-2}s^{-1}]");
- desc.add("range", 8.e33);
- desc.add("resolution", 1.e31);
- descriptions.add("ftsLuminosityFromScalers", desc);
- }
- // pileup
- {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("scalersRawToDigi"));
- desc.add("type", "Pileup");
- desc.add("name", "pileup");
- desc.add("title", "pileup");
- desc.add("label", "pileup");
- desc.add("range", 40);
- desc.add("resolution", 1);
- descriptions.add("ftsPileupFromScalers", desc);
- }
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FTSLuminosityFromScalers);
diff --git a/HLTrigger/Timer/plugins/FTSLuminosityFromVertices.cc b/HLTrigger/Timer/plugins/FTSLuminosityFromVertices.cc
deleted file mode 100644
index 801e08d3a2368..0000000000000
--- a/HLTrigger/Timer/plugins/FTSLuminosityFromVertices.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDAnalyzer.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-#include "DataFormats/VertexReco/interface/Vertex.h"
-#include "DataFormats/VertexReco/interface/VertexFwd.h"
-
-class FTSLuminosityFromVertices : public edm::global::EDAnalyzer<> {
-public:
- explicit FTSLuminosityFromVertices(edm::ParameterSet const &);
- ~FTSLuminosityFromVertices();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- edm::EDGetTokenT m_token;
- unsigned int m_lumi_id;
-
- void analyze(edm::StreamID sid, edm::Event const & event, const edm::EventSetup & setup) const override;
-};
-
-FTSLuminosityFromVertices::FTSLuminosityFromVertices(edm::ParameterSet const & config) :
- m_token(consumes(config.getParameter("source"))),
- m_lumi_id((unsigned int) -1)
-{
- if (not edm::Service().isAvailable())
- return;
-
- std::string const & name = config.getParameter("name");
- std::string const & title = config.getParameter("title");
- std::string const & label = config.getParameter("label");
- double range = config.getParameter("range");
- double resolution = config.getParameter("resolution");
-
- m_lumi_id = edm::Service()->reserveLuminosityPlots(name, title, label, range, resolution);
-}
-
-FTSLuminosityFromVertices::~FTSLuminosityFromVertices()
-{
-}
-
-void
-FTSLuminosityFromVertices::analyze(edm::StreamID sid, edm::Event const & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return;
-
- double value = 0.;
- edm::Handle collection;
- if (event.getByToken(m_token, collection))
- value = collection->size();
-
- edm::Service()->setLuminosity(sid, m_lumi_id, value);
-}
-
-void
-FTSLuminosityFromVertices::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("source", edm::InputTag("siPixelClusters"));
- desc.add("name", "vertices");
- desc.add("title", "reconstructed vertices");
- desc.add("label", "reconstructed vertices");
- desc.add("range", 40);
- desc.add("resolution", 1);
- descriptions.add("ftsLuminosityFromVertices", desc);
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FTSLuminosityFromVertices);
diff --git a/HLTrigger/Timer/plugins/FastTimerFilter.cc b/HLTrigger/Timer/plugins/FastTimerFilter.cc
deleted file mode 100644
index 221e907bebcc4..0000000000000
--- a/HLTrigger/Timer/plugins/FastTimerFilter.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// C++ headers
-#include
-#include
-
-// CMSSW headers
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/global/EDFilter.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/Run.h"
-#include "FWCore/Framework/interface/LuminosityBlock.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "FWCore/ParameterSet/interface/Registry.h"
-#include "FWCore/ServiceRegistry/interface/Service.h"
-#include "HLTrigger/Timer/interface/FastTimerService.h"
-
-class FastTimerFilter : public edm::global::EDFilter<> {
-public:
- explicit FastTimerFilter(edm::ParameterSet const &);
- ~FastTimerFilter();
-
- static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
-
-private:
- const double m_time_limit_event;
- const double m_time_limit_path;
- const double m_time_limit_allpaths;
-
- bool filter(edm::StreamID sid, edm::Event & event, const edm::EventSetup & setup) const override;
-};
-
-FastTimerFilter::FastTimerFilter(edm::ParameterSet const & config) :
- m_time_limit_event( config.getParameter( "timeLimitPerEvent" )),
- m_time_limit_path( config.getParameter( "timeLimitPerPath" )),
- m_time_limit_allpaths( config.getParameter( "timeLimitPerAllPaths" ))
-{
-}
-
-FastTimerFilter::~FastTimerFilter()
-{
-}
-
-bool
-FastTimerFilter::filter(edm::StreamID sid, edm::Event & event, edm::EventSetup const & setup) const
-{
- if (not edm::Service().isAvailable())
- return false;
-
- /* FIXME re-enable
- FastTimerService const & fts = * edm::Service();
- if (m_time_limit_allpaths > 0. and fts.queryPathsTime(sid) > m_time_limit_allpaths)
- return true;
- if (m_time_limit_event > 0. and fts.currentEventTime(sid) > m_time_limit_event)
- return true;
- if (m_time_limit_path > 0. and fts.currentPathTime(sid) > m_time_limit_path)
- return true;
- */
-
- return false;
-}
-
-void
-FastTimerFilter::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
- // The following says we do not know what parameters are allowed so do no validation
- // Please change this to state exactly what you do use, even if it is no parameters
- edm::ParameterSetDescription desc;
- desc.add("timeLimitPerEvent", 0.);
- desc.add("timeLimitPerPath", 0.);
- desc.add("timeLimitPerAllPaths", 120.);
- descriptions.addDefault(desc);
-}
-
-//define this as a plug-in
-#include "FWCore/Framework/interface/MakerMacros.h"
-DEFINE_FWK_MODULE(FastTimerFilter);
diff --git a/HLTrigger/Timer/plugins/ThroughputService.cc b/HLTrigger/Timer/plugins/ThroughputService.cc
index 04efe2beab523..fc8636c5060b6 100644
--- a/HLTrigger/Timer/plugins/ThroughputService.cc
+++ b/HLTrigger/Timer/plugins/ThroughputService.cc
@@ -43,7 +43,7 @@ ThroughputService::preallocate(edm::service::SystemBounds const & bounds)
m_stream_histograms.resize( bounds.maxNumberOfStreams() );
- // assign a pseudo module id to the FastTimerService
+ // assign a pseudo module id to the ThroughputService
m_module_id = edm::ModuleDescription::getUniqueID();
}
diff --git a/HLTrigger/Timer/plugins/ThroughputService.h b/HLTrigger/Timer/plugins/ThroughputService.h
index ba8a8ec2bbd33..89660ea685097 100644
--- a/HLTrigger/Timer/plugins/ThroughputService.h
+++ b/HLTrigger/Timer/plugins/ThroughputService.h
@@ -24,7 +24,6 @@
#include "DataFormats/Provenance/interface/EventID.h"
#include "DataFormats/Provenance/interface/Timestamp.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
-#include "HLTrigger/Timer/interface/FastTimer.h"
class ThroughputService {
public:
@@ -64,7 +63,7 @@ class ThroughputService {
double m_time_resolution;
// DQM service-related data members
- unsigned int m_module_id; // pseudo module id for the FastTimerService, needed by the thread-safe DQMStore
+ unsigned int m_module_id; // pseudo module id for the ThroughputService, needed by the thread-safe DQMStore
std::string m_dqm_path;
};
diff --git a/HLTrigger/Timer/src/EDMModuleType.cc b/HLTrigger/Timer/src/EDMModuleType.cc
new file mode 100644
index 0000000000000..3fb45b796e394
--- /dev/null
+++ b/HLTrigger/Timer/src/EDMModuleType.cc
@@ -0,0 +1,40 @@
+#include
+
+#include "DataFormats/Provenance/interface/ModuleDescription.h"
+#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "FWCore/ParameterSet/interface/Registry.h"
+#include "HLTrigger/Timer/interface/EDMModuleType.h"
+
+namespace edm {
+
+EDMModuleType edmModuleTypeEnum(edm::ModuleDescription const & module)
+{
+ auto const & registry = * edm::pset::Registry::instance();
+ auto const & pset = * registry.getMapped(module.parameterSetID());
+
+ if (not pset.existsAs("@module_edm_type"))
+ return EDMModuleType::kUnknown;
+
+ std::string const & t = pset.getParameter("@module_edm_type");
+ for (EDMModuleType v: {
+ EDMModuleType::kSource,
+ EDMModuleType::kESSource,
+ EDMModuleType::kESProducer,
+ EDMModuleType::kEDAnalyzer,
+ EDMModuleType::kEDProducer,
+ EDMModuleType::kEDFilter,
+ EDMModuleType::kOutputModule
+ }) {
+ if (t == module_type_desc[static_cast>(v)])
+ return v;
+ }
+ return EDMModuleType::kUnknown;
+}
+
+
+const char * edmModuleType(edm::ModuleDescription const & module)
+{
+ return module_type_desc[static_cast>(edmModuleTypeEnum(module))];
+}
+
+} // namespace edm
diff --git a/HLTrigger/Timer/src/FastTimer.cc b/HLTrigger/Timer/src/FastTimer.cc
deleted file mode 100644
index 3d2297a5097fa..0000000000000
--- a/HLTrigger/Timer/src/FastTimer.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// C++ headers
-#include
-#include
-#include
-#include
-
-#include "HLTrigger/Timer/interface/FastTimer.h"
-
-FastTimer::FastTimer() :
- m_start(),
- m_stop(),
- m_duration(Duration::zero()),
- m_state(State::kStopped)
-{ }
-
-// start the timer - only if it was not running
-void FastTimer::start() {
- if (m_state == State::kStopped) {
- m_start = Clock::now();
- m_stop = Clock::time_point();
- m_duration = Duration::zero();
- m_state = State::kRunning;
- } else {
- std::cerr << "attempting to start a " << describe() << " timer" << std::endl;
- }
-}
-
-// stop the timer - only if it was running
-void FastTimer::stop() {
- if (m_state == State::kRunning) {
- m_stop = Clock::now();
- m_duration += std::chrono::duration_cast(m_stop - m_start);
- m_state = State::kStopped;
- } else {
- std::cerr << "attempting to stop a " << describe() << " timer" << std::endl;
- }
-}
-
-// pause the timer - only if it was running
-void FastTimer::pause() {
- if (m_state == State::kRunning) {
- m_stop = Clock::now();
- m_duration += std::chrono::duration_cast(m_stop - m_start);
- m_state = State::kPaused;
- } else {
- std::cerr << "attempting to pause a " << describe() << " timer" << std::endl;
- }
-}
-
-// resume the timer - only if it was not running
-void FastTimer::resume() {
- if (m_state == State::kPaused) {
- m_start = Clock::now();
- m_stop = Clock::time_point();
- m_state = State::kRunning;
- } else {
- std::cerr << "attempting to resume a " << describe() << " timer" << std::endl;
- }
-}
-
-// reset the timer
-void FastTimer::reset() {
- m_start = Clock::time_point();
- m_stop = Clock::time_point();
- m_duration = Duration::zero();
- m_state = State::kStopped;
-}
-
-// read the accumulated time
-FastTimer::Duration FastTimer::value() const {
- return m_duration;
-}
-
-// read the accumulated time, in seconds
-double FastTimer::seconds() const {
- return std::chrono::duration_cast>(m_duration).count();
-}
-
-// if the timer is stopped, read the accumulate time
-// if the timer is running, also add the time up to "now"
-FastTimer::Duration FastTimer::untilNow() const {
- return m_duration + ( (m_state == State::kRunning) ? std::chrono::duration_cast(Clock::now() - m_start) : Duration::zero() );
-}
-
-double FastTimer::secondsUntilNow() const {
- return std::chrono::duration_cast>(untilNow()).count();
-}
-
-// return the current state
-FastTimer::State FastTimer::state() const {
- return m_state;
-}
-
-// descrbe the current state
-std::string const & FastTimer::describe() const {
- static const std::vector states{ "stopped", "running", "paused", "unknown" };
-
- switch (m_state) {
- case FastTimer::State::kStopped:
- case FastTimer::State::kRunning:
- case FastTimer::State::kPaused:
- return states[static_cast(m_state)];
-
- default:
- return states.back();
- }
-}
-
-FastTimer::Clock::time_point const & FastTimer::getStartTime() const {
- return m_start;
-}
-
-FastTimer::Clock::time_point const & FastTimer::getStopTime() const {
- return m_stop;
-}
-
-void FastTimer::setStartTime(FastTimer::Clock::time_point const & time) {
- if (m_state == State::kStopped) {
- m_start = time;
- m_stop = Clock::time_point();
- m_duration = Duration::zero();
- m_state = State::kRunning;
- } else {
- std::cerr << "attempting to start a " << describe() << " timer" << std::endl;
- }
-}
-
-void FastTimer::setStopTime(FastTimer::Clock::time_point const & time) {
- if (m_state == State::kRunning) {
- m_stop = time;
- m_duration += std::chrono::duration_cast(m_stop - m_start);
- m_state = State::kStopped;
- } else {
- std::cerr << "attempting to stop a " << describe() << " timer" << std::endl;
- }
-}
diff --git a/HLTrigger/Timer/src/FastTimerService.cc b/HLTrigger/Timer/src/FastTimerService.cc
index d5621e2103adb..6dd044fbc6150 100644
--- a/HLTrigger/Timer/src/FastTimerService.cc
+++ b/HLTrigger/Timer/src/FastTimerService.cc
@@ -15,9 +15,7 @@
// boost headers
#include
-
-// tbb headers
-#include