CMS 3D CMS Logo

edm::Path Class Reference

#include <FWCore/Framework/src/Path.h>

List of all members.

Public Types

typedef WorkersInPath::size_type size_type
typedef hlt::HLTState State
typedef boost::shared_ptr
< HLTGlobalStatus
TrigResPtr
typedef std::vector< WorkerInPathWorkersInPath

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, ParameterSet const &proc_pset, ActionTable &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 (unsigned int const i) const
std::pair< double, double > timeCpuReal () const
int timesExcept (size_type i) const
int timesExcept () const
int timesFailed (size_type i) const
int timesFailed () const
int timesPassed (size_type i) const
int timesPassed () const
int timesRun () const
int timesVisited (size_type i) const

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

ActionTableact_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_


Detailed Description

Definition at line 35 of file Path.h.


Member Typedef Documentation

typedef WorkersInPath::size_type edm::Path::size_type

Definition at line 40 of file Path.h.

typedef hlt::HLTState edm::Path::State

Definition at line 37 of file Path.h.

typedef boost::shared_ptr<HLTGlobalStatus> edm::Path::TrigResPtr

Definition at line 41 of file Path.h.

typedef std::vector<WorkerInPath> edm::Path::WorkersInPath

Definition at line 39 of file Path.h.


Constructor & Destructor Documentation

edm::Path::Path ( int  bitpos,
std::string const &  path_name,
WorkersInPath const &  workers,
TrigResPtr  trptr,
ParameterSet const &  proc_pset,
ActionTable actions,
boost::shared_ptr< ActivityRegistry reg,
bool  isEndPath 
)

Definition at line 11 of file Path.cc.

00017                             :
00018     stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
00019     timesRun_(),
00020     timesPassed_(),
00021     timesFailed_(),
00022     timesExcept_(),
00023     state_(edm::hlt::Ready),
00024     bitpos_(bitpos),
00025     name_(path_name),
00026     trptr_(trptr),
00027     actReg_(areg),
00028     act_table_(&actions),
00029     workers_(workers),
00030     isEndPath_(isEndPath)
00031   {
00032   }
  


Member Function Documentation

int edm::Path::bitPosition (  )  const [inline]

Definition at line 54 of file Path.h.

References bitpos_.

Referenced by edm::fillPathSummary(), and processOneOccurrence().

00054 { return bitpos_; }

void edm::Path::clearCounters (  ) 

Definition at line 95 of file Path.cc.

References edm::WorkerInPath::clearCounters(), edm::for_all(), timesExcept_, timesFailed_, timesPassed_, timesRun_, and workers_.

Referenced by edm::Schedule::clearCounters().

00095                       {
00096     timesRun_ = timesPassed_ = timesFailed_ = timesExcept_ = 0;
00097     for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
00098   }

Worker const* edm::Path::getWorker ( size_type  i  )  const [inline]

Definition at line 79 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

00079 { return workers_.at(i).getWorker(); }

bool edm::Path::handleWorkerFailure ( cms::Exception const &  e,
int  nwrwue,
bool  isEvent 
) [private]

Definition at line 35 of file Path.cc.

References act_table_, cmsRelvalreport::action, cms::Exception::category(), edm::hlt::Exception, edm::actions::FailModule, edm::actions::FailPath, edm::ActionTable::find(), name_, recordStatus(), edm::actions::Rethrow, cms::Exception::rootCause(), edm::errors::ScheduleExecutionFailure, state_, timesExcept_, and cms::Exception::what().

Referenced by processOneOccurrence().

00036                                                       {
00037     bool should_continue = true;
00038 
00039     // there is no support as of yet for specific paths having
00040     // different exception behavior
00041     
00042     // If not processing an event, always rethrow.
00043     actions::ActionCodes action = (isEvent ? act_table_->find(e.rootCause()) : actions::Rethrow);
00044     assert (action != actions::FailModule);
00045     switch(action) {
00046       case actions::FailPath: {
00047           should_continue = false;
00048           LogWarning(e.category())
00049             << "Failing path " << name_
00050             << ", due to exception, message:\n"
00051             << e.what() << "\n";
00052           break;
00053       }
00054       default: {
00055           if (isEvent) ++timesExcept_;
00056           state_ = edm::hlt::Exception;
00057           recordStatus(nwrwue, isEvent);
00058           throw edm::Exception(errors::ScheduleExecutionFailure,
00059               "ProcessingStopped", e)
00060               << "Exception going through path " << name_ << "\n";
00061       }
00062     }
00063 
00064     return should_continue;
00065   }

std::string const& edm::Path::name (  )  const [inline]

Definition at line 55 of file Path.h.

References name_.

Referenced by edm::fillPathSummary().

00055 { return name_; }

template<typename T>
void edm::Path::processOneOccurrence ( typename T::MyPrincipal &  ep,
EventSetup const &  es 
) [inline]

Definition at line 132 of file Path.h.

References edm::CurrentProcessingContext::activate(), actReg_, bitPosition(), e, end, handleWorkerFailure(), i, isEndPath_, name_, edm::hlt::Ready, recordStatus(), recordUnknownException(), state_, stopwatch_, timesRun_, updateCounters(), and workers_.

Referenced by edm::ProcessOneOccurrence< T >::operator()().

00133                                    {
00134 
00135     //Create the PathSignalSentry before the RunStopwatch so that
00136     // we only record the time spent in the path not from the signal
00137     int nwrwue = -1;
00138     std::auto_ptr<PathSignalSentry<T> > signaler(new PathSignalSentry<T>(actReg_.get(), name_, nwrwue, state_));
00139                                                                            
00140     // A RunStopwatch, but only if we are processing an event.
00141     std::auto_ptr<RunStopwatch> stopwatch(T::isEvent_ ? new RunStopwatch(stopwatch_) : 0);
00142 
00143     if (T::isEvent_) {
00144       ++timesRun_;
00145     }
00146     state_ = hlt::Ready;
00147 
00148     // nwrue =  numWorkersRunWithoutUnhandledException
00149     bool should_continue = true;
00150     CurrentProcessingContext cpc(&name_, bitPosition(), isEndPath_);
00151 
00152     WorkersInPath::size_type idx = 0;
00153     // It seems likely that 'nwrwue' and 'idx' can never differ ---
00154     // if so, we should remove one of them!.
00155     for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end();
00156           i != end && should_continue;
00157           ++i, ++idx) {
00158       ++nwrwue;
00159       assert (static_cast<int>(idx) == nwrwue);
00160       try {
00161         cpc.activate(idx, i->getWorker()->descPtr());
00162         should_continue = i->runWorker<T>(ep, es, &cpc);
00163       }
00164       catch(cms::Exception& e) {
00165         // handleWorkerFailure may throw a new exception.
00166         should_continue = handleWorkerFailure(e, nwrwue, T::isEvent_);
00167       }
00168       catch(...) {
00169         recordUnknownException(nwrwue, T::isEvent_);
00170         throw;
00171       }
00172     }
00173     updateCounters(should_continue, T::isEvent_);
00174     recordStatus(nwrwue, T::isEvent_);
00175   }

void edm::Path::recordStatus ( int  nwrwue,
bool  isEvent 
) [private]

Definition at line 77 of file Path.cc.

References bitpos_, and state_.

Referenced by handleWorkerFailure(), processOneOccurrence(), and recordUnknownException().

00077                                              {
00078     if(isEvent) {
00079       (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);    
00080     }
00081   }

void edm::Path::recordUnknownException ( int  nwrwue,
bool  isEvent 
) [private]

Definition at line 68 of file Path.cc.

References edm::hlt::Exception, name_, recordStatus(), state_, and timesExcept_.

Referenced by processOneOccurrence().

00068                                                        {
00069     LogError("PassingThrough")
00070       << "Exception passing through path " << name_ << "\n";
00071     if (isEvent) ++timesExcept_;
00072     state_ = edm::hlt::Exception;
00073     recordStatus(nwrwue, isEvent);
00074   }

size_type edm::Path::size ( void   )  const [inline]

Definition at line 74 of file Path.h.

References workers_.

Referenced by edm::fillPathSummary().

00074 { return workers_.size(); }

State edm::Path::state (  )  const [inline]

Definition at line 72 of file Path.h.

References state_.

00072 { return state_; }

std::pair<double,double> edm::Path::timeCpuReal ( unsigned int const   i  )  const [inline]

Definition at line 61 of file Path.h.

References workers_.

00061                                                                    {
00062       return workers_.at(i).timeCpuReal();
00063     }

std::pair<double,double> edm::Path::timeCpuReal (  )  const [inline]

Definition at line 57 of file Path.h.

References stopwatch_.

00057                                                {
00058       return std::pair<double,double>(stopwatch_->cpuTime(),stopwatch_->realTime());
00059     }

int edm::Path::timesExcept ( size_type  i  )  const [inline]

Definition at line 78 of file Path.h.

References workers_.

00078 { return workers_.at(i).timesExcept() ; }

int edm::Path::timesExcept (  )  const [inline]

Definition at line 70 of file Path.h.

References timesExcept_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

00070 { return timesExcept_; }

int edm::Path::timesFailed ( size_type  i  )  const [inline]

Definition at line 77 of file Path.h.

References workers_.

00077 { return workers_.at(i).timesFailed() ; }

int edm::Path::timesFailed (  )  const [inline]

Definition at line 69 of file Path.h.

References timesFailed_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

00069 { return timesFailed_; }

int edm::Path::timesPassed ( size_type  i  )  const [inline]

Definition at line 76 of file Path.h.

References workers_.

00076 { return workers_.at(i).timesPassed() ; }

int edm::Path::timesPassed (  )  const [inline]

Definition at line 68 of file Path.h.

References timesPassed_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

00068 { return timesPassed_; }

int edm::Path::timesRun (  )  const [inline]

Definition at line 67 of file Path.h.

References timesRun_.

Referenced by edm::fillPathSummary().

00067 { return timesRun_; }

int edm::Path::timesVisited ( size_type  i  )  const [inline]

Definition at line 75 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

00075 { return workers_.at(i).timesVisited(); }

void edm::Path::updateCounters ( bool  succeed,
bool  isEvent 
) [private]

Definition at line 84 of file Path.cc.

References edm::hlt::Fail, edm::hlt::Pass, state_, timesFailed_, and timesPassed_.

Referenced by processOneOccurrence().

00084                                                  {
00085     if (success) {
00086       if (isEvent) ++timesPassed_;
00087       state_ = edm::hlt::Pass;
00088     } else {
00089       if(isEvent) ++timesFailed_;
00090       state_ = edm::hlt::Fail;
00091     }
00092   }


Member Data Documentation

ActionTable* edm::Path::act_table_ [private]

Definition at line 94 of file Path.h.

Referenced by handleWorkerFailure().

boost::shared_ptr<ActivityRegistry> edm::Path::actReg_ [private]

Definition at line 93 of file Path.h.

Referenced by processOneOccurrence().

int edm::Path::bitpos_ [private]

Definition at line 90 of file Path.h.

Referenced by bitPosition(), and recordStatus().

bool edm::Path::isEndPath_ [private]

Definition at line 98 of file Path.h.

Referenced by processOneOccurrence().

std::string edm::Path::name_ [private]

Definition at line 91 of file Path.h.

Referenced by handleWorkerFailure(), name(), processOneOccurrence(), and recordUnknownException().

State edm::Path::state_ [private]

Definition at line 88 of file Path.h.

Referenced by handleWorkerFailure(), processOneOccurrence(), recordStatus(), recordUnknownException(), state(), and updateCounters().

RunStopwatch::StopwatchPointer edm::Path::stopwatch_ [private]

Definition at line 82 of file Path.h.

Referenced by processOneOccurrence(), and timeCpuReal().

int edm::Path::timesExcept_ [private]

Definition at line 86 of file Path.h.

Referenced by clearCounters(), handleWorkerFailure(), recordUnknownException(), and timesExcept().

int edm::Path::timesFailed_ [private]

Definition at line 85 of file Path.h.

Referenced by clearCounters(), timesFailed(), and updateCounters().

int edm::Path::timesPassed_ [private]

Definition at line 84 of file Path.h.

Referenced by clearCounters(), timesPassed(), and updateCounters().

int edm::Path::timesRun_ [private]

Definition at line 83 of file Path.h.

Referenced by clearCounters(), processOneOccurrence(), and timesRun().

TrigResPtr edm::Path::trptr_ [private]

Definition at line 92 of file Path.h.

WorkersInPath edm::Path::workers_ [private]

Definition at line 96 of file Path.h.

Referenced by clearCounters(), getWorker(), processOneOccurrence(), size(), timeCpuReal(), timesExcept(), timesFailed(), timesPassed(), and timesVisited().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:42:58 2009 for CMSSW by  doxygen 1.5.4