#include <FUShmClient.h>
Public Member Functions | |
double | crashPrb () const |
FUShmClient (FUShmBuffer *buffer) | |
unsigned int | readNext (std::vector< std::vector< unsigned char > > &feds) |
void | setCrashPrb (double prb) |
void | setSleep (int sec) |
~FUShmClient () | |
Private Attributes | |
FUShmBuffer * | buffer_ |
double | crashPrb_ |
int | sleep_ |
Definition at line 13 of file FUShmClient.h.
FUShmClient::FUShmClient | ( | FUShmBuffer * | buffer | ) |
Definition at line 30 of file FUShmClient.cc.
FUShmClient::~FUShmClient | ( | ) |
Definition at line 40 of file FUShmClient.cc.
{ }
double evf::FUShmClient::crashPrb | ( | ) | const [inline] |
Definition at line 28 of file FUShmClient.h.
References crashPrb_.
Referenced by readNext().
{ return crashPrb_; }
unsigned int FUShmClient::readNext | ( | std::vector< std::vector< unsigned char > > & | feds | ) |
Definition at line 51 of file FUShmClient.cc.
References buffer_, gather_cfg::cout, crashPrb(), evf::FUShmBuffer::discardRawCell(), cmsRelvalreport::exit, evf::FUShmRawCell::fedSize(), evf::FUShmBuffer::finishReadingRawCell(), get_rnd(), i, evf::FUShmRawCell::index(), evf::FUShmRawCell::nFed(), evf::FUShmBuffer::rawCellToDiscard(), evf::FUShmBuffer::rawCellToRead(), evf::FUShmRawCell::readFed(), evf::FUShmBuffer::scheduleRawCellForDiscard(), stor::utils::sleep(), and sleep_.
Referenced by main().
{ FUShmRawCell* cell=buffer_->rawCellToRead(); // read data unsigned int iCell=cell->index(); unsigned int nFed =cell->nFed(); feds.resize(nFed); for (unsigned int i=0;i<nFed;i++) { unsigned int fedSize =cell->fedSize(i); feds[i].resize(fedSize); unsigned char *destAddr=(unsigned char*)&(feds[i][0]); cell->readFed(i,destAddr); } buffer_->finishReadingRawCell(cell); // sleep if (sleep_>0.0) { cout<<"PROCESSING cell "<<cell->index()<<" ... "<<flush; sleep(sleep_); cout<<"DONE"<<endl; } //crash if (get_rnd()<crashPrb()) { cout<<"FUShmClient::readNext(): CRASH! cell->index()="<<cell->index()<<endl; exit(1); } buffer_->scheduleRawCellForDiscard(iCell); cell=buffer_->rawCellToDiscard(); buffer_->discardRawCell(cell); return iCell; }
void evf::FUShmClient::setCrashPrb | ( | double | prb | ) | [inline] |
Definition at line 29 of file FUShmClient.h.
References crashPrb_.
Referenced by main().
{ crashPrb_=prb; }
void evf::FUShmClient::setSleep | ( | int | sec | ) | [inline] |
Definition at line 30 of file FUShmClient.h.
References sleep_.
Referenced by main().
{ sleep_ = sec; }
FUShmBuffer* evf::FUShmClient::buffer_ [private] |
Definition at line 36 of file FUShmClient.h.
Referenced by readNext().
double evf::FUShmClient::crashPrb_ [private] |
Definition at line 37 of file FUShmClient.h.
Referenced by crashPrb(), and setCrashPrb().
int evf::FUShmClient::sleep_ [private] |
Definition at line 38 of file FUShmClient.h.
Referenced by readNext(), and setSleep().