#include <SubProcess.h>
Public Member Functions | |
int | alive () const |
int | controlQueueOccupancy () |
int & | countdown () |
void | disconnect () |
int | forkNew () |
int | get_save_nba () const |
int | get_save_nbp () const |
bool | inInconsistentState () 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 (int ind, pid_t pid) | |
SubProcess () | |
SubProcess (const SubProcess &b) | |
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_ |
pid_t | pid_ |
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 17 of file SubProcess.h.
evf::SubProcess::SubProcess | ( | ) | [inline] |
Definition at line 19 of file SubProcess.h.
: ind_(100000) , pid_(-1) , alive_(-1000) , restart_countdown_(0) , restart_count_(0) , save_nbp_(0) , save_nba_(0) , save_ndqm_(0) , save_scalers_(0) , reported_inconsistent_(false) {}
evf::SubProcess::SubProcess | ( | int | ind, |
pid_t | pid | ||
) | [inline] |
Definition at line 31 of file SubProcess.h.
: ind_(ind) , pid_(pid) , alive_(-1) , mqm_(new MasterQueue(monitor_queue_offset_+ind)) , mqs_(new MasterQueue(ind)) , restart_countdown_(0) , restart_count_(0) , save_nbp_(0) , save_nba_(0) , save_ndqm_(0) , save_scalers_(0) , reported_inconsistent_(false) { mqm_->drain(); mqs_->drain(); }
evf::SubProcess::SubProcess | ( | const SubProcess & | b | ) | [inline] |
Definition at line 48 of file SubProcess.h.
virtual evf::SubProcess::~SubProcess | ( | ) | [inline, virtual] |
Definition at line 61 of file SubProcess.h.
{ }
int evf::SubProcess::alive | ( | ) | const [inline] |
int evf::SubProcess::controlQueueOccupancy | ( | ) | [inline] |
Definition at line 71 of file SubProcess.h.
References mqs_.
int& evf::SubProcess::countdown | ( | ) | [inline] |
Definition at line 127 of file SubProcess.h.
References restart_countdown_.
{return restart_countdown_;}
void evf::SubProcess::disconnect | ( | void | ) |
Definition at line 22 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 58 of file SubProcess.cc.
References a, alive_, ind_, monitor_queue_offset_, mqm_, mqs_, pid_, reported_inconsistent_, sqm_, and sqs_.
{ mqm_->drain(); mqs_->drain(); pid_t retval = -1; retval = fork(); reported_inconsistent_ = false; if(retval>0) { pid_ = retval; alive_=1; } if(retval==0) { // 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; }
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 124 of file SubProcess.h.
References reported_inconsistent_.
{return reported_inconsistent_;}
SubProcess & evf::SubProcess::operator= | ( | const SubProcess & | b | ) |
Definition at line 6 of file SubProcess.cc.
References alive_, ind_, mqm_, mqs_, pid_, reported_inconsistent_, restart_countdown_, save_nba_, save_nbp_, save_ndqm_, and save_scalers_.
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 99 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 68 of file SubProcess.h.
References mqm_.
int evf::SubProcess::queueOccupancy | ( | ) | [inline] |
Definition at line 70 of file SubProcess.h.
References mqm_.
pid_t evf::SubProcess::queuePidOfLastReceive | ( | ) | [inline] |
Definition at line 73 of file SubProcess.h.
References mqm_.
pid_t evf::SubProcess::queuePidOfLastSend | ( | ) | [inline] |
Definition at line 72 of file SubProcess.h.
References mqm_.
int evf::SubProcess::queueStatus | ( | ) | [inline] |
Definition at line 69 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 90 of file SubProcess.h.
unsigned long evf::SubProcess::rcvSlave | ( | MsgBuf & | ptr, |
bool | isMonitor | ||
) | [inline] |
Definition at line 105 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 111 of file SubProcess.h.
References evf::SlaveQueue::rcvNonBlocking(), sqm_, and sqs_.
std::string const& evf::SubProcess::reasonForFailed | ( | ) | const [inline] |
Definition at line 123 of file SubProcess.h.
References reasonForFailed_.
{return reasonForFailed_;}
unsigned int& evf::SubProcess::restartCount | ( | ) | [inline] |
void evf::SubProcess::setParams | ( | struct prg * | p | ) |
Definition at line 46 of file SubProcess.cc.
References evf::prg::dqm, 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 125 of file SubProcess.h.
References csvReporter::r, and reasonForFailed_.
{reasonForFailed_ = r;}
void evf::SubProcess::setReportedInconsistent | ( | ) | [inline] |
Definition at line 126 of file SubProcess.h.
References reported_inconsistent_.
{reported_inconsistent_ = true;}
void evf::SubProcess::setStatus | ( | int | st | ) |
Definition at line 34 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 136 of file SubProcess.h.
Referenced by alive(), forkNew(), operator=(), and setStatus().
int evf::SubProcess::ind_ [private] |
Definition at line 134 of file SubProcess.h.
Referenced by forkNew(), and operator=().
const unsigned int evf::SubProcess::monitor_queue_offset_ = 200 [static] |
Definition at line 131 of file SubProcess.h.
Referenced by forkNew().
boost::shared_ptr<MasterQueue> evf::SubProcess::mqm_ [private] |
Definition at line 137 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 138 of file SubProcess.h.
Referenced by controlQueueOccupancy(), disconnect(), forkNew(), operator=(), post(), rcv(), rcvNonBlocking(), and SubProcess().
pid_t evf::SubProcess::pid_ [private] |
Definition at line 135 of file SubProcess.h.
Referenced by forkNew(), operator=(), and pid().
struct prg evf::SubProcess::prg_ [private] |
Definition at line 142 of file SubProcess.h.
Referenced by params(), setParams(), and setStatus().
std::string evf::SubProcess::reasonForFailed_ [private] |
Definition at line 141 of file SubProcess.h.
Referenced by reasonForFailed(), and setReasonForFailed().
bool evf::SubProcess::reported_inconsistent_ [private] |
Definition at line 150 of file SubProcess.h.
Referenced by forkNew(), inInconsistentState(), operator=(), and setReportedInconsistent().
unsigned int evf::SubProcess::restart_count_ [private] |
Definition at line 144 of file SubProcess.h.
Referenced by restartCount().
int evf::SubProcess::restart_countdown_ [private] |
Definition at line 143 of file SubProcess.h.
Referenced by countdown(), and operator=().
int evf::SubProcess::save_nba_ [private] |
Definition at line 147 of file SubProcess.h.
Referenced by disconnect(), get_save_nba(), operator=(), setParams(), and setStatus().
int evf::SubProcess::save_nbp_ [private] |
Definition at line 146 of file SubProcess.h.
Referenced by disconnect(), get_save_nbp(), operator=(), setParams(), and setStatus().
unsigned int evf::SubProcess::save_ndqm_ [private] |
Definition at line 148 of file SubProcess.h.
Referenced by disconnect(), operator=(), setParams(), and setStatus().
unsigned int evf::SubProcess::save_scalers_ [private] |
Definition at line 149 of file SubProcess.h.
Referenced by disconnect(), operator=(), setParams(), and setStatus().
SlaveQueue* evf::SubProcess::sqm_ [private] |
Definition at line 139 of file SubProcess.h.
Referenced by forkNew(), postSlave(), rcvSlave(), and rcvSlaveNonBlocking().
SlaveQueue* evf::SubProcess::sqs_ [private] |
Definition at line 140 of file SubProcess.h.
Referenced by forkNew(), postSlave(), rcvSlave(), and rcvSlaveNonBlocking().