Skip to content

Commit

Permalink
Merge pull request #3435 from fwyzard/FastTimerService_fix_empty_path…
Browse files Browse the repository at this point in the history
…s_70x

FastTimerService: add protection against empty Paths or EndPaths
  • Loading branch information
davidlange6 committed Apr 23, 2014
2 parents 2182620 + ce5b291 commit 18e1fc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion HLTrigger/Timer/interface/FastTimerService.h
Expand Up @@ -233,7 +233,7 @@ class FastTimerService {
double summary_postmodules;
double summary_overhead;
double summary_total;
uint32_t last_run; // index of the last module run in this path
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
Expand Down
14 changes: 8 additions & 6 deletions HLTrigger/Timer/src/FastTimerService.cc
Expand Up @@ -810,7 +810,7 @@ void FastTimerService::postEvent(edm::StreamContext const & sc) {
PathInfo & pathinfo = keyval.second;
pathinfo.time_exclusive = pathinfo.time_overhead;

for (uint32_t i = 0; i <= pathinfo.last_run; ++i) {
for (uint32_t i = 0; i < pathinfo.last_run; ++i) {
ModuleInfo * module = pathinfo.modules[i];
if (module == 0)
// this is a module occurring more than once in the same path, skip it after the first occurrence
Expand Down Expand Up @@ -870,7 +870,7 @@ void FastTimerService::postEvent(edm::StreamContext const & sc) {

// fill detailed timing histograms
if (m_enable_dqm_bypath_details) {
for (uint32_t i = 0; i <= pathinfo.last_run; ++i) {
for (uint32_t i = 0; i < pathinfo.last_run; ++i) {
ModuleInfo * module = pathinfo.modules[i];
// skip duplicate modules
if (module == nullptr)
Expand All @@ -887,7 +887,7 @@ void FastTimerService::postEvent(edm::StreamContext const & sc) {
// - also for duplicate modules, to properly extract rejection information
// - fill the N+1th bin for paths accepting the event, so the FastTimerServiceClient can properly measure the last filter efficiency
if (m_enable_dqm_bypath_counters) {
for (uint32_t i = 0; i <= pathinfo.last_run; ++i)
for (uint32_t i = 0; i < pathinfo.last_run; ++i)
pathinfo.dqm_module_counter->Fill(i);
if (pathinfo.accept)
pathinfo.dqm_module_counter->Fill(pathinfo.modules.size());
Expand Down Expand Up @@ -1048,8 +1048,10 @@ void FastTimerService::postPathEvent(edm::StreamContext const & sc, edm::PathCon
// "overhead" will be active - current
// "total" will be active + the sum of the time spent in non-active modules

uint32_t last_run = status.index(); // index of the last module run in this path
for (uint32_t i = 0; i <= last_run; ++i) {
uint32_t last_run = 0; // index of the last module run in this path, plus one
if (status.wasrun() and not pathinfo.modules.empty())
last_run = status.index() + 1; // index of the last module run in this path, plus one
for (uint32_t i = 0; i < last_run; ++i) {
ModuleInfo * module = pathinfo.modules[i];

if (module == 0)
Expand Down Expand Up @@ -1095,7 +1097,7 @@ void FastTimerService::postPathEvent(edm::StreamContext const & sc, edm::PathCon
pathinfo.summary_postmodules += post;
pathinfo.summary_overhead += overhead;
pathinfo.summary_total += total;
pathinfo.last_run = status.index();
pathinfo.last_run = last_run;
pathinfo.accept = status.accept();
}
}
Expand Down

0 comments on commit 18e1fc5

Please sign in to comment.