#include <Path.h>
Public Types | |
typedef WorkersInPath::size_type | size_type |
typedef hlt::HLTState | State |
typedef boost::shared_ptr < HLTGlobalStatus > | TrigResPtr |
typedef std::vector< WorkerInPath > | WorkersInPath |
Public Member Functions | |
int | bitPosition () const |
void | clearCounters () |
Worker const * | getWorker (size_type i) const |
std::string const & | name () const |
Path (int bitpos, std::string const &path_name, WorkersInPath const &workers, TrigResPtr trptr, ActionTable const &actions, boost::shared_ptr< ActivityRegistry > reg, bool isEndPath) | |
template<typename T > | |
void | processOneOccurrence (typename T::MyPrincipal &, EventSetup const &) |
void | setEarlyDeleteHelpers (std::map< const Worker *, EarlyDeleteHelper * > const &) |
size_type | size () const |
State | state () const |
std::pair< double, double > | timeCpuReal () const |
std::pair< double, double > | timeCpuReal (unsigned int const i) const |
int | timesExcept (size_type i) const |
int | timesExcept () const |
int | timesFailed () const |
int | timesFailed (size_type i) const |
int | timesPassed () const |
int | timesPassed (size_type i) const |
int | timesRun () const |
int | timesVisited (size_type i) const |
void | useStopwatch () |
Private Member Functions | |
void | handleEarlyFinish (EventPrincipal &) |
void | handleEarlyFinish (RunPrincipal &) |
void | handleEarlyFinish (LuminosityBlockPrincipal &) |
bool | handleWorkerFailure (cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id) |
void | recordStatus (int nwrwue, bool isEvent) |
void | updateCounters (bool succeed, bool isEvent) |
Static Private Member Functions | |
static void | exceptionContext (cms::Exception &ex, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id) |
Private Attributes | |
ActionTable const * | act_table_ |
boost::shared_ptr < ActivityRegistry > | actReg_ |
int | bitpos_ |
std::vector< EarlyDeleteHelper * > | earlyDeleteHelpers_ |
bool | isEndPath_ |
std::string | name_ |
State | state_ |
RunStopwatch::StopwatchPointer | stopwatch_ |
int | timesExcept_ |
int | timesFailed_ |
int | timesPassed_ |
int | timesRun_ |
TrigResPtr | trptr_ |
WorkersInPath | workers_ |
typedef WorkersInPath::size_type edm::Path::size_type |
typedef hlt::HLTState edm::Path::State |
typedef boost::shared_ptr<HLTGlobalStatus> edm::Path::TrigResPtr |
typedef std::vector<WorkerInPath> edm::Path::WorkersInPath |
edm::Path::Path | ( | int | bitpos, |
std::string const & | path_name, | ||
WorkersInPath const & | workers, | ||
TrigResPtr | trptr, | ||
ActionTable const & | actions, | ||
boost::shared_ptr< ActivityRegistry > | reg, | ||
bool | isEndPath | ||
) |
Definition at line 13 of file Path.cc.
: stopwatch_(), timesRun_(), timesPassed_(), timesFailed_(), timesExcept_(), state_(hlt::Ready), bitpos_(bitpos), name_(path_name), trptr_(trptr), actReg_(areg), act_table_(&actions), workers_(workers), isEndPath_(isEndPath) { }
int edm::Path::bitPosition | ( | ) | const [inline] |
Definition at line 57 of file Path.h.
References bitpos_.
Referenced by edm::fillPathSummary(), and processOneOccurrence().
{ return bitpos_; }
void edm::Path::clearCounters | ( | ) |
Definition at line 143 of file Path.cc.
References edm::WorkerInPath::clearCounters(), edm::for_all(), timesExcept_, timesFailed_, timesPassed_, timesRun_, and workers_.
Referenced by edm::Schedule::clearCounters().
{ timesRun_ = timesPassed_ = timesFailed_ = timesExcept_ = 0; for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1)); }
void edm::Path::exceptionContext | ( | cms::Exception & | ex, |
bool | isEvent, | ||
bool | begin, | ||
BranchType | branchType, | ||
CurrentProcessingContext const & | cpc, | ||
std::string const & | id | ||
) | [static, private] |
Definition at line 79 of file Path.cc.
References cms::Exception::addContext(), errorMatrix2Lands_multiChannel::id, edm::InLumi, edm::InRun, edm::CurrentProcessingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and edm::CurrentProcessingContext::pathName().
Referenced by handleWorkerFailure().
{ std::ostringstream ost; if (isEvent) { ost << "Calling event method"; } else if (begin && branchType == InRun) { ost << "Calling beginRun"; } else if (begin && branchType == InLumi) { ost << "Calling beginLuminosityBlock"; } else if (!begin && branchType == InLumi) { ost << "Calling endLuminosityBlock"; } else if (!begin && branchType == InRun) { ost << "Calling endRun"; } else { // It should be impossible to get here ... ost << "Calling unknown function"; } if (cpc.moduleDescription()) { ost << " for module " << cpc.moduleDescription()->moduleName() << "/'" << cpc.moduleDescription()->moduleLabel() << "'"; } ex.addContext(ost.str()); ost.str(""); ost << "Running path '"; if (cpc.pathName()) { ost << *cpc.pathName() << "'"; } else { ost << "unknown'"; } ex.addContext(ost.str()); ost.str(""); ost << "Processing "; ost << id; ex.addContext(ost.str()); }
Definition at line 85 of file Path.h.
References workers_.
Referenced by edm::fillModuleInPathSummary(), and setEarlyDeleteHelpers().
void edm::Path::handleEarlyFinish | ( | EventPrincipal & | iEvent | ) | [private] |
Definition at line 176 of file Path.cc.
References earlyDeleteHelpers_.
Referenced by processOneOccurrence().
{ for(auto helper: earlyDeleteHelpers_) { helper->pathFinished(iEvent); } }
void edm::Path::handleEarlyFinish | ( | RunPrincipal & | ) | [inline, private] |
void edm::Path::handleEarlyFinish | ( | LuminosityBlockPrincipal & | ) | [inline, private] |
bool edm::Path::handleWorkerFailure | ( | cms::Exception & | e, |
int | nwrwue, | ||
bool | isEvent, | ||
bool | begin, | ||
BranchType | branchType, | ||
CurrentProcessingContext const & | cpc, | ||
std::string const & | id | ||
) | [private] |
Definition at line 35 of file Path.cc.
References act_table_, alignCSCRings::action, cms::Exception::addAdditionalInfo(), cms::Exception::category(), edm::Exception::codeToString(), Exception, exceptionContext(), edm::actions::FailPath, edm::ActionTable::find(), edm::printCmsExceptionWarning(), edm::errors::ProductNotFound, recordStatus(), edm::actions::Rethrow, state_, and timesExcept_.
Referenced by processOneOccurrence().
{ exceptionContext(e, isEvent, begin, branchType, cpc, id); bool should_continue = true; // there is no support as of yet for specific paths having // different exception behavior // If not processing an event, always rethrow. actions::ActionCodes action = (isEvent ? act_table_->find(e.category()) : actions::Rethrow); switch(action) { case actions::FailPath: { should_continue = false; edm::printCmsExceptionWarning("FailPath", e); break; } default: { if (isEvent) ++timesExcept_; state_ = hlt::Exception; recordStatus(nwrwue, isEvent); if (action == actions::Rethrow) { std::string pNF = Exception::codeToString(errors::ProductNotFound); if (e.category() == pNF) { std::ostringstream ost; ost << "If you wish to continue processing events after a " << pNF << " exception,\n" << "add \"SkipEvent = cms.untracked.vstring('ProductNotFound')\" to the \"options\" PSet in the configuration.\n"; e.addAdditionalInfo(ost.str()); } } throw; } } return should_continue; }
std::string const& edm::Path::name | ( | void | ) | const [inline] |
Definition at line 58 of file Path.h.
References name_.
Referenced by edm::Schedule::availablePaths(), edm::fillPathSummary(), and edm::Schedule::modulesInPath().
{ return name_; }
void edm::Path::processOneOccurrence | ( | typename T::MyPrincipal & | ep, |
EventSetup const & | es | ||
) |
Definition at line 157 of file Path.h.
References edm::CurrentProcessingContext::activate(), actReg_, edm::convertException::badAllocToEDM(), bitPosition(), trackerHits::c, edm::convertException::charPtrToEDM(), alignCSCRings::e, end, exception, handleEarlyFinish(), handleWorkerFailure(), i, UserOptions_cff::idx, isEndPath_, name_, Ready, recordStatus(), alignCSCRings::s, state_, edm::convertException::stdToEDM(), stopwatch_, edm::convertException::stringToEDM(), timesRun_, edm::convertException::unknownToEDM(), updateCounters(), and workers_.
Referenced by edm::ProcessOneOccurrence< T >::operator()().
{ //Create the PathSignalSentry before the RunStopwatch so that // we only record the time spent in the path not from the signal int nwrwue = -1; PathSignalSentry<T> signaler(actReg_.get(), name_, nwrwue, state_); // A RunStopwatch, but only if we are processing an event. RunStopwatch stopwatch(T::isEvent_ ? stopwatch_ : RunStopwatch::StopwatchPointer()); if (T::isEvent_) { ++timesRun_; } state_ = hlt::Ready; // nwrue = numWorkersRunWithoutUnhandledException bool should_continue = true; CurrentProcessingContext cpc(&name_, bitPosition(), isEndPath_); WorkersInPath::size_type idx = 0; // It seems likely that 'nwrwue' and 'idx' can never differ --- // if so, we should remove one of them!. for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end(); i != end && should_continue; ++i, ++idx) { ++nwrwue; assert (static_cast<int>(idx) == nwrwue); try { try { cpc.activate(idx, i->getWorker()->descPtr()); should_continue = i->runWorker<T>(ep, es, &cpc); } catch (cms::Exception& e) { throw; } catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); } catch (std::exception& e) { convertException::stdToEDM(e); } catch(std::string& s) { convertException::stringToEDM(s); } catch(char const* c) { convertException::charPtrToEDM(c); } catch (...) { convertException::unknownToEDM(); } } catch(cms::Exception& ex) { // handleWorkerFailure may throw a new exception. std::ostringstream ost; ost << ep.id(); should_continue = handleWorkerFailure(ex, nwrwue, T::isEvent_, T::begin_, T::branchType_, cpc, ost.str()); } } if (not should_continue) { handleEarlyFinish(ep); } updateCounters(should_continue, T::isEvent_); recordStatus(nwrwue, T::isEvent_); }
void edm::Path::recordStatus | ( | int | nwrwue, |
bool | isEvent | ||
) | [private] |
Definition at line 125 of file Path.cc.
References bitpos_, and state_.
Referenced by handleWorkerFailure(), and processOneOccurrence().
void edm::Path::setEarlyDeleteHelpers | ( | std::map< const Worker *, EarlyDeleteHelper * > const & | iWorkerToDeleter | ) |
Definition at line 159 of file Path.cc.
References earlyDeleteHelpers_, newFWLiteAna::found, getWorker(), getHLTprescales::index, size(), and groupFilesInBlocks::temp.
{ //we use a temp so we can overset the size but then when moving to earlyDeleteHelpers we only // have to use the space necessary std::vector<EarlyDeleteHelper*> temp; temp.reserve(iWorkerToDeleter.size()); for(unsigned int index=0; index !=size();++index) { auto found = iWorkerToDeleter.find(getWorker(index)); if(found != iWorkerToDeleter.end()) { temp.push_back(found->second); found->second->addedToPath(); } } std::vector<EarlyDeleteHelper*> tempCorrectSize(temp.begin(),temp.end()); earlyDeleteHelpers_.swap(tempCorrectSize); }
size_type edm::Path::size | ( | void | ) | const [inline] |
Definition at line 80 of file Path.h.
References workers_.
Referenced by edm::fillPathSummary(), and setEarlyDeleteHelpers().
{ return workers_.size(); }
State edm::Path::state | ( | ) | const [inline] |
std::pair<double, double> edm::Path::timeCpuReal | ( | ) | const [inline] |
Definition at line 60 of file Path.h.
References stopwatch_.
{ if(stopwatch_) { return std::pair<double, double>(stopwatch_->cpuTime(), stopwatch_->realTime()); } return std::pair<double, double>(0., 0.); }
std::pair<double, double> edm::Path::timeCpuReal | ( | unsigned int const | i | ) | const [inline] |
int edm::Path::timesExcept | ( | size_type | i | ) | const [inline] |
int edm::Path::timesExcept | ( | ) | const [inline] |
Definition at line 76 of file Path.h.
References timesExcept_.
Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().
{ return timesExcept_; }
int edm::Path::timesFailed | ( | ) | const [inline] |
Definition at line 75 of file Path.h.
References timesFailed_.
Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().
{ return timesFailed_; }
int edm::Path::timesFailed | ( | size_type | i | ) | const [inline] |
int edm::Path::timesPassed | ( | size_type | i | ) | const [inline] |
int edm::Path::timesPassed | ( | ) | const [inline] |
Definition at line 74 of file Path.h.
References timesPassed_.
Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().
{ return timesPassed_; }
int edm::Path::timesRun | ( | ) | const [inline] |
Definition at line 73 of file Path.h.
References timesRun_.
Referenced by edm::fillPathSummary().
{ return timesRun_; }
int edm::Path::timesVisited | ( | size_type | i | ) | const [inline] |
void edm::Path::updateCounters | ( | bool | succeed, |
bool | isEvent | ||
) | [private] |
Definition at line 132 of file Path.cc.
References Fail, Pass, state_, timesFailed_, and timesPassed_.
Referenced by processOneOccurrence().
{ if (success) { if (isEvent) ++timesPassed_; state_ = hlt::Pass; } else { if(isEvent) ++timesFailed_; state_ = hlt::Fail; } }
void edm::Path::useStopwatch | ( | ) |
Definition at line 149 of file Path.cc.
References stopwatch_, and workers_.
Referenced by edm::Schedule::fillEndPath(), and edm::Schedule::fillTrigPath().
{ stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type); for(WorkersInPath::iterator it=workers_.begin(), itEnd = workers_.end(); it != itEnd; ++it) { it->useStopwatch(); } }
ActionTable const* edm::Path::act_table_ [private] |
Definition at line 103 of file Path.h.
Referenced by handleWorkerFailure().
boost::shared_ptr<ActivityRegistry> edm::Path::actReg_ [private] |
Definition at line 102 of file Path.h.
Referenced by processOneOccurrence().
int edm::Path::bitpos_ [private] |
Definition at line 99 of file Path.h.
Referenced by bitPosition(), and recordStatus().
std::vector<EarlyDeleteHelper*> edm::Path::earlyDeleteHelpers_ [private] |
Definition at line 106 of file Path.h.
Referenced by handleEarlyFinish(), and setEarlyDeleteHelpers().
bool edm::Path::isEndPath_ [private] |
Definition at line 108 of file Path.h.
Referenced by processOneOccurrence().
std::string edm::Path::name_ [private] |
Definition at line 100 of file Path.h.
Referenced by name(), and processOneOccurrence().
State edm::Path::state_ [private] |
Definition at line 97 of file Path.h.
Referenced by handleWorkerFailure(), processOneOccurrence(), recordStatus(), state(), and updateCounters().
Definition at line 91 of file Path.h.
Referenced by processOneOccurrence(), timeCpuReal(), and useStopwatch().
int edm::Path::timesExcept_ [private] |
Definition at line 95 of file Path.h.
Referenced by clearCounters(), handleWorkerFailure(), and timesExcept().
int edm::Path::timesFailed_ [private] |
Definition at line 94 of file Path.h.
Referenced by clearCounters(), timesFailed(), and updateCounters().
int edm::Path::timesPassed_ [private] |
Definition at line 93 of file Path.h.
Referenced by clearCounters(), timesPassed(), and updateCounters().
int edm::Path::timesRun_ [private] |
Definition at line 92 of file Path.h.
Referenced by clearCounters(), processOneOccurrence(), and timesRun().
TrigResPtr edm::Path::trptr_ [private] |
WorkersInPath edm::Path::workers_ [private] |
Definition at line 105 of file Path.h.
Referenced by clearCounters(), getWorker(), processOneOccurrence(), size(), timeCpuReal(), timesExcept(), timesFailed(), timesPassed(), timesVisited(), and useStopwatch().