Skip to content

Commit

Permalink
check that thread id is not writing out of vector. Affects case where
Browse files Browse the repository at this point in the history
process numberOfThreads = 1, but there seems to be more TBB threads.
  • Loading branch information
Srecko committed May 8, 2024
1 parent ab4ccb0 commit 4bb1cc6
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions EventFilter/Utilities/src/FastMonitoringService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,20 @@ namespace evf {
microstate_[getSID(sid)] = getmInput();
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = getmInput();
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = getmInput();
}

void FastMonitoringService::postSourceEvent(edm::StreamID sid) {
microstate_[getSID(sid)] = getmFwkOvhSrc();
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = getmIdle();
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = getmIdle();
}

void FastMonitoringService::preModuleEventAcquire(edm::StreamContext const& sc,
Expand All @@ -667,8 +673,11 @@ namespace evf {
microstateAcqFlag_[getSID(sc)] = 1;
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = (void*)(mcc.moduleDescription());
tmicrostateAcqFlag_[getTID()] = 1;
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = (void*)(mcc.moduleDescription());
tmicrostateAcqFlag_[tid] = 1;
}

void FastMonitoringService::postModuleEventAcquire(edm::StreamContext const& sc,
Expand All @@ -677,22 +686,31 @@ namespace evf {
microstateAcqFlag_[getSID(sc)] = 0;
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = getmIdle();
tmicrostateAcqFlag_[getTID()] = 0;
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = getmIdle();
tmicrostateAcqFlag_[tid] = 0;
}

void FastMonitoringService::preModuleEvent(edm::StreamContext const& sc, edm::ModuleCallingContext const& mcc) {
microstate_[getSID(sc)] = (void*)(mcc.moduleDescription());
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = (void*)(mcc.moduleDescription());
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = (void*)(mcc.moduleDescription());
}

void FastMonitoringService::postModuleEvent(edm::StreamContext const& sc, edm::ModuleCallingContext const& mcc) {
microstate_[getSID(sc)] = getmFwkOvhMod();
if (!tbbMonitoringMode_)
return;
tmicrostate_[getTID()] = getmIdle();
auto tid = getTID();
if (tid >= nThreads_)
return;
tmicrostate_[tid] = getmIdle();
}

//from source
Expand Down

0 comments on commit 4bb1cc6

Please sign in to comment.