CMS 3D CMS Logo

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

#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

FUShmBufferbuffer_
 
double crashPrb_
 
int sleep_
 

Detailed Description

Definition at line 13 of file FUShmClient.h.

Constructor & Destructor Documentation

FUShmClient::FUShmClient ( FUShmBuffer buffer)

Definition at line 30 of file FUShmClient.cc.

31  : buffer_(buffer)
32  , crashPrb_(0.01)
33  , sleep_(0)
34 {
35 
36 }
FUShmBuffer * buffer_
Definition: FUShmClient.h:36
FUShmClient::~FUShmClient ( )

Definition at line 40 of file FUShmClient.cc.

41 {
42 
43 }

Member Function Documentation

double evf::FUShmClient::crashPrb ( ) const
inline

Definition at line 28 of file FUShmClient.h.

References crashPrb_.

Referenced by readNext().

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

52 {
54 
55  // read data
56  unsigned int iCell=cell->index();
57  unsigned int nFed =cell->nFed();
58  feds.resize(nFed);
59  for (unsigned int i=0;i<nFed;i++) {
60  unsigned int fedSize =cell->fedSize(i);
61  feds[i].resize(fedSize);
62  unsigned char *destAddr=(unsigned char*)&(feds[i][0]);
63  cell->readFed(i,destAddr);
64  }
66 
67  // sleep
68  if (sleep_>0.0) {
69  cout<<"PROCESSING cell "<<cell->index()<<" ... "<<flush;
70  sleep(sleep_);
71  cout<<"DONE"<<endl;
72  }
73 
74  //crash
75  if (get_rnd()<crashPrb()) {
76  cout<<"FUShmClient::readNext(): CRASH! cell->index()="<<cell->index()<<endl;
77  exit(1);
78  }
79 
81  cell=buffer_->rawCellToDiscard();
82  buffer_->discardRawCell(cell);
83 
84  return iCell;
85 }
FUShmRawCell * rawCellToRead()
Definition: FUShmBuffer.cc:317
FUShmRawCell * rawCellToDiscard()
Definition: FUShmBuffer.cc:373
int i
Definition: DBlmapReader.cc:9
double crashPrb() const
Definition: FUShmClient.h:28
void sleep(Duration_t)
Definition: Utils.h:163
void discardRawCell(FUShmRawCell *cell)
Definition: FUShmBuffer.cc:495
unsigned int readFed(unsigned int i, unsigned char *buffer) const
double get_rnd()
Definition: FUShmClient.cc:89
unsigned int index() const
Definition: FUShmRawCell.h:25
unsigned int nFed() const
Definition: FUShmRawCell.h:33
tuple cout
Definition: gather_cfg.py:121
unsigned int fedSize(unsigned int i) const
Definition: FUShmRawCell.cc:82
void finishReadingRawCell(FUShmRawCell *cell)
Definition: FUShmBuffer.cc:410
FUShmBuffer * buffer_
Definition: FUShmClient.h:36
void scheduleRawCellForDiscard(unsigned int iCell)
Definition: FUShmBuffer.cc:454
void evf::FUShmClient::setCrashPrb ( double  prb)
inline

Definition at line 29 of file FUShmClient.h.

References crashPrb_.

Referenced by main().

29 { crashPrb_=prb; }
void evf::FUShmClient::setSleep ( int  sec)
inline

Definition at line 30 of file FUShmClient.h.

References sleep_.

Referenced by main().

30 { sleep_ = sec; }

Member Data Documentation

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