CMS 3D CMS Logo

Public Member Functions | Protected Attributes

evf::IPCMethod Class Reference

#include <IPCMethod.h>

Inheritance diagram for evf::IPCMethod:
evf::FUResourceQueue evf::FUResourceTable

List of all members.

Public Member Functions

UInt_t allocateResource ()
virtual bool buildResource (MemRef_t *bufRef)=0
virtual std::vector< UInt_tcellEvtNumbers () const =0
virtual std::vector< pid_t > cellPrcIds () const =0
virtual std::vector< std::string > cellStates () const =0
virtual std::vector< time_t > cellTimeStamps () const =0
virtual void clear ()=0
virtual std::vector< pid_t > clientPrcIds () const =0
virtual std::string clientPrcIdsAsString () const =0
virtual bool discard ()=0
virtual bool discardDataEvent (MemRef_t *bufRef)=0
virtual bool discardDataEventWhileHalting (MemRef_t *bufRef)=0
virtual bool discardDqmEvent (MemRef_t *bufRef)=0
virtual bool discardDqmEventWhileHalting (MemRef_t *bufRef)=0
virtual bool discardWhileHalting (bool sendDiscards)=0
virtual std::vector< std::string > dqmCellStates () const =0
virtual void dropEvent ()=0
void dumpEvent (evf::FUShmRawCell *cell)
virtual bool handleCrashedEP (UInt_t runNumber, pid_t pid)=0
void injectCRCError ()
 IPCMethod (bool segmentationMode, UInt_t nbRawCells, UInt_t nbRecoCells, UInt_t nbDqmCells, UInt_t rawCellSize, UInt_t recoCellSize, UInt_t dqmCellSize, int freeResReq, BUProxy *bu, SMProxy *sm, log4cplus::Logger logger, unsigned int timeout, EvffedFillerRB *frb, xdaq::Application *app) throw (evf::Exception)
bool isActive () const
bool isLastMessageOfEvent (MemRef_t *bufRef)
bool isReadyToShutDown () const
virtual void lastResort ()=0
void lock ()
UInt_t nbAllocated () const
UInt_t nbAllocSent () const
virtual UInt_t nbClients () const =0
UInt_t nbCompleted () const
UInt_t nbCrcErrors () const
UInt_t nbDiscarded () const
UInt_t nbEolDiscarded () const
UInt_t nbEolPosted () const
UInt_t nbErrors () const
UInt_t nbFreeSlots () const
UInt_t nbLost () const
UInt_t nbPending () const
UInt_t nbPendingSMDiscards () const
int nbPendingSMDqmDiscards () const
virtual UInt_t nbResources () const =0
UInt_t nbSent () const
UInt_t nbSentDqm () const
UInt_t nbSentError () const
virtual void postEndOfLumiSection (MemRef_t *bufRef)=0
virtual std::string printStatus ()
void releaseResources ()
 releases all FUResource's
virtual void resetCounters ()=0
virtual void resetIPC ()=0
 resets the underlying IPC method to the initial state
void resetPendingAllocates ()
 resets free resources to the maximum number
void sendAllocate ()
virtual bool sendData ()=0
void sendDataEvent (UInt_t fuResourceId, UInt_t runNumber, UInt_t evtNumber, UInt_t outModId, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize)
virtual bool sendDataWhileHalting ()=0
void sendDiscard (UInt_t buResourceId)
virtual bool sendDqm ()=0
void sendDqmEvent (UInt_t fuDqmId, UInt_t runNumber, UInt_t evtAtUpdate, UInt_t folderId, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize)
virtual bool sendDqmWhileHalting ()=0
void sendErrorEvent (UInt_t fuResourceId, UInt_t runNumber, UInt_t evtNumber, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize)
void sendInitMessage (UInt_t fuResourceId, UInt_t outModId, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize, UInt_t nExpectedEPs)
void setActive (bool activeValue)
void setDoCrcCheck (UInt_t doCrcCheck)
void setDoDumpEvents (UInt_t doDumpEvents)
void setReadyToShutDown (bool readyValue)
void setRunNumber (UInt_t runNumber)
void setStopFlag (bool status)
virtual void shutDownClients ()=0
UInt_t shutdownStatus ()
UInt_t sumOfSizes () const
uint64_t sumOfSquares () const
void unlock ()
virtual ~IPCMethod ()

Protected Attributes

bool * acceptSMDataDiscard_
int * acceptSMDqmDiscard_
xdaq::Application * app_
BUProxybu_
UInt_t doCrcCheck_
UInt_t doDumpEvents_
EvffedFillerRBfrb_
std::queue< UInt_tfreeResourceIds_
unsigned int freeResRequiredForAllocate_
bool isActive_
bool isReadyToShutDown_
sem_t lock_
log4cplus::Logger log_
UInt_t nbAllocated_
UInt_t nbAllocSent_
UInt_t nbClientsToShutDown_
UInt_t nbCompleted_
UInt_t nbCrcErrors_
UInt_t nbDiscarded_
UInt_t nbDqmCells_
UInt_t nbEolDiscarded_
UInt_t nbEolPosted_
UInt_t nbErrors_
UInt_t nbLost_
UInt_t nbPending_
UInt_t nbPendingSMDiscards_
std::atomic< int > nbPendingSMDqmDiscards_
UInt_t nbRawCells_
UInt_t nbRecoCells_
UInt_t nbSent_
UInt_t nbSentDqm_
UInt_t nbSentError_
FUResourceVec_t resources_
UInt_t runNumber_
UInt_t shutdownStatus_
unsigned int shutdownTimeout_
SMProxysm_
bool stopFlag_
UInt_t sumOfSizes_
uint64_t sumOfSquares_

Detailed Description

Base class for methods (types) of IPC. Subclasses: FUResourceTable, FUResourceQueue.

Author:
smorovic

Definition at line 42 of file IPCMethod.h.


Constructor & Destructor Documentation

IPCMethod::IPCMethod ( bool  segmentationMode,
UInt_t  nbRawCells,
UInt_t  nbRecoCells,
UInt_t  nbDqmCells,
UInt_t  rawCellSize,
UInt_t  recoCellSize,
UInt_t  dqmCellSize,
int  freeResReq,
BUProxy bu,
SMProxy sm,
log4cplus::Logger  logger,
unsigned int  timeout,
EvffedFillerRB frb,
xdaq::Application *  app 
) throw (evf::Exception)

Definition at line 28 of file IPCMethod.cc.

                                                                               :
        bu_(bu), sm_(sm), log_(logger), nbDqmCells_(nbDqmCells),
                        nbRawCells_(nbRawCells), nbRecoCells_(nbRecoCells),
                        acceptSMDataDiscard_(0), acceptSMDqmDiscard_(0), doCrcCheck_(1),
                        shutdownTimeout_(timeout), nbPending_(0), nbClientsToShutDown_(0),
                        isReadyToShutDown_(true), isActive_(false), runNumber_(0xffffffff),
                        frb_(frb), app_(app) {

        // if the freeResRequiredForAllocate_ threshold is set in configuration use that
        // otherwise use nbRawCells / 2
        if (freeResReq < 0)
                freeResRequiredForAllocate_ = nbRawCells_ / 2;
        else
                freeResRequiredForAllocate_ = freeResReq;

        sem_init(&lock_, 0, 1);
        //pthread_mutex_init(&crashHandlerLock_, NULL);
}
IPCMethod::~IPCMethod ( ) [virtual]

Definition at line 51 of file IPCMethod.cc.

                      {

}

Member Function Documentation

UInt_t IPCMethod::allocateResource ( )

Returns the fuResourceId of the allocated resource

Definition at line 60 of file IPCMethod.cc.

References freeResourceIds_, lock(), nbAllocated_, nbPending_, and unlock().

Referenced by sendAllocate().

                                   {
        assert(!freeResourceIds_.empty());

        lock();
        UInt_t fuResourceId = freeResourceIds_.front();
        freeResourceIds_.pop();
        nbPending_++;
        nbAllocated_++;
        unlock();

        return fuResourceId;
}
virtual bool evf::IPCMethod::buildResource ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual std::vector<UInt_t> evf::IPCMethod::cellEvtNumbers ( ) const [pure virtual]
virtual std::vector<pid_t> evf::IPCMethod::cellPrcIds ( ) const [pure virtual]
virtual std::vector<std::string> evf::IPCMethod::cellStates ( ) const [pure virtual]
virtual std::vector<time_t> evf::IPCMethod::cellTimeStamps ( ) const [pure virtual]
virtual void evf::IPCMethod::clear ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual std::vector<pid_t> evf::IPCMethod::clientPrcIds ( ) const [pure virtual]
virtual std::string evf::IPCMethod::clientPrcIdsAsString ( ) const [pure virtual]
virtual bool evf::IPCMethod::discard ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::discard().

virtual bool evf::IPCMethod::discardDataEvent ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual bool evf::IPCMethod::discardDataEventWhileHalting ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual bool evf::IPCMethod::discardDqmEvent ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual bool evf::IPCMethod::discardDqmEventWhileHalting ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

virtual bool evf::IPCMethod::discardWhileHalting ( bool  sendDiscards) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::discard().

virtual std::vector<std::string> evf::IPCMethod::dqmCellStates ( ) const [pure virtual]
virtual void evf::IPCMethod::dropEvent ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

void IPCMethod::dumpEvent ( evf::FUShmRawCell cell)

Dump event to ASCII file.

Reimplemented in evf::FUResourceQueue.

Definition at line 74 of file IPCMethod.cc.

References evf::FUShmRawCell::evtNumber(), evf::FUShmRawCell::fedAddr(), evf::FUShmRawCell::fedSize(), groupFilesInBlocks::fout, i, j, and evf::FUShmRawCell::nFed().

                                            {
        std::ostringstream oss;
        oss << "/tmp/evt" << cell->evtNumber() << ".dump";
        ofstream fout(oss.str().c_str());
        fout.fill('0');

        fout << "#\n# evt " << cell->evtNumber() << "\n#\n" << endl;
        for (unsigned int i = 0; i < cell->nFed(); i++) {
                if (cell->fedSize(i) == 0)
                        continue;
                fout << "# fedid " << i << endl;
                unsigned char* addr = cell->fedAddr(i);
                for (unsigned int j = 0; j < cell->fedSize(i); j++) {
                        fout << std::setiosflags(std::ios::right) << std::setw(2)
                                        << std::hex << (int) (*addr) << std::dec;
                        if ((j + 1) % 8)
                                fout << " ";
                        else
                                fout << endl;
                        ++addr;
                }
                fout << endl;
        }
        fout.close();
}
virtual bool evf::IPCMethod::handleCrashedEP ( UInt_t  runNumber,
pid_t  pid 
) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::Stopping::emergencyStop(), and evf::rb_statemachine::SharedResources::watching().

void IPCMethod::injectCRCError ( )

Definition at line 264 of file IPCMethod.cc.

References i, and resources_.

                               {
        for (UInt_t i = 0; i < resources_.size(); i++) {
                resources_[i]->scheduleCRCError();
        }
}
bool evf::IPCMethod::isActive ( ) const [inline]

Check if resource table is active (enabled).

Definition at line 175 of file IPCMethod.h.

References isActive_.

                              {
                return isActive_;
        }
bool IPCMethod::isLastMessageOfEvent ( MemRef_t bufRef)

Definition at line 248 of file IPCMethod.cc.

References Association::block.

Referenced by evf::FUResourceQueue::buildResource().

                                                     {
        while (0 != bufRef->getNextReference())
                bufRef = bufRef->getNextReference();

        I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME *block =
                        (I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME*) bufRef->getDataLocation();

        UInt_t iBlock = block->blockNb;
        UInt_t nBlock = block->nbBlocksInSuperFragment;
        UInt_t iSuperFrag = block->superFragmentNb;
        UInt_t nSuperFrag = block->nbSuperFragmentsInEvent;

        return ((iSuperFrag == nSuperFrag - 1) && (iBlock == nBlock - 1));
}
bool evf::IPCMethod::isReadyToShutDown ( ) const [inline]

Check if resource table can be safely destroyed.

Definition at line 186 of file IPCMethod.h.

References isReadyToShutDown_.

Referenced by evf::rb_statemachine::Stopping::emergencyStop().

                                       {
                return isReadyToShutDown_;
        }
virtual void evf::IPCMethod::lastResort ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::Stopping::emergencyStop().

void evf::IPCMethod::lock ( void  ) [inline]

Definition at line 306 of file IPCMethod.h.

References lock_, and log_.

Referenced by allocateResource(), evf::FUResourceQueue::buildResource(), evf::FUResourceQueue::discard(), evf::FUResourceQueue::discardWhileHalting(), evf::FUResourceQueue::sendData(), and evf::FUResourceQueue::sendDataWhileHalting().

                    {
                //lock_.take();
                while (0 != sem_wait(&lock_)) {
                        if (errno != EINTR) {
                                LOG4CPLUS_ERROR(log_, "Cannot obtain lock on sem LOCK!");
                        }
                }
        }
UInt_t evf::IPCMethod::nbAllocated ( ) const [inline]

Definition at line 207 of file IPCMethod.h.

References nbAllocated_.

                                   {
                return nbAllocated_;
        }
UInt_t evf::IPCMethod::nbAllocSent ( ) const [inline]

Definition at line 252 of file IPCMethod.h.

References nbAllocSent_.

                                   {
                return nbAllocSent_;
        }
virtual UInt_t evf::IPCMethod::nbClients ( ) const [pure virtual]
UInt_t evf::IPCMethod::nbCompleted ( ) const [inline]

Definition at line 213 of file IPCMethod.h.

References nbCompleted_.

                                   {
                return nbCompleted_;
        }
UInt_t evf::IPCMethod::nbCrcErrors ( ) const [inline]

Definition at line 249 of file IPCMethod.h.

References nbCrcErrors_.

                                   {
                return nbCrcErrors_;
        }
UInt_t evf::IPCMethod::nbDiscarded ( ) const [inline]

Definition at line 231 of file IPCMethod.h.

References nbDiscarded_.

                                   {
                return nbDiscarded_;
        }
UInt_t evf::IPCMethod::nbEolDiscarded ( ) const [inline]

Definition at line 242 of file IPCMethod.h.

References nbEolDiscarded_.

                                      {
                return nbEolDiscarded_;
        }
UInt_t evf::IPCMethod::nbEolPosted ( ) const [inline]

Definition at line 239 of file IPCMethod.h.

References nbEolPosted_.

                                   {
                return nbEolPosted_;
        }
UInt_t evf::IPCMethod::nbErrors ( ) const [inline]

Definition at line 246 of file IPCMethod.h.

References nbErrors_.

                                {
                return nbErrors_;
        }
UInt_t evf::IPCMethod::nbFreeSlots ( ) const [inline]
UInt_t evf::IPCMethod::nbLost ( ) const [inline]

Definition at line 234 of file IPCMethod.h.

References nbLost_.

                              {
                return nbLost_;
        }
UInt_t evf::IPCMethod::nbPending ( ) const [inline]

Definition at line 210 of file IPCMethod.h.

References nbPending_.

                                 {
                return nbPending_;
        }
UInt_t evf::IPCMethod::nbPendingSMDiscards ( ) const [inline]

Definition at line 225 of file IPCMethod.h.

References nbPendingSMDiscards_.

                                           {
                return nbPendingSMDiscards_;
        }
int evf::IPCMethod::nbPendingSMDqmDiscards ( ) const [inline]

Definition at line 228 of file IPCMethod.h.

References nbPendingSMDqmDiscards_.

virtual UInt_t evf::IPCMethod::nbResources ( ) const [pure virtual]
UInt_t evf::IPCMethod::nbSent ( ) const [inline]
UInt_t evf::IPCMethod::nbSentDqm ( ) const [inline]

Definition at line 222 of file IPCMethod.h.

References nbSentDqm_.

                                 {
                return nbSentDqm_;
        }
UInt_t evf::IPCMethod::nbSentError ( ) const [inline]

Definition at line 219 of file IPCMethod.h.

References nbSentError_.

                                   {
                return nbSentError_;
        }
virtual void evf::IPCMethod::postEndOfLumiSection ( MemRef_t bufRef) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

std::string IPCMethod::printStatus ( ) [virtual]

Print debugging status.

Reimplemented in evf::FUResourceTable.

Definition at line 101 of file IPCMethod.cc.

References alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

                                 {
        std::string s = "Status not implemented";
        return s;
}
void IPCMethod::releaseResources ( )

releases all FUResource's

Definition at line 143 of file IPCMethod.cc.

References i, fetchall_from_DQM_v2::release, and resources_.

                                 {
        for (UInt_t i = 0; i < resources_.size(); i++)
                resources_[i]->release(true);

}
virtual void evf::IPCMethod::resetCounters ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::Enabling::do_stateAction().

virtual void evf::IPCMethod::resetIPC ( ) [pure virtual]

resets the underlying IPC method to the initial state

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

void IPCMethod::resetPendingAllocates ( )

resets free resources to the maximum number

Definition at line 129 of file IPCMethod.cc.

References freeResourceIds_, i, log_, and nbRawCells_.

                                      {
        if (freeResourceIds_.size() < nbRawCells_) {
                LOG4CPLUS_INFO(
                                log_,
                                "There are " << nbRawCells_ - freeResourceIds_.size()
                                                << " pending ALLOCATE messages! Forgetting...");
                while (!freeResourceIds_.empty())
                        freeResourceIds_.pop();
                for (UInt_t i = 0; i < nbRawCells_; i++)
                        freeResourceIds_.push(i);
        }
}
void IPCMethod::sendAllocate ( )

Definition at line 111 of file IPCMethod.cc.

References allocateResource(), bu_, freeResRequiredForAllocate_, i, nbAllocSent_, nbFreeSlots(), and evf::BUProxy::sendAllocate().

Referenced by evf::FUResourceQueue::buildResource(), evf::FUResourceQueue::discard(), evf::FUResourceQueue::discardWhileHalting(), and evf::rb_statemachine::Enabling::do_stateAction().

                             {
        UInt_t nbFreeSlots = this->nbFreeSlots();
        /*UInt_t nbFreeSlotsMax = 0*///reverting to larger chunk requests for BU
        //UInt_t nbFreeSlotsMax = nbResources() / 2;
        UInt_t nbFreeSlotsMax = freeResRequiredForAllocate_;

        if (nbFreeSlots > nbFreeSlotsMax) {
                UIntVec_t fuResourceIds;
                for (UInt_t i = 0; i < nbFreeSlots; i++)
                        fuResourceIds.push_back(allocateResource());

                bu_->sendAllocate(fuResourceIds);

                nbAllocSent_++;
        }
}
virtual bool evf::IPCMethod::sendData ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::sendData().

void IPCMethod::sendDataEvent ( UInt_t  fuResourceId,
UInt_t  runNumber,
UInt_t  evtNumber,
UInt_t  outModId,
UInt_t  fuProcessId,
UInt_t  fuGuid,
UChar_t data,
UInt_t  dataSize 
)

Definition at line 171 of file IPCMethod.cc.

References acceptSMDataDiscard_, log_, evf::SMProxy::sendDataEvent(), sm_, sumOfSizes_, and sumOfSquares_.

Referenced by evf::FUResourceQueue::sendData(), and evf::FUResourceQueue::sendDataWhileHalting().

                                                {
        if (0 == sm_) {
                LOG4CPLUS_ERROR(log_, "No StorageManager, DROP DATA EVENT!");
        } else {
                acceptSMDataDiscard_[fuResourceId] = true;
                UInt_t nbBytes = sm_->sendDataEvent(fuResourceId, runNumber, evtNumber,
                                outModId, fuProcessId, fuGuid, data, dataSize);
                sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
                sumOfSizes_ += nbBytes;
        }
}
virtual bool evf::IPCMethod::sendDataWhileHalting ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::sendData().

void IPCMethod::sendDiscard ( UInt_t  buResourceId)
virtual bool evf::IPCMethod::sendDqm ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::sendDqm().

void IPCMethod::sendDqmEvent ( UInt_t  fuDqmId,
UInt_t  runNumber,
UInt_t  evtAtUpdate,
UInt_t  folderId,
UInt_t  fuProcessId,
UInt_t  fuGuid,
UChar_t data,
UInt_t  dataSize 
)

Definition at line 224 of file IPCMethod.cc.

References acceptSMDqmDiscard_, log_, nbPendingSMDqmDiscards_, nbSentDqm_, evf::SMProxy::sendDqmEvent(), and sm_.

Referenced by evf::FUResourceQueue::sendDqm(), and evf::FUResourceQueue::sendDqmWhileHalting().

                                                {
        if (0 == sm_) {
                LOG4CPLUS_WARN(log_, "No StorageManager, DROP DQM EVENT.");
        } else {

                nbPendingSMDqmDiscards_++;

                acceptSMDqmDiscard_[fuDqmId]++;
                if (acceptSMDqmDiscard_[fuDqmId] > 1)
                        LOG4CPLUS_WARN(
                                        log_,
                                        "DQM Cell " << fuDqmId
                                                        << " being sent more than once for folder "
                                                        << folderId << " process " << fuProcessId
                                                        << " guid " << fuGuid);
                nbSentDqm_++;
                sm_->sendDqmEvent(fuDqmId, runNumber, evtAtUpdate, folderId,
                                fuProcessId, fuGuid, data, dataSize);
        }
}
virtual bool evf::IPCMethod::sendDqmWhileHalting ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

Referenced by evf::rb_statemachine::SharedResources::sendDqm().

void IPCMethod::sendErrorEvent ( UInt_t  fuResourceId,
UInt_t  runNumber,
UInt_t  evtNumber,
UInt_t  fuProcessId,
UInt_t  fuGuid,
UChar_t data,
UInt_t  dataSize 
)

Definition at line 186 of file IPCMethod.cc.

References acceptSMDataDiscard_, log_, evf::SMProxy::sendErrorEvent(), sm_, sumOfSizes_, and sumOfSquares_.

Referenced by evf::FUResourceQueue::sendData(), and evf::FUResourceQueue::sendDataWhileHalting().

                                 {
        if (0 == sm_) {
                LOG4CPLUS_ERROR(log_, "No StorageManager, DROP ERROR EVENT!");
        } else {
                acceptSMDataDiscard_[fuResourceId] = true;
                UInt_t nbBytes = sm_->sendErrorEvent(fuResourceId, runNumber,
                                evtNumber, fuProcessId, fuGuid, data, dataSize);
                sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
                sumOfSizes_ += nbBytes;
        }

        //   if (0!=shmBuffer_) {
        //     UInt_t n=nbDqmCells_;

        //     for (UInt_t i=0;i<n;i++) {
        //       if(shmBuffer_->dqmCell(i)->fuProcessId()==fuProcessId)
        //      {
        //        if(shmBuffer_->dqmState(i)!=dqm::SENT){
        //          shmBuffer_->setDqmState(i,dqm::SENT);
        //          shmBuffer_->discardDqmCell(i);
        //          acceptSMDqmDiscard_[i] = false;
        //        }
        //      }
        //     }
        //     n=nbRecoCells_;
        //     for (UInt_t i=0;i<n;i++) {
        //       if(shmBuffer_->recoCell(i)->fuProcessId()==fuProcessId)
        //      {
        //        shmBuffer_->discardOrphanedRecoCell(i);
        //      }
        //     }

        //   }
}
void IPCMethod::sendInitMessage ( UInt_t  fuResourceId,
UInt_t  outModId,
UInt_t  fuProcessId,
UInt_t  fuGuid,
UChar_t data,
UInt_t  dataSize,
UInt_t  nExpectedEPs 
)

Definition at line 156 of file IPCMethod.cc.

References acceptSMDataDiscard_, log_, evf::SMProxy::sendInitMessage(), sm_, sumOfSizes_, and sumOfSquares_.

Referenced by evf::FUResourceQueue::sendData(), and evf::FUResourceQueue::sendDataWhileHalting().

                                     {
        if (0 == sm_) {
                LOG4CPLUS_ERROR(log_, "No StorageManager, DROP INIT MESSAGE!");
        } else {
                acceptSMDataDiscard_[fuResourceId] = true;
                UInt_t nbBytes = sm_->sendInitMessage(fuResourceId, outModId,
                                fuProcessId, fuGuid, data, dataSize, nExpectedEPs);
                sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
                sumOfSizes_ += nbBytes;
        }
}
void evf::IPCMethod::setActive ( bool  activeValue) [inline]

Definition at line 179 of file IPCMethod.h.

References isActive_.

Referenced by evf::rb_statemachine::SharedResources::startDiscardWorkLoop().

                                         {
                isActive_ = activeValue;
        }
void evf::IPCMethod::setDoCrcCheck ( UInt_t  doCrcCheck) [inline]

Tell resources whether to check the CRC

Definition at line 161 of file IPCMethod.h.

References doCrcCheck_.

Referenced by evf::rb_statemachine::SharedResources::configureResources().

                                              {
                doCrcCheck_ = doCrcCheck;
        }
void evf::IPCMethod::setDoDumpEvents ( UInt_t  doDumpEvents) [inline]

Tell resources whether to dump events to an ASCII file.

Definition at line 168 of file IPCMethod.h.

References doDumpEvents_.

Referenced by evf::rb_statemachine::SharedResources::configureResources().

                                                  {
                doDumpEvents_ = doDumpEvents;
        }
void evf::IPCMethod::setReadyToShutDown ( bool  readyValue) [inline]

Definition at line 190 of file IPCMethod.h.

References isReadyToShutDown_.

Referenced by evf::rb_statemachine::SharedResources::startDiscardWorkLoop().

                                                 {
                isReadyToShutDown_ = readyValue;
        }
void evf::IPCMethod::setRunNumber ( UInt_t  runNumber) [inline]
void evf::IPCMethod::setStopFlag ( bool  status) [inline]

Definition at line 198 of file IPCMethod.h.

References ntuplemaker::status, and stopFlag_.

virtual void evf::IPCMethod::shutDownClients ( ) [pure virtual]

Has to be implemented by subclasses, according to IPC type.

Implemented in evf::FUResourceQueue, and evf::FUResourceTable.

UInt_t evf::IPCMethod::shutdownStatus ( ) [inline]

Definition at line 194 of file IPCMethod.h.

References shutdownStatus_.

Referenced by evf::rb_statemachine::Stopping::emergencyStop().

                                {
                return shutdownStatus_;
        }
UInt_t evf::IPCMethod::sumOfSizes ( ) const [inline]

Definition at line 259 of file IPCMethod.h.

References sumOfSizes_.

Referenced by evf::rb_statemachine::SharedResources::monitoring().

                                  {
                return sumOfSizes_;
        }
uint64_t evf::IPCMethod::sumOfSquares ( ) const [inline]

Definition at line 256 of file IPCMethod.h.

References sumOfSquares_.

Referenced by evf::rb_statemachine::SharedResources::monitoring().

                                      {
                return sumOfSquares_;
        }
void evf::IPCMethod::unlock ( void  ) [inline]

Member Data Documentation

Definition at line 352 of file IPCMethod.h.

Referenced by sendDataEvent(), sendErrorEvent(), and sendInitMessage().

Definition at line 353 of file IPCMethod.h.

Referenced by sendDqmEvent().

xdaq::Application* evf::IPCMethod::app_ [protected]

Definition at line 391 of file IPCMethod.h.

Definition at line 339 of file IPCMethod.h.

Referenced by evf::FUResourceQueue::buildResource(), sendAllocate(), and sendDiscard().

Definition at line 355 of file IPCMethod.h.

Referenced by evf::FUResourceQueue::buildResource(), and setDoCrcCheck().

Definition at line 356 of file IPCMethod.h.

Referenced by setDoDumpEvents().

Definition at line 390 of file IPCMethod.h.

Referenced by evf::FUResourceQueue::buildResource().

std::queue<UInt_t> evf::IPCMethod::freeResourceIds_ [protected]

Definition at line 350 of file IPCMethod.h.

Referenced by sendAllocate().

bool evf::IPCMethod::isActive_ [protected]

Definition at line 375 of file IPCMethod.h.

Referenced by isActive(), and setActive().

sem_t evf::IPCMethod::lock_ [protected]

Definition at line 386 of file IPCMethod.h.

Referenced by lock(), and unlock().

log4cplus::Logger evf::IPCMethod::log_ [protected]

Definition at line 379 of file IPCMethod.h.

Referenced by nbAllocSent(), evf::FUResourceQueue::resetCounters(), and sendAllocate().

Definition at line 373 of file IPCMethod.h.

Definition at line 344 of file IPCMethod.h.

Definition at line 371 of file IPCMethod.h.

Referenced by nbEolDiscarded().

Definition at line 370 of file IPCMethod.h.

Referenced by nbEolPosted().

std::atomic<int> evf::IPCMethod::nbPendingSMDqmDiscards_ [protected]

Definition at line 345 of file IPCMethod.h.

Referenced by resetPendingAllocates().

Definition at line 346 of file IPCMethod.h.

Definition at line 364 of file IPCMethod.h.

Referenced by nbSentDqm(), evf::FUResourceQueue::resetCounters(), and sendDqmEvent().

Definition at line 395 of file IPCMethod.h.

Referenced by shutdownStatus().

unsigned int evf::IPCMethod::shutdownTimeout_ [protected]

Definition at line 357 of file IPCMethod.h.

Definition at line 340 of file IPCMethod.h.

Referenced by sendDataEvent(), sendDqmEvent(), sendErrorEvent(), and sendInitMessage().

bool evf::IPCMethod::stopFlag_ [protected]

Definition at line 396 of file IPCMethod.h.

Referenced by setStopFlag().

uint64_t evf::IPCMethod::sumOfSquares_ [protected]