CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
evf::IPCMethod Class Referenceabstract

#include <IPCMethod.h>

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

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 More...
 
virtual void resetCounters ()=0
 
virtual void resetIPC ()=0
 resets the underlying IPC method to the initial state More...
 
void resetPendingAllocates ()
 resets free resources to the maximum number More...
 
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.

32  :
33  bu_(bu), sm_(sm), log_(logger), nbDqmCells_(nbDqmCells),
34  nbRawCells_(nbRawCells), nbRecoCells_(nbRecoCells),
37  isReadyToShutDown_(true), isActive_(false), runNumber_(0xffffffff),
38  frb_(frb), app_(app) {
39 
40  // if the freeResRequiredForAllocate_ threshold is set in configuration use that
41  // otherwise use nbRawCells / 2
42  if (freeResReq < 0)
44  else
45  freeResRequiredForAllocate_ = freeResReq;
46 
47  sem_init(&lock_, 0, 1);
48  //pthread_mutex_init(&crashHandlerLock_, NULL);
49 }
bool * acceptSMDataDiscard_
Definition: IPCMethod.h:352
UInt_t doCrcCheck_
Definition: IPCMethod.h:355
std::ostream & logger()
Definition: fwLog.cc:41
bool isReadyToShutDown_
Definition: IPCMethod.h:374
log4cplus::Logger log_
Definition: IPCMethod.h:342
SMProxy * sm_
Definition: IPCMethod.h:340
UInt_t nbRawCells_
Definition: IPCMethod.h:345
UInt_t nbPending_
Definition: IPCMethod.h:360
int * acceptSMDqmDiscard_
Definition: IPCMethod.h:353
unsigned int freeResRequiredForAllocate_
Definition: IPCMethod.h:350
xdaq::Application * app_
Definition: IPCMethod.h:391
UInt_t runNumber_
Definition: IPCMethod.h:384
UInt_t nbClientsToShutDown_
Definition: IPCMethod.h:373
unsigned int shutdownTimeout_
Definition: IPCMethod.h:357
EvffedFillerRB * frb_
Definition: IPCMethod.h:390
UInt_t nbRecoCells_
Definition: IPCMethod.h:346
BUProxy * bu_
Definition: IPCMethod.h:339
UInt_t nbDqmCells_
Definition: IPCMethod.h:344
IPCMethod::~IPCMethod ( )
virtual

Definition at line 51 of file IPCMethod.cc.

51  {
52 
53 }

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().

60  {
61  assert(!freeResourceIds_.empty());
62 
63  lock();
64  UInt_t fuResourceId = freeResourceIds_.front();
65  freeResourceIds_.pop();
66  nbPending_++;
67  nbAllocated_++;
68  unlock();
69 
70  return fuResourceId;
71 }
UInt_t nbPending_
Definition: IPCMethod.h:360
unsigned int UInt_t
Definition: FUTypes.h:12
UInt_t nbAllocated_
Definition: IPCMethod.h:359
std::queue< UInt_t > freeResourceIds_
Definition: IPCMethod.h:348
void unlock()
Definition: IPCMethod.h:314
virtual bool evf::IPCMethod::buildResource ( MemRef_t bufRef)
pure virtual

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

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

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
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::FUResourceTable, and evf::FUResourceQueue.

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::FUResourceTable, and evf::FUResourceQueue.

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

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

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

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

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

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

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

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

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

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

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

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

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::FUResourceTable, and evf::FUResourceQueue.

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

Dump event to ASCII file.

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().

74  {
75  std::ostringstream oss;
76  oss << "/tmp/evt" << cell->evtNumber() << ".dump";
77  ofstream fout(oss.str().c_str());
78  fout.fill('0');
79 
80  fout << "#\n# evt " << cell->evtNumber() << "\n#\n" << endl;
81  for (unsigned int i = 0; i < cell->nFed(); i++) {
82  if (cell->fedSize(i) == 0)
83  continue;
84  fout << "# fedid " << i << endl;
85  unsigned char* addr = cell->fedAddr(i);
86  for (unsigned int j = 0; j < cell->fedSize(i); j++) {
87  fout << std::setiosflags(std::ios::right) << std::setw(2)
88  << std::hex << (int) (*addr) << std::dec;
89  if ((j + 1) % 8)
90  fout << " ";
91  else
92  fout << endl;
93  ++addr;
94  }
95  fout << endl;
96  }
97  fout.close();
98 }
int i
Definition: DBlmapReader.cc:9
unsigned int evtNumber() const
Definition: FUShmRawCell.h:28
int j
Definition: DBlmapReader.cc:9
unsigned char * fedAddr(unsigned int i) const
Definition: FUShmRawCell.cc:94
unsigned int nFed() const
Definition: FUShmRawCell.h:33
unsigned int fedSize(unsigned int i) const
Definition: FUShmRawCell.cc:82
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::FUResourceTable, and evf::FUResourceQueue.

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

264  {
265  for (UInt_t i = 0; i < resources_.size(); i++) {
266  resources_[i]->scheduleCRCError();
267  }
268 }
int i
Definition: DBlmapReader.cc:9
FUResourceVec_t resources_
Definition: IPCMethod.h:393
unsigned int UInt_t
Definition: FUTypes.h:12
bool evf::IPCMethod::isActive ( ) const
inline

Check if resource table is active (enabled).

Definition at line 175 of file IPCMethod.h.

References isActive_.

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

Definition at line 248 of file IPCMethod.cc.

References createPayload::block.

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

248  {
249  while (0 != bufRef->getNextReference())
250  bufRef = bufRef->getNextReference();
251 
252  I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME *block =
253  (I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME*) bufRef->getDataLocation();
254 
255  UInt_t iBlock = block->blockNb;
256  UInt_t nBlock = block->nbBlocksInSuperFragment;
257  UInt_t iSuperFrag = block->superFragmentNb;
258  UInt_t nSuperFrag = block->nbSuperFragmentsInEvent;
259 
260  return ((iSuperFrag == nSuperFrag - 1) && (iBlock == nBlock - 1));
261 }
unsigned int UInt_t
Definition: FUTypes.h:12
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().

186  {
187  return isReadyToShutDown_;
188  }
bool isReadyToShutDown_
Definition: IPCMethod.h:374
virtual void evf::IPCMethod::lastResort ( )
pure virtual

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

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

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().

306  {
307  //lock_.take();
308  while (0 != sem_wait(&lock_)) {
309  if (errno != EINTR) {
310  LOG4CPLUS_ERROR(log_, "Cannot obtain lock on sem LOCK!");
311  }
312  }
313  }
log4cplus::Logger log_
Definition: IPCMethod.h:342
UInt_t evf::IPCMethod::nbAllocated ( ) const
inline

Definition at line 207 of file IPCMethod.h.

References nbAllocated_.

207  {
208  return nbAllocated_;
209  }
UInt_t nbAllocated_
Definition: IPCMethod.h:359
UInt_t evf::IPCMethod::nbAllocSent ( ) const
inline

Definition at line 252 of file IPCMethod.h.

References nbAllocSent_.

252  {
253  return nbAllocSent_;
254  }
UInt_t nbAllocSent_
Definition: IPCMethod.h:379
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_.

213  {
214  return nbCompleted_;
215  }
UInt_t nbCompleted_
Definition: IPCMethod.h:361
UInt_t evf::IPCMethod::nbCrcErrors ( ) const
inline

Definition at line 249 of file IPCMethod.h.

References nbCrcErrors_.

249  {
250  return nbCrcErrors_;
251  }
UInt_t nbCrcErrors_
Definition: IPCMethod.h:378
UInt_t evf::IPCMethod::nbDiscarded ( ) const
inline

Definition at line 231 of file IPCMethod.h.

References nbDiscarded_.

231  {
232  return nbDiscarded_;
233  }
UInt_t nbDiscarded_
Definition: IPCMethod.h:367
UInt_t evf::IPCMethod::nbEolDiscarded ( ) const
inline

Definition at line 242 of file IPCMethod.h.

References nbEolDiscarded_.

242  {
243  return nbEolDiscarded_;
244  }
UInt_t nbEolDiscarded_
Definition: IPCMethod.h:371
UInt_t evf::IPCMethod::nbEolPosted ( ) const
inline

Definition at line 239 of file IPCMethod.h.

References nbEolPosted_.

239  {
240  return nbEolPosted_;
241  }
UInt_t nbEolPosted_
Definition: IPCMethod.h:370
UInt_t evf::IPCMethod::nbErrors ( ) const
inline

Definition at line 246 of file IPCMethod.h.

References nbErrors_.

246  {
247  return nbErrors_;
248  }
UInt_t nbErrors_
Definition: IPCMethod.h:377
UInt_t evf::IPCMethod::nbFreeSlots ( ) const
inline

Definition at line 204 of file IPCMethod.h.

References freeResourceIds_.

Referenced by evf::rb_statemachine::SharedResources::configureResources(), sendAllocate(), and evf::rb_statemachine::SharedResources::watching().

204  {
205  return freeResourceIds_.size();
206  }
std::queue< UInt_t > freeResourceIds_
Definition: IPCMethod.h:348
UInt_t evf::IPCMethod::nbLost ( ) const
inline

Definition at line 234 of file IPCMethod.h.

References nbLost_.

234  {
235  return nbLost_;
236  }
UInt_t nbLost_
Definition: IPCMethod.h:368
UInt_t evf::IPCMethod::nbPending ( ) const
inline

Definition at line 210 of file IPCMethod.h.

References nbPending_.

210  {
211  return nbPending_;
212  }
UInt_t nbPending_
Definition: IPCMethod.h:360
UInt_t evf::IPCMethod::nbPendingSMDiscards ( ) const
inline

Definition at line 225 of file IPCMethod.h.

References nbPendingSMDiscards_.

225  {
226  return nbPendingSMDiscards_;
227  }
UInt_t nbPendingSMDiscards_
Definition: IPCMethod.h:365
int evf::IPCMethod::nbPendingSMDqmDiscards ( ) const
inline

Definition at line 228 of file IPCMethod.h.

References nbPendingSMDqmDiscards_.

228  {
230  }
std::atomic< int > nbPendingSMDqmDiscards_
Definition: IPCMethod.h:366
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_.

222  {
223  return nbSentDqm_;
224  }
UInt_t nbSentDqm_
Definition: IPCMethod.h:364
UInt_t evf::IPCMethod::nbSentError ( ) const
inline

Definition at line 219 of file IPCMethod.h.

References nbSentError_.

219  {
220  return nbSentError_;
221  }
UInt_t nbSentError_
Definition: IPCMethod.h:363
virtual void evf::IPCMethod::postEndOfLumiSection ( MemRef_t bufRef)
pure virtual

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

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

std::string IPCMethod::printStatus ( )
virtual

Print debugging status.

Reimplemented in evf::FUResourceTable.

Definition at line 101 of file IPCMethod.cc.

References alignCSCRings::s.

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

releases all FUResource's

Definition at line 143 of file IPCMethod.cc.

References i, fetchall_from_DQM_v2::release, and resources_.

143  {
144  for (UInt_t i = 0; i < resources_.size(); i++)
145  resources_[i]->release(true);
146 
147 }
int i
Definition: DBlmapReader.cc:9
FUResourceVec_t resources_
Definition: IPCMethod.h:393
unsigned int UInt_t
Definition: FUTypes.h:12
virtual void evf::IPCMethod::resetCounters ( )
pure virtual

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

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

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::FUResourceTable, and evf::FUResourceQueue.

void IPCMethod::resetPendingAllocates ( )

resets free resources to the maximum number

Definition at line 129 of file IPCMethod.cc.

References freeResourceIds_, i, log_, and nbRawCells_.

129  {
130  if (freeResourceIds_.size() < nbRawCells_) {
131  LOG4CPLUS_INFO(
132  log_,
133  "There are " << nbRawCells_ - freeResourceIds_.size()
134  << " pending ALLOCATE messages! Forgetting...");
135  while (!freeResourceIds_.empty())
136  freeResourceIds_.pop();
137  for (UInt_t i = 0; i < nbRawCells_; i++)
138  freeResourceIds_.push(i);
139  }
140 }
int i
Definition: DBlmapReader.cc:9
log4cplus::Logger log_
Definition: IPCMethod.h:342
UInt_t nbRawCells_
Definition: IPCMethod.h:345
unsigned int UInt_t
Definition: FUTypes.h:12
std::queue< UInt_t > freeResourceIds_
Definition: IPCMethod.h:348
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().

111  {
112  UInt_t nbFreeSlots = this->nbFreeSlots();
113  /*UInt_t nbFreeSlotsMax = 0*///reverting to larger chunk requests for BU
114  //UInt_t nbFreeSlotsMax = nbResources() / 2;
115  UInt_t nbFreeSlotsMax = freeResRequiredForAllocate_;
116 
117  if (nbFreeSlots > nbFreeSlotsMax) {
118  UIntVec_t fuResourceIds;
119  for (UInt_t i = 0; i < nbFreeSlots; i++)
120  fuResourceIds.push_back(allocateResource());
121 
122  bu_->sendAllocate(fuResourceIds);
123 
124  nbAllocSent_++;
125  }
126 }
int i
Definition: DBlmapReader.cc:9
void sendAllocate(const UIntVec_t &fuResourceIds)
Definition: BUProxy.cc:51
UInt_t allocateResource()
Definition: IPCMethod.cc:60
unsigned int freeResRequiredForAllocate_
Definition: IPCMethod.h:350
UInt_t nbFreeSlots() const
Definition: IPCMethod.h:204
unsigned int UInt_t
Definition: FUTypes.h:12
UInt_t nbAllocSent_
Definition: IPCMethod.h:379
BUProxy * bu_
Definition: IPCMethod.h:339
std::vector< UInt_t > UIntVec_t
Definition: FUTypes.h:15
virtual bool evf::IPCMethod::sendData ( )
pure virtual

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

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

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().

173  {
174  if (0 == sm_) {
175  LOG4CPLUS_ERROR(log_, "No StorageManager, DROP DATA EVENT!");
176  } else {
177  acceptSMDataDiscard_[fuResourceId] = true;
178  UInt_t nbBytes = sm_->sendDataEvent(fuResourceId, runNumber, evtNumber,
179  outModId, fuProcessId, fuGuid, data, dataSize);
180  sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
181  sumOfSizes_ += nbBytes;
182  }
183 }
bool * acceptSMDataDiscard_
Definition: IPCMethod.h:352
uint64_t sumOfSquares_
Definition: IPCMethod.h:381
log4cplus::Logger log_
Definition: IPCMethod.h:342
SMProxy * sm_
Definition: IPCMethod.h:340
unsigned int UInt_t
Definition: FUTypes.h:12
unsigned long long uint64_t
Definition: Time.h:15
UInt_t 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: SMProxy.cc:91
UInt_t sumOfSizes_
Definition: IPCMethod.h:382
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual bool evf::IPCMethod::sendDataWhileHalting ( )
pure virtual

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

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

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

void IPCMethod::sendDiscard ( UInt_t  buResourceId)

Definition at line 150 of file IPCMethod.cc.

References bu_, nbDiscarded_, and evf::BUProxy::sendDiscard().

Referenced by evf::FUResourceQueue::discard(), and evf::FUResourceQueue::discardWhileHalting().

150  {
151  bu_->sendDiscard(buResourceId);
152  nbDiscarded_++;
153 }
void sendDiscard(UInt_t buResourceId)
Definition: BUProxy.cc:108
UInt_t nbDiscarded_
Definition: IPCMethod.h:367
BUProxy * bu_
Definition: IPCMethod.h:339
virtual bool evf::IPCMethod::sendDqm ( )
pure virtual

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

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

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().

226  {
227  if (0 == sm_) {
228  LOG4CPLUS_WARN(log_, "No StorageManager, DROP DQM EVENT.");
229  } else {
230 
232 
233  acceptSMDqmDiscard_[fuDqmId]++;
234  if (acceptSMDqmDiscard_[fuDqmId] > 1)
235  LOG4CPLUS_WARN(
236  log_,
237  "DQM Cell " << fuDqmId
238  << " being sent more than once for folder "
239  << folderId << " process " << fuProcessId
240  << " guid " << fuGuid);
241  nbSentDqm_++;
242  sm_->sendDqmEvent(fuDqmId, runNumber, evtAtUpdate, folderId,
243  fuProcessId, fuGuid, data, dataSize);
244  }
245 }
log4cplus::Logger log_
Definition: IPCMethod.h:342
SMProxy * sm_
Definition: IPCMethod.h:340
UInt_t nbSentDqm_
Definition: IPCMethod.h:364
UInt_t 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: SMProxy.cc:153
int * acceptSMDqmDiscard_
Definition: IPCMethod.h:353
std::atomic< int > nbPendingSMDqmDiscards_
Definition: IPCMethod.h:366
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual bool evf::IPCMethod::sendDqmWhileHalting ( )
pure virtual

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

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

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().

188  {
189  if (0 == sm_) {
190  LOG4CPLUS_ERROR(log_, "No StorageManager, DROP ERROR EVENT!");
191  } else {
192  acceptSMDataDiscard_[fuResourceId] = true;
193  UInt_t nbBytes = sm_->sendErrorEvent(fuResourceId, runNumber,
194  evtNumber, fuProcessId, fuGuid, data, dataSize);
195  sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
196  sumOfSizes_ += nbBytes;
197  }
198 
199  // if (0!=shmBuffer_) {
200  // UInt_t n=nbDqmCells_;
201 
202  // for (UInt_t i=0;i<n;i++) {
203  // if(shmBuffer_->dqmCell(i)->fuProcessId()==fuProcessId)
204  // {
205  // if(shmBuffer_->dqmState(i)!=dqm::SENT){
206  // shmBuffer_->setDqmState(i,dqm::SENT);
207  // shmBuffer_->discardDqmCell(i);
208  // acceptSMDqmDiscard_[i] = false;
209  // }
210  // }
211  // }
212  // n=nbRecoCells_;
213  // for (UInt_t i=0;i<n;i++) {
214  // if(shmBuffer_->recoCell(i)->fuProcessId()==fuProcessId)
215  // {
216  // shmBuffer_->discardOrphanedRecoCell(i);
217  // }
218  // }
219 
220  // }
221 }
bool * acceptSMDataDiscard_
Definition: IPCMethod.h:352
uint64_t sumOfSquares_
Definition: IPCMethod.h:381
log4cplus::Logger log_
Definition: IPCMethod.h:342
SMProxy * sm_
Definition: IPCMethod.h:340
UInt_t sendErrorEvent(UInt_t fuResourceId, UInt_t runNumber, UInt_t evtNumber, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize)
Definition: SMProxy.cc:122
unsigned int UInt_t
Definition: FUTypes.h:12
unsigned long long uint64_t
Definition: Time.h:15
UInt_t sumOfSizes_
Definition: IPCMethod.h:382
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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().

158  {
159  if (0 == sm_) {
160  LOG4CPLUS_ERROR(log_, "No StorageManager, DROP INIT MESSAGE!");
161  } else {
162  acceptSMDataDiscard_[fuResourceId] = true;
163  UInt_t nbBytes = sm_->sendInitMessage(fuResourceId, outModId,
164  fuProcessId, fuGuid, data, dataSize, nExpectedEPs);
165  sumOfSquares_ += (uint64_t) nbBytes * (uint64_t) nbBytes;
166  sumOfSizes_ += nbBytes;
167  }
168 }
bool * acceptSMDataDiscard_
Definition: IPCMethod.h:352
uint64_t sumOfSquares_
Definition: IPCMethod.h:381
log4cplus::Logger log_
Definition: IPCMethod.h:342
SMProxy * sm_
Definition: IPCMethod.h:340
unsigned int UInt_t
Definition: FUTypes.h:12
unsigned long long uint64_t
Definition: Time.h:15
UInt_t sumOfSizes_
Definition: IPCMethod.h:382
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
UInt_t sendInitMessage(UInt_t fuResourceId, UInt_t outModId, UInt_t fuProcessId, UInt_t fuGuid, UChar_t *data, UInt_t dataSize, UInt_t nExpectedEPs)
Definition: SMProxy.cc:62
void evf::IPCMethod::setActive ( bool  activeValue)
inline

Definition at line 179 of file IPCMethod.h.

References isActive_.

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

179  {
180  isActive_ = activeValue;
181  }
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().

161  {
162  doCrcCheck_ = doCrcCheck;
163  }
UInt_t doCrcCheck_
Definition: IPCMethod.h:355
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().

168  {
169  doDumpEvents_ = doDumpEvents;
170  }
UInt_t doDumpEvents_
Definition: IPCMethod.h:356
void evf::IPCMethod::setReadyToShutDown ( bool  readyValue)
inline

Definition at line 190 of file IPCMethod.h.

References isReadyToShutDown_.

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

190  {
191  isReadyToShutDown_ = readyValue;
192  }
bool isReadyToShutDown_
Definition: IPCMethod.h:374
void evf::IPCMethod::setRunNumber ( UInt_t  runNumber)
inline

Definition at line 61 of file IPCMethod.h.

References convertSQLiteXML::runNumber, and runNumber_.

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

61  {
63  }
UInt_t runNumber_
Definition: IPCMethod.h:384
void evf::IPCMethod::setStopFlag ( bool  status)
inline

Definition at line 198 of file IPCMethod.h.

References ntuplemaker::status, and stopFlag_.

198  {
200  }
tuple status
Definition: ntuplemaker.py:245
virtual void evf::IPCMethod::shutDownClients ( )
pure virtual

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

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

UInt_t evf::IPCMethod::shutdownStatus ( )
inline

Definition at line 194 of file IPCMethod.h.

References shutdownStatus_.

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

194  {
195  return shutdownStatus_;
196  }
UInt_t shutdownStatus_
Definition: IPCMethod.h:395
UInt_t evf::IPCMethod::sumOfSizes ( ) const
inline

Definition at line 259 of file IPCMethod.h.

References sumOfSizes_.

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

259  {
260  return sumOfSizes_;
261  }
UInt_t sumOfSizes_
Definition: IPCMethod.h:382
uint64_t evf::IPCMethod::sumOfSquares ( ) const
inline

Definition at line 256 of file IPCMethod.h.

References sumOfSquares_.

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

256  {
257  return sumOfSquares_;
258  }
uint64_t sumOfSquares_
Definition: IPCMethod.h:381
void evf::IPCMethod::unlock ( void  )
inline

Member Data Documentation

bool* evf::IPCMethod::acceptSMDataDiscard_
protected

Definition at line 352 of file IPCMethod.h.

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

int* evf::IPCMethod::acceptSMDqmDiscard_
protected

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.

BUProxy* evf::IPCMethod::bu_
protected

Definition at line 339 of file IPCMethod.h.

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

UInt_t evf::IPCMethod::doCrcCheck_
protected

Definition at line 355 of file IPCMethod.h.

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

UInt_t evf::IPCMethod::doDumpEvents_
protected

Definition at line 356 of file IPCMethod.h.

Referenced by setDoDumpEvents().

EvffedFillerRB* evf::IPCMethod::frb_
protected

Definition at line 390 of file IPCMethod.h.

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

std::queue<UInt_t> evf::IPCMethod::freeResourceIds_
protected
unsigned int evf::IPCMethod::freeResRequiredForAllocate_
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().

bool evf::IPCMethod::isReadyToShutDown_
protected
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
UInt_t evf::IPCMethod::nbAllocated_
protected
UInt_t evf::IPCMethod::nbAllocSent_
protected

Definition at line 379 of file IPCMethod.h.

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

UInt_t evf::IPCMethod::nbClientsToShutDown_
protected

Definition at line 373 of file IPCMethod.h.

UInt_t evf::IPCMethod::nbCompleted_
protected
UInt_t evf::IPCMethod::nbCrcErrors_
protected
UInt_t evf::IPCMethod::nbDiscarded_
protected
UInt_t evf::IPCMethod::nbDqmCells_
protected

Definition at line 344 of file IPCMethod.h.

UInt_t evf::IPCMethod::nbEolDiscarded_
protected

Definition at line 371 of file IPCMethod.h.

Referenced by nbEolDiscarded().

UInt_t evf::IPCMethod::nbEolPosted_
protected

Definition at line 370 of file IPCMethod.h.

Referenced by nbEolPosted().

UInt_t evf::IPCMethod::nbErrors_
protected
UInt_t evf::IPCMethod::nbLost_
protected
UInt_t evf::IPCMethod::nbPending_
protected
UInt_t evf::IPCMethod::nbPendingSMDiscards_
protected
std::atomic<int> evf::IPCMethod::nbPendingSMDqmDiscards_
protected
UInt_t evf::IPCMethod::nbRawCells_
protected

Definition at line 345 of file IPCMethod.h.

Referenced by resetPendingAllocates().

UInt_t evf::IPCMethod::nbRecoCells_
protected

Definition at line 346 of file IPCMethod.h.

UInt_t evf::IPCMethod::nbSent_
protected
UInt_t evf::IPCMethod::nbSentDqm_
protected

Definition at line 364 of file IPCMethod.h.

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

UInt_t evf::IPCMethod::nbSentError_
protected
FUResourceVec_t evf::IPCMethod::resources_
protected
UInt_t evf::IPCMethod::runNumber_
protected
UInt_t evf::IPCMethod::shutdownStatus_
protected

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.

SMProxy* evf::IPCMethod::sm_
protected

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().

UInt_t evf::IPCMethod::sumOfSizes_
protected
uint64_t evf::IPCMethod::sumOfSquares_
protected