#include <SubProcess.h>
Public Member Functions | |
void | add_postponed_trigger_update (MsgBuf &) |
int | alive () const |
bool | check_postponed_trigger_update (MsgBuf &, unsigned int) |
int | controlQueueOccupancy () |
int & | countdown () |
void | disconnect () |
int | forkNew () |
void | found_invalid () |
int | get_save_nba () const |
int | get_save_nbp () const |
bool | inInconsistentState () const |
unsigned int | nfound_invalid () const |
SubProcess & | operator= (const SubProcess &b) |
struct prg & | params () |
pid_t | pid () const |
int | post (MsgBuf &ptr, bool isMonitor) |
int | postSlave (MsgBuf &ptr, bool isMonitor) |
int | queueId () |
int | queueOccupancy () |
pid_t | queuePidOfLastReceive () |
pid_t | queuePidOfLastSend () |
int | queueStatus () |
unsigned long | rcv (MsgBuf &ptr, bool isMonitor) |
unsigned long | rcvNonBlocking (MsgBuf &ptr, bool isMonitor) |
unsigned long | rcvSlave (MsgBuf &ptr, bool isMonitor) |
unsigned long | rcvSlaveNonBlocking (MsgBuf &ptr, bool isMonitor) |
std::string const & | reasonForFailed () const |
unsigned int & | restartCount () |
void | setParams (struct prg *p) |
void | setReasonForFailed (std::string r) |
void | setReportedInconsistent () |
void | setStatus (int st) |
SubProcess (const SubProcess &b) | |
SubProcess () | |
SubProcess (int ind, pid_t pid) | |
virtual | ~SubProcess () |
Static Public Attributes | |
static const unsigned int | monitor_queue_offset_ = 200 |
Private Attributes | |
int | alive_ |
int | ind_ |
boost::shared_ptr< MasterQueue > | mqm_ |
boost::shared_ptr< MasterQueue > | mqs_ |
unsigned int | nfound_invalid_ |
pid_t | pid_ |
std::vector< MsgBuf > | postponed_trigger_updates_ |
struct prg | prg_ |
std::string | reasonForFailed_ |
bool | reported_inconsistent_ |
unsigned int | restart_count_ |
int | restart_countdown_ |
int | save_nba_ |
int | save_nbp_ |
unsigned int | save_ndqm_ |
unsigned int | save_scalers_ |
SlaveQueue * | sqm_ |
SlaveQueue * | sqs_ |
Definition at line 18 of file SubProcess.h.
evf::SubProcess::SubProcess | ( | ) | [inline] |
Definition at line 20 of file SubProcess.h.
: ind_(100000) , pid_(-1) , alive_(-1000) , sqm_(0) , sqs_(0) , restart_countdown_(0) , restart_count_(0) , save_nbp_(0) , save_nba_(0) , save_ndqm_(0) , save_scalers_(0) , reported_inconsistent_(false) , nfound_invalid_(0) {}
evf::SubProcess::SubProcess | ( | int | ind, |
pid_t | pid | ||
) | [inline] |
Definition at line 35 of file SubProcess.h.
: ind_(ind) , pid_(pid) , alive_(-1) , mqm_(new MasterQueue(monitor_queue_offset_+ind)) , mqs_(new MasterQueue(ind)) , sqm_(0) , sqs_(0) , restart_countdown_(0) , restart_count_(0) , save_nbp_(0) , save_nba_(0) , save_ndqm_(0) , save_scalers_(0) , reported_inconsistent_(false) , nfound_invalid_(0) { mqm_->drain(); mqs_->drain(); }
evf::SubProcess::SubProcess | ( | const SubProcess & | b | ) | [inline] |
Definition at line 55 of file SubProcess.h.
: ind_(b.ind_) , pid_(b.pid_) , alive_(b.alive_) , mqm_(b.mqm_) , mqs_(b.mqs_) , sqm_(b.sqm_) , sqs_(b.sqs_) , restart_countdown_(b.restart_countdown_) , restart_count_(b.restart_count_) , reported_inconsistent_(b.reported_inconsistent_) , nfound_invalid_(b.nfound_invalid_) , postponed_trigger_updates_(b.postponed_trigger_updates_) { }
virtual evf::SubProcess::~SubProcess | ( | ) | [inline, virtual] |
Definition at line 72 of file SubProcess.h.
{ }
void evf::SubProcess::add_postponed_trigger_update | ( | MsgBuf & | b | ) |
Definition at line 99 of file SubProcess.cc.
References postponed_trigger_updates_.
{ postponed_trigger_updates_.push_back(b); }
int evf::SubProcess::alive | ( | ) | const [inline] |
bool evf::SubProcess::check_postponed_trigger_update | ( | MsgBuf & | b, |
unsigned int | ls | ||
) |
Definition at line 103 of file SubProcess.cc.
References i, evf::TriggerReportStatic::lumiSection, and postponed_trigger_updates_.
{ for(std::vector<MsgBuf>::iterator i = postponed_trigger_updates_.begin(); i != postponed_trigger_updates_.end(); i++) { TriggerReportStatic *trp = (TriggerReportStatic *)((*i)->mtext); if(trp->lumiSection == ls){ b = (*i); postponed_trigger_updates_.erase(i); return true; } } return false; }
int evf::SubProcess::controlQueueOccupancy | ( | ) | [inline] |
Definition at line 82 of file SubProcess.h.
References mqs_.
int& evf::SubProcess::countdown | ( | ) | [inline] |
Definition at line 138 of file SubProcess.h.
References restart_countdown_.
{return restart_countdown_;}
void evf::SubProcess::disconnect | ( | void | ) |
Definition at line 30 of file SubProcess.cc.
References mqm_, mqs_, save_nba_, save_nbp_, save_ndqm_, and save_scalers_.
{ mqm_->drain(); mqs_->drain(); mqs_->disconnect(); mqm_->disconnect(); save_nbp_ = 0; save_nba_ = 0; save_ndqm_ = 0; save_scalers_ = 0; }
int evf::SubProcess::forkNew | ( | ) |
Definition at line 67 of file SubProcess.cc.
References a, alive_, gather_cfg::cout, ind_, monitor_queue_offset_, mqm_, mqs_, nfound_invalid_, pid_, postponed_trigger_updates_, reported_inconsistent_, sqm_, sqs_, and summarizeEdmComparisonLogfiles::success.
{ mqm_->drain(); mqs_->drain(); pid_t retval = -1; retval = fork(); reported_inconsistent_ = false; nfound_invalid_ = 0; postponed_trigger_updates_.clear(); if(retval>0) { pid_ = retval; alive_=1; } if(retval==0) { int success = -1; #ifdef linux success = prctl( PR_SET_PDEATHSIG, SIGKILL ); #endif if(success != 0){ std::cout << getpid() << " could not set process death signal" << std::endl; } // freopen(filename,"w",stdout); // send all console output from children to /dev/null freopen("/dev/null","w",stderr); FileDescriptorHandler a; //handle socket file descriptors left open at fork sqm_ = new SlaveQueue(monitor_queue_offset_+ind_); sqs_ = new SlaveQueue(ind_); } return retval; }
void evf::SubProcess::found_invalid | ( | ) | [inline] |
int evf::SubProcess::get_save_nba | ( | ) | const [inline] |
int evf::SubProcess::get_save_nbp | ( | ) | const [inline] |
bool evf::SubProcess::inInconsistentState | ( | ) | const [inline] |
Definition at line 135 of file SubProcess.h.
References reported_inconsistent_.
{return reported_inconsistent_;}
unsigned int evf::SubProcess::nfound_invalid | ( | ) | const [inline] |
SubProcess & evf::SubProcess::operator= | ( | const SubProcess & | b | ) |
Definition at line 13 of file SubProcess.cc.
References alive_, ind_, mqm_, mqs_, pid_, postponed_trigger_updates_, reported_inconsistent_, restart_countdown_, save_nba_, save_nbp_, save_ndqm_, and save_scalers_.
{ ind_=b.ind_; pid_=b.pid_; alive_=b.alive_; mqm_=b.mqm_; mqs_=b.mqs_; save_nbp_ = b.save_nbp_; save_nba_ = b.save_nba_; save_ndqm_ = b.save_ndqm_; save_scalers_ = b.save_scalers_; restart_countdown_=b.restart_countdown_; reported_inconsistent_=b.reported_inconsistent_; postponed_trigger_updates_ = b.postponed_trigger_updates_; return *this; }
struct prg& evf::SubProcess::params | ( | ) | [inline, read] |
pid_t evf::SubProcess::pid | ( | ) | const [inline] |
int evf::SubProcess::post | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
int evf::SubProcess::postSlave | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
Definition at line 110 of file SubProcess.h.
References evf::SlaveQueue::post(), sqm_, and sqs_.
Referenced by evf::FUEventProcessor::receiving(), evf::FUEventProcessor::receivingAndMonitor(), evf::FUEventProcessor::scalers(), and evf::FUEventProcessor::sendMessageOverMonitorQueue().
int evf::SubProcess::queueId | ( | ) | [inline] |
Definition at line 79 of file SubProcess.h.
References mqm_.
int evf::SubProcess::queueOccupancy | ( | ) | [inline] |
Definition at line 81 of file SubProcess.h.
References mqm_.
pid_t evf::SubProcess::queuePidOfLastReceive | ( | ) | [inline] |
Definition at line 84 of file SubProcess.h.
References mqm_.
pid_t evf::SubProcess::queuePidOfLastSend | ( | ) | [inline] |
Definition at line 83 of file SubProcess.h.
References mqm_.
int evf::SubProcess::queueStatus | ( | ) | [inline] |
Definition at line 80 of file SubProcess.h.
References mqm_.
unsigned long evf::SubProcess::rcv | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
unsigned long evf::SubProcess::rcvNonBlocking | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
Definition at line 101 of file SubProcess.h.
unsigned long evf::SubProcess::rcvSlave | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
Definition at line 116 of file SubProcess.h.
References evf::SlaveQueue::rcv(), sqm_, and sqs_.
Referenced by evf::FUEventProcessor::receiving(), and evf::FUEventProcessor::receivingAndMonitor().
unsigned long evf::SubProcess::rcvSlaveNonBlocking | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
Definition at line 122 of file SubProcess.h.
References evf::SlaveQueue::rcvNonBlocking(), sqm_, and sqs_.
std::string const& evf::SubProcess::reasonForFailed | ( | ) | const [inline] |
Definition at line 134 of file SubProcess.h.
References reasonForFailed_.
{return reasonForFailed_;}
unsigned int& evf::SubProcess::restartCount | ( | ) | [inline] |
void evf::SubProcess::setParams | ( | struct prg * | p | ) |
Definition at line 54 of file SubProcess.cc.
References evf::prg::dqm, evf::prg::eols, evf::prg::ls, evf::prg::Ms, evf::prg::ms, evf::prg::nba, evf::prg::nbp, prg_, evf::prg::ps, save_nba_, save_nbp_, save_ndqm_, save_scalers_, and evf::prg::trp.
void evf::SubProcess::setReasonForFailed | ( | std::string | r | ) | [inline] |
Definition at line 136 of file SubProcess.h.
References alignCSCRings::r, and reasonForFailed_.
{reasonForFailed_ = r;}
void evf::SubProcess::setReportedInconsistent | ( | ) | [inline] |
Definition at line 137 of file SubProcess.h.
References reported_inconsistent_.
{reported_inconsistent_ = true;}
void evf::SubProcess::setStatus | ( | int | st | ) |
Definition at line 42 of file SubProcess.cc.
References alive_, evf::prg::dqm, evf::prg::nba, evf::prg::nbp, prg_, save_nba_, save_nbp_, save_ndqm_, save_scalers_, and evf::prg::trp.
{ alive_ = st; if(alive_ != 1) //i.e. process is no longer alive { //save counters after last update save_nbp_ = prg_.nbp; save_nba_ = prg_.nba; save_ndqm_ = prg_.dqm; save_scalers_ = prg_.trp; } }
int evf::SubProcess::alive_ [private] |
Definition at line 151 of file SubProcess.h.
Referenced by alive(), forkNew(), operator=(), and setStatus().
int evf::SubProcess::ind_ [private] |
Definition at line 149 of file SubProcess.h.
Referenced by forkNew(), and operator=().
const unsigned int evf::SubProcess::monitor_queue_offset_ = 200 [static] |
Definition at line 146 of file SubProcess.h.
Referenced by forkNew().
boost::shared_ptr<MasterQueue> evf::SubProcess::mqm_ [private] |
Definition at line 152 of file SubProcess.h.
Referenced by disconnect(), forkNew(), operator=(), post(), queueId(), queueOccupancy(), queuePidOfLastReceive(), queuePidOfLastSend(), queueStatus(), rcv(), rcvNonBlocking(), and SubProcess().
boost::shared_ptr<MasterQueue> evf::SubProcess::mqs_ [private] |
Definition at line 153 of file SubProcess.h.
Referenced by controlQueueOccupancy(), disconnect(), forkNew(), operator=(), post(), rcv(), rcvNonBlocking(), and SubProcess().
unsigned int evf::SubProcess::nfound_invalid_ [private] |
Definition at line 166 of file SubProcess.h.
Referenced by forkNew(), found_invalid(), and nfound_invalid().
pid_t evf::SubProcess::pid_ [private] |
Definition at line 150 of file SubProcess.h.
Referenced by forkNew(), operator=(), and pid().
std::vector<MsgBuf> evf::SubProcess::postponed_trigger_updates_ [private] |
Definition at line 168 of file SubProcess.h.
Referenced by add_postponed_trigger_update(), check_postponed_trigger_update(), forkNew(), and operator=().
struct prg evf::SubProcess::prg_ [private] |
Definition at line 157 of file SubProcess.h.
Referenced by params(), setParams(), and setStatus().
std::string evf::SubProcess::reasonForFailed_ [private] |
Definition at line 156 of file SubProcess.h.
Referenced by reasonForFailed(), and setReasonForFailed().
bool evf::SubProcess::reported_inconsistent_ [private] |
Definition at line 165 of file SubProcess.h.
Referenced by forkNew(), inInconsistentState(), operator=(), and setReportedInconsistent().
unsigned int evf::SubProcess::restart_count_ [private] |
Definition at line 159 of file SubProcess.h.
Referenced by restartCount().
int evf::SubProcess::restart_countdown_ [private] |
Definition at line 158 of file SubProcess.h.
Referenced by countdown(), and operator=().
int evf::SubProcess::save_nba_ [private] |
Definition at line 162 of file SubProcess.h.
Referenced by disconnect(), get_save_nba(), operator=(), setParams(), and setStatus().
int evf::SubProcess::save_nbp_ [private] |
Definition at line 161 of file SubProcess.h.
Referenced by disconnect(), get_save_nbp(), operator=(), setParams(), and setStatus().
unsigned int evf::SubProcess::save_ndqm_ [private] |
Definition at line 163 of file SubProcess.h.
Referenced by disconnect(), operator=(), setParams(), and setStatus().
unsigned int evf::SubProcess::save_scalers_ [private] |
Definition at line 164 of file SubProcess.h.
Referenced by disconnect(), operator=(), setParams(), and setStatus().
SlaveQueue* evf::SubProcess::sqm_ [private] |
Definition at line 154 of file SubProcess.h.
Referenced by forkNew(), postSlave(), rcvSlave(), and rcvSlaveNonBlocking().
SlaveQueue* evf::SubProcess::sqs_ [private] |
Definition at line 155 of file SubProcess.h.
Referenced by forkNew(), postSlave(), rcvSlave(), and rcvSlaveNonBlocking().