#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 &) |
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 (size_type i) const |
int | timesFailed () const |
int | timesPassed () const |
int | timesPassed (size_type i) const |
int | timesRun () const |
int | timesVisited (size_type i) const |
void | useStopwatch () |
Private Member Functions | |
bool | handleWorkerFailure (cms::Exception const &e, int nwrwue, bool isEvent) |
void | recordStatus (int nwrwue, bool isEvent) |
void | recordUnknownException (int nwrwue, bool isEvent) |
void | updateCounters (bool succeed, bool isEvent) |
Private Attributes | |
ActionTable const * | act_table_ |
boost::shared_ptr < ActivityRegistry > | actReg_ |
int | bitpos_ |
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 11 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 47 of file Path.h.
References bitpos_.
Referenced by edm::fillPathSummary(), and processOneOccurrence().
{ return bitpos_; }
void edm::Path::clearCounters | ( | ) |
Definition at line 100 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)); }
bool edm::Path::handleWorkerFailure | ( | cms::Exception const & | e, |
int | nwrwue, | ||
bool | isEvent | ||
) | [private] |
Definition at line 33 of file Path.cc.
References act_table_, alignmentValidation::action, cms::Exception::category(), edm::Exception::codeToString(), Exception, edm::actions::FailModule, edm::actions::FailPath, edm::ActionTable::find(), name_, edm::errors::ProductNotFound, recordStatus(), edm::actions::Rethrow, cms::Exception::rootCause(), state_, timesExcept_, and cms::Exception::what().
Referenced by processOneOccurrence().
{ 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.rootCause()) : actions::Rethrow); assert (action != actions::FailModule); switch(action) { case actions::FailPath: { should_continue = false; LogWarning(e.category()) << "Failing path " << name_ << ", due to exception, message:\n" << e.what() << "\n"; 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) { e << "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 << "ProcessingStopped\n"; e << "Exception going through path " << name_ << "\n"; throw; } } return should_continue; }
std::string const& edm::Path::name | ( | ) | const [inline] |
Definition at line 48 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 129 of file Path.h.
References edm::CurrentProcessingContext::activate(), actReg_, bitPosition(), ExpressReco_HICollisions_FallBack::e, end, handleWorkerFailure(), i, isEndPath_, name_, Ready, recordStatus(), recordUnknownException(), state_, stopwatch_, timesRun_, 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; std::auto_ptr<PathSignalSentry<T> > signaler(new PathSignalSentry<T>(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 { cpc.activate(idx, i->getWorker()->descPtr()); should_continue = i->runWorker<T>(ep, es, &cpc); } catch(cms::Exception& e) { // handleWorkerFailure may throw a new exception. should_continue = handleWorkerFailure(e, nwrwue, T::isEvent_); } catch(...) { recordUnknownException(nwrwue, T::isEvent_); throw; } } updateCounters(should_continue, T::isEvent_); recordStatus(nwrwue, T::isEvent_); }
void edm::Path::recordStatus | ( | int | nwrwue, |
bool | isEvent | ||
) | [private] |
Definition at line 82 of file Path.cc.
References bitpos_, and state_.
Referenced by handleWorkerFailure(), processOneOccurrence(), and recordUnknownException().
void edm::Path::recordUnknownException | ( | int | nwrwue, |
bool | isEvent | ||
) | [private] |
Definition at line 73 of file Path.cc.
References Exception, name_, recordStatus(), state_, and timesExcept_.
Referenced by processOneOccurrence().
{ LogError("PassingThrough") << "Exception passing through path " << name_ << "\n"; if (isEvent) ++timesExcept_; state_ = hlt::Exception; recordStatus(nwrwue, isEvent); }
size_type edm::Path::size | ( | void | ) | const [inline] |
Definition at line 70 of file Path.h.
References workers_.
Referenced by edm::fillPathSummary().
{ return workers_.size(); }
State edm::Path::state | ( | ) | const [inline] |
std::pair<double, double> edm::Path::timeCpuReal | ( | ) | const [inline] |
Definition at line 50 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 | ( | ) | const [inline] |
Definition at line 66 of file Path.h.
References timesExcept_.
Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().
{ return timesExcept_; }
int edm::Path::timesExcept | ( | size_type | i | ) | const [inline] |
int edm::Path::timesFailed | ( | ) | const [inline] |
Definition at line 65 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 | ( | ) | const [inline] |
Definition at line 64 of file Path.h.
References timesPassed_.
Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().
{ return timesPassed_; }
int edm::Path::timesPassed | ( | size_type | i | ) | const [inline] |
int edm::Path::timesRun | ( | ) | const [inline] |
Definition at line 63 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 89 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 106 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 91 of file Path.h.
Referenced by handleWorkerFailure().
boost::shared_ptr<ActivityRegistry> edm::Path::actReg_ [private] |
Definition at line 90 of file Path.h.
Referenced by processOneOccurrence().
int edm::Path::bitpos_ [private] |
Definition at line 87 of file Path.h.
Referenced by bitPosition(), and recordStatus().
bool edm::Path::isEndPath_ [private] |
Definition at line 95 of file Path.h.
Referenced by processOneOccurrence().
std::string edm::Path::name_ [private] |
Definition at line 88 of file Path.h.
Referenced by handleWorkerFailure(), name(), processOneOccurrence(), and recordUnknownException().
State edm::Path::state_ [private] |
Definition at line 85 of file Path.h.
Referenced by handleWorkerFailure(), processOneOccurrence(), recordStatus(), recordUnknownException(), state(), and updateCounters().
Definition at line 79 of file Path.h.
Referenced by processOneOccurrence(), timeCpuReal(), and useStopwatch().
int edm::Path::timesExcept_ [private] |
Definition at line 83 of file Path.h.
Referenced by clearCounters(), handleWorkerFailure(), recordUnknownException(), and timesExcept().
int edm::Path::timesFailed_ [private] |
Definition at line 82 of file Path.h.
Referenced by clearCounters(), timesFailed(), and updateCounters().
int edm::Path::timesPassed_ [private] |
Definition at line 81 of file Path.h.
Referenced by clearCounters(), timesPassed(), and updateCounters().
int edm::Path::timesRun_ [private] |
Definition at line 80 of file Path.h.
Referenced by clearCounters(), processOneOccurrence(), and timesRun().
TrigResPtr edm::Path::trptr_ [private] |
WorkersInPath edm::Path::workers_ [private] |
Definition at line 93 of file Path.h.
Referenced by clearCounters(), getWorker(), processOneOccurrence(), size(), timeCpuReal(), timesExcept(), timesFailed(), timesPassed(), timesVisited(), and useStopwatch().