42 std::vector<const ModuleDescription*>
const& iModules,
45 m_streamEventTimer(iNumStreams),
46 m_streamPathTiming(iNumStreams),
48 m_processContext(iProcessContext),
55 return iLHS->
id() < iRHS->id();
62 stream.resize(numModuleSlots);
67 std::vector<unsigned int> numModulesInPath;
68 std::vector<unsigned int> numModulesInEndPath;
70 const unsigned int numPaths = iNamesService.
getTrigPaths().size();
71 const unsigned int numEndPaths = iNamesService.
getEndPaths().size();
80 numModulesInPath.reserve(numPaths);
81 numModulesInEndPath.reserve(numEndPaths);
85 for(
unsigned int i =0;
i<numPaths;++
i) {
89 for(
unsigned int i =0;
i<numEndPaths;++
i) {
97 unsigned int index = 0;
98 stream.resize(numModulesInPath.size()+numModulesInEndPath.size());
99 for(
unsigned int numMods : numModulesInPath) {
100 stream[
index].m_moduleTiming.resize(numMods);
103 for(
unsigned int numMods : numModulesInEndPath) {
104 stream[
index].m_moduleTiming.resize(numMods);
153 timing.m_timer.start();
164 timing.m_timer.stop();
167 auto& modsOnPath = timing.m_moduleTiming;
168 for(
unsigned int i = 0;
i< iStatus.
index()+1;++
i) {
169 ++modsOnPath[
i].m_timesVisited;
195 modTiming.m_realTime +=
times;
210 modTiming.m_realTime +=
times;
237 unsigned int iEndIndex,
238 std::vector<std::string>
const& iPathNames,
239 std::vector<std::vector<std::string>>
const& iModulesOnPaths,
240 std::vector<std::vector<SystemTimeKeeper::PathTiming>>
const& iPathTimings,
241 std::vector<PathTimingSummary>& iSummary) {
242 iSummary.resize(iEndIndex-iStartIndex);
244 for(
auto const& stream: iPathTimings) {
245 auto it = iSummary.begin();
246 for(
unsigned int index = iStartIndex;
index < iEndIndex; ++
index, ++it) {
247 auto const& pathTiming = stream[
index];
248 it->name = iPathNames[
index];
249 it->bitPosition =
index-iStartIndex;
250 if(not pathTiming.m_moduleTiming.empty()) {
251 it->timesRun += pathTiming.m_moduleTiming[0].m_timesVisited;
253 it->realTime += pathTiming.m_timer.realTime();
254 if(it->moduleInPathSummaries.empty()) {
255 it->moduleInPathSummaries.resize(pathTiming.m_moduleTiming.size());
257 for(
unsigned int modIndex=0; modIndex < pathTiming.m_moduleTiming.size(); ++modIndex) {
258 auto const& modTiming =pathTiming.m_moduleTiming[modIndex];
259 auto& modSummary =it->moduleInPathSummaries[modIndex];
260 if(modSummary.moduleLabel.empty()) {
261 modSummary.moduleLabel = iModulesOnPaths[
index][modIndex];
263 modSummary.timesVisited += modTiming.m_timesVisited;
264 modSummary.realTime += modTiming.m_realTime;
274 double sumEventTime = 0.;
276 sumEventTime += stream.realTime();
288 std::map<std::string,unsigned int>
visited;
290 unsigned int pathIndex = 0;
291 for(
auto const&
path: stream) {
292 unsigned int modIndex = 0;
293 for(
auto const&
mod:
path.m_moduleTiming) {
301 unsigned int modIndex=0;
303 auto& outMod =
summary[modIndex];
304 outMod.moduleLabel =
mod->moduleLabel();
305 outMod.realTime = 0.;
309 auto const& timing = stream[moduleId];
310 outMod.realTime += timing.m_timer.realTime();
311 outMod.timesRun += timing.m_timesRun;
313 outMod.timesVisited = visited[
mod->moduleLabel()];
314 if(0 == outMod.timesVisited) {
315 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
tuple size
Write out results.
bool checkBounds(unsigned int id) const
unsigned int index() const