42 std::vector<const ModuleDescription*>
const& iModules,
45 : m_streamEventTimer(iNumStreams),
46 m_streamPathTiming(iNumStreams),
48 m_processContext(iProcessContext),
53 return iLHS->
id() < iRHS->id();
60 stream.resize(numModuleSlots);
64 std::vector<unsigned int> numModulesInPath;
65 std::vector<unsigned int> numModulesInEndPath;
67 const unsigned int numPaths = iNamesService.
getTrigPaths().size();
68 const unsigned int numEndPaths = iNamesService.
getEndPaths().size();
73 numModulesInPath.reserve(numPaths);
74 numModulesInEndPath.reserve(numEndPaths);
78 for (
unsigned int i = 0;
i < numPaths; ++
i) {
82 for (
unsigned int i = 0;
i < numEndPaths; ++
i) {
90 unsigned int index = 0;
91 stream.resize(numModulesInPath.size() + numModulesInEndPath.size());
92 for (
unsigned int numMods : numModulesInPath) {
93 stream[
index].m_moduleTiming.resize(numMods);
96 for (
unsigned int numMods : numModulesInEndPath) {
97 stream[
index].m_moduleTiming.resize(numMods);
136 timing.m_timer.start();
143 timing.m_timer.stop();
146 auto& modsOnPath = timing.m_moduleTiming;
147 for (
unsigned int i = 0;
i < iStatus.
index() + 1; ++
i) {
148 ++modsOnPath[
i].m_timesVisited;
169 modTiming.m_realTime +=
times;
182 modTiming.m_realTime +=
times;
198 unsigned int iEndIndex,
199 std::vector<std::string>
const& iPathNames,
200 std::vector<std::vector<std::string>>
const& iModulesOnPaths,
201 std::vector<std::vector<SystemTimeKeeper::PathTiming>>
const& iPathTimings,
202 std::vector<PathTimingSummary>& iSummary) {
203 iSummary.resize(iEndIndex - iStartIndex);
205 for (
auto const& stream : iPathTimings) {
206 auto it = iSummary.begin();
207 for (
unsigned int index = iStartIndex;
index < iEndIndex; ++
index, ++it) {
209 it->name = iPathNames[
index];
210 it->bitPosition =
index - iStartIndex;
215 if (it->moduleInPathSummaries.empty()) {
220 auto& modSummary = it->moduleInPathSummaries[modIndex];
221 if (modSummary.moduleLabel.empty()) {
222 modSummary.moduleLabel = iModulesOnPaths[
index][modIndex];
224 modSummary.timesVisited += modTiming.m_timesVisited;
225 modSummary.realTime += modTiming.m_realTime;
234 double sumEventTime = 0.;
236 sumEventTime += stream.realTime();
248 std::map<std::string, unsigned int>
visited;
250 unsigned int pathIndex = 0;
251 for (
auto const&
path : stream) {
252 unsigned int modIndex = 0;
253 for (
auto const&
mod :
path.m_moduleTiming) {
261 unsigned int modIndex = 0;
263 auto& outMod =
summary[modIndex];
264 outMod.moduleLabel =
mod->moduleLabel();
265 outMod.realTime = 0.;
269 auto const& timing = stream[moduleId];
270 outMod.realTime += timing.m_timer.realTime();
271 outMod.timesRun += timing.m_timesRun;
273 outMod.timesVisited = visited[
mod->moduleLabel()];
274 if (0 == outMod.timesVisited) {
275 outMod.timesVisited = outMod.timesRun;
std::vector< std::vector< std::string > > m_modulesOnPaths
void fillTriggerTimingReport(TriggerTimingReport &rep) const
std::vector< PathTimingSummary > endPathSummaries
Strings const & getTrigPathModules(std::string const &name) const
unsigned int m_minModuleID
void stopEvent(StreamContext const &)
void startProcessingLoop()
std::atomic< unsigned int > m_numberOfEvents
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
Strings const & getEndPaths() const
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::vector< ModuleInPathTiming > m_moduleTiming
std::vector< std::vector< ModuleTiming > > m_streamModuleTiming
void stopProcessingLoop()
void startEvent(StreamID)
std::vector< std::string > m_pathNames
Strings const & getEndPathModules(std::string const &name) const
std::vector< const ModuleDescription * > m_modules
EventTimingSummary eventSummary
ProcessContext const * m_processContext
ModuleDescription const * moduleDescription() const
static void fillPathSummary(Path const &path, PathSummary &sum)
std::vector< PathTimingSummary > trigPathSummaries
unsigned int pathID() const
ProcessContext const * processContext() const
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
StreamID const & streamID() const
CPUTimer m_processingLoopTimer
SystemTimeKeeper(unsigned int iNumStreams, std::vector< const ModuleDescription * > const &iModules, service::TriggerNamesService const &iNameService, ProcessContext const *iProcessContext)
unsigned int value() const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
void startPath(StreamContext const &, PathContext const &)
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
Strings const & getTrigPaths() const
std::vector< WallclockTimer > m_streamEventTimer
PathTiming & pathTiming(StreamContext const &, PathContext const &)
unsigned int m_endPathOffset
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
PlaceInPathContext const * placeInPathContext() const
std::vector< std::vector< PathTiming > > m_streamPathTiming
bool checkBounds(unsigned int id) const
unsigned int index() const