CMS 3D CMS Logo

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

#include <FUShmBuffer.h>

Public Member Functions

pid_t clientPrcId (unsigned int index)
 
void discardDqmCell (unsigned int iCell)
 
void discardOrphanedRecoCell (unsigned int iCell)
 
void discardRawCell (FUShmRawCell *cell)
 
void discardRecoCell (unsigned int iCell)
 
FUShmDqmCelldqmCell (unsigned int iCell)
 
FUShmDqmCelldqmCellToRead ()
 
dqm::State_t dqmState (unsigned int index)
 
unsigned int evtNumber (unsigned int index)
 
pid_t evtPrcId (unsigned int index)
 
evt::State_t evtState (unsigned int index)
 
time_t evtTimeStamp (unsigned int index)
 
void finishReadingDqmCell (FUShmDqmCell *cell)
 
void finishReadingRawCell (FUShmRawCell *cell)
 
void finishReadingRecoCell (FUShmRecoCell *cell)
 
void finishWritingRawCell (FUShmRawCell *cell)
 
int incEvtDiscard (unsigned int index, bool lockShm=true)
 
void initialize (unsigned int shmid, unsigned int semid)
 
void lock ()
 
int nbRawCellsToRead () const
 
unsigned int nbRawCellsToWrite () const
 
unsigned int nClients () const
 
unsigned int nDqmCells () const
 
unsigned int nRawCells () const
 
unsigned int nRecoCells () const
 
void printDqmState (unsigned int index)
 
void printEvtState (unsigned int index)
 
FUShmRawCellrawCell (unsigned int iCell)
 
FUShmRawCellrawCellToDiscard ()
 
FUShmRawCellrawCellToRead ()
 
FUShmRawCellrawCellToWrite ()
 
FUShmRecoCellrecoCell (unsigned int iCell)
 
FUShmRecoCellrecoCellToRead ()
 
void releaseRawCell (FUShmRawCell *cell)
 
bool removeClientPrcId (pid_t prcId)
 
void reset (bool)
 
void scheduleRawCellForDiscard (unsigned int iCell)
 
void scheduleRawCellForDiscardServerSide (unsigned int iCell)
 
void scheduleRawEmptyCellForDiscard ()
 
bool scheduleRawEmptyCellForDiscard (FUShmRawCell *cell, bool &pidstatus)
 
void scheduleRawEmptyCellForDiscardServerSide (FUShmRawCell *cell)
 
void sem_print ()
 
std::string sem_print_s ()
 
int semid () const
 
bool setDqmState (unsigned int index, dqm::State_t state)
 
bool setEvtDiscard (unsigned int index, unsigned int discard, bool checkValue=false, bool lockShm=true)
 
bool setEvtPrcId (unsigned int index, pid_t prcId)
 
bool setEvtState (unsigned int index, evt::State_t state, bool lockShm=true)
 
int shmid () const
 
void unlock ()
 
void writeDqmEmptyEvent ()
 
bool writeDqmEventData (unsigned int runNumber, unsigned int evtAtUpdate, unsigned int folderId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
 
bool writeErrorEventData (unsigned int runNumber, unsigned int fuProcessId, unsigned int iRawCell, bool checkValue)
 
void writeRawEmptyEvent ()
 
void writeRawLumiSectionEvent (unsigned int)
 
void writeRecoEmptyEvent ()
 
bool writeRecoEventData (unsigned int runNumber, unsigned int evtNumber, unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
 
bool writeRecoInitMsg (unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize, unsigned int nExpectedEPs)
 
 ~FUShmBuffer ()
 

Static Public Member Functions

static FUShmBuffercreateShmBuffer (bool semgmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize=0x400000, unsigned int recoCellSize=0x400000, unsigned int dqmCellSize=0x400000)
 
static key_t getSemKey ()
 
static FUShmBuffergetShmBuffer ()
 
static key_t getShmDescriptorKey ()
 
static key_t getShmKey ()
 
static bool releaseSharedMemory ()
 
static int sem_create (key_t key, int nsem)
 
static int sem_destroy (int semid)
 
static int sem_get (key_t key, int nsem)
 
static void * shm_attach (int shmid)
 
static int shm_create (key_t key, int size)
 
static int shm_destroy (int shmid)
 
static int shm_get (key_t key, int size)
 
static int shm_nattch (int shmid)
 
static unsigned int size (bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
 

Private Member Functions

key_t dqmCellShmKey (unsigned int iCell)
 
 FUShmBuffer (bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
 
unsigned int indexForEvtNumber (unsigned int evtNumber)
 
unsigned int indexForEvtPrcId (pid_t evtNumber)
 
unsigned int nextDqmReadIndex ()
 
unsigned int nextDqmWriteIndex ()
 
unsigned int nextIndex (unsigned int offset, unsigned int nCells, unsigned int &iNext)
 
unsigned int nextRawReadIndex ()
 
unsigned int nextRawWriteIndex ()
 
unsigned int nextRecoReadIndex ()
 
unsigned int nextRecoWriteIndex ()
 
void postDqmIndexToRead (unsigned int index)
 
void postDqmIndexToWrite (unsigned int index)
 
void postDqmRead ()
 
void postDqmWrite ()
 
void postIndex (unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
 
void postRawDiscard ()
 
void postRawDiscarded ()
 
void postRawIndexToRead (unsigned int index)
 
void postRawIndexToWrite (unsigned int index)
 
void postRawRead ()
 
void postRawWrite ()
 
void postRecoIndexToRead (unsigned int index)
 
void postRecoIndexToWrite (unsigned int index)
 
void postRecoRead ()
 
void postRecoWrite ()
 
bool rawCellReadyForDiscard (unsigned int index)
 
key_t rawCellShmKey (unsigned int iCell)
 
key_t recoCellShmKey (unsigned int iCell)
 
void sem_init (int isem, int value)
 
void sem_post (int isem)
 
int sem_wait (int isem)
 
bool setClientPrcId (pid_t prcId)
 
bool setEvtNumber (unsigned int index, unsigned int evtNumber)
 
bool setEvtTimeStamp (unsigned int index, time_t timeStamp)
 
key_t shmKey (unsigned int iCell, unsigned int offset)
 
void waitDqmRead ()
 
void waitDqmWrite ()
 
void waitRawDiscard ()
 
void waitRawDiscarded ()
 
void waitRawRead ()
 
int waitRawWrite ()
 
void waitRecoRead ()
 
void waitRecoWrite ()
 

Private Attributes

unsigned int clientPrcIdOffset_
 
unsigned int dqmCellOffset_
 
unsigned int dqmCellPayloadSize_
 
unsigned int dqmCellTotalSize_
 
unsigned int dqmReadIndex_
 
unsigned int dqmReadLast_
 
unsigned int dqmReadNext_
 
unsigned int dqmReadOffset_
 
unsigned int dqmStateOffset_
 
unsigned int dqmWriteIndex_
 
unsigned int dqmWriteLast_
 
unsigned int dqmWriteNext_
 
unsigned int dqmWriteOffset_
 
unsigned int evtDiscardOffset_
 
unsigned int evtNumberOffset_
 
unsigned int evtPrcIdOffset_
 
unsigned int evtStateOffset_
 
unsigned int evtTimeStampOffset_
 
unsigned int nClients_
 
unsigned int nClientsMax_
 
unsigned int nDqmCells_
 
unsigned int nRawCells_
 
unsigned int nRecoCells_
 
unsigned int rawCellOffset_
 
unsigned int rawCellPayloadSize_
 
unsigned int rawCellTotalSize_
 
unsigned int rawDiscardIndex_
 
unsigned int rawReadLast_
 
unsigned int rawReadNext_
 
unsigned int rawReadOffset_
 
unsigned int rawWriteLast_
 
unsigned int rawWriteNext_
 
unsigned int rawWriteOffset_
 
unsigned int recoCellOffset_
 
unsigned int recoCellPayloadSize_
 
unsigned int recoCellTotalSize_
 
unsigned int recoReadIndex_
 
unsigned int recoReadLast_
 
unsigned int recoReadNext_
 
unsigned int recoReadOffset_
 
unsigned int recoWriteIndex_
 
unsigned int recoWriteLast_
 
unsigned int recoWriteNext_
 
unsigned int recoWriteOffset_
 
bool segmentationMode_
 
int semid_
 
int shmid_
 

Static Private Attributes

static const char * semKeyPath_
 
static const char * shmKeyPath_
 

Detailed Description

Definition at line 41 of file FUShmBuffer.h.

Constructor & Destructor Documentation

FUShmBuffer::FUShmBuffer ( bool  segmentationMode,
unsigned int  nRawCells,
unsigned int  nRecoCells,
unsigned int  nDqmCells,
unsigned int  rawCellSize,
unsigned int  recoCellSize,
unsigned int  dqmCellSize 
)
private

Definition at line 53 of file FUShmBuffer.cc.

References clientPrcIdOffset_, dqmCellOffset_, dqmCellPayloadSize_, dqmCellTotalSize_, dqmReadOffset_, dqmStateOffset_, dqmWriteOffset_, evtDiscardOffset_, evtNumberOffset_, evtPrcIdOffset_, evtStateOffset_, evtTimeStampOffset_, i, nClientsMax_, nDqmCells_, nRawCells_, nRecoCells_, rawCellOffset_, rawCellPayloadSize_, rawCellTotalSize_, rawReadOffset_, rawWriteOffset_, recoCellOffset_, recoCellPayloadSize_, recoCellTotalSize_, recoReadOffset_, recoWriteOffset_, segmentationMode_, evf::FUShmDqmCell::size(), evf::FUShmRecoCell::size(), and evf::FUShmRawCell::size().

Referenced by createShmBuffer(), getShmBuffer(), releaseSharedMemory(), and size().

56  :
57  segmentationMode_(segmentationMode), nClientsMax_(128),
64 
65  void* addr;
66 
67  rawWriteOffset_ = sizeof(FUShmBuffer);
68  addr = (void*) ((unsigned long) this + rawWriteOffset_);
69  new (addr) unsigned int[nRawCells_];
70 
71  rawReadOffset_ = rawWriteOffset_ + nRawCells_ * sizeof(unsigned int);
72  addr = (void*) ((unsigned long) this + rawReadOffset_);
73  new (addr) unsigned int[nRawCells_];
74 
75  recoWriteOffset_ = rawReadOffset_ + nRawCells_ * sizeof(unsigned int);
76  addr = (void*) ((unsigned long) this + recoWriteOffset_);
77  new (addr) unsigned int[nRecoCells_];
78 
79  recoReadOffset_ = recoWriteOffset_ + nRecoCells_ * sizeof(unsigned int);
80  addr = (void*) ((unsigned long) this + recoReadOffset_);
81  new (addr) unsigned int[nRecoCells_];
82 
83  dqmWriteOffset_ = recoReadOffset_ + nRecoCells_ * sizeof(unsigned int);
84  addr = (void*) ((unsigned long) this + dqmWriteOffset_);
85  new (addr) unsigned int[nDqmCells_];
86 
87  dqmReadOffset_ = dqmWriteOffset_ + nDqmCells_ * sizeof(unsigned int);
88  addr = (void*) ((unsigned long) this + dqmReadOffset_);
89  new (addr) unsigned int[nDqmCells_];
90 
91  evtStateOffset_ = dqmReadOffset_ + nDqmCells_ * sizeof(unsigned int);
92  addr = (void*) ((unsigned long) this + evtStateOffset_);
93  new (addr) evt::State_t[nRawCells_];
94 
96  addr = (void*) ((unsigned long) this + evtDiscardOffset_);
97  new (addr) unsigned int[nRawCells_];
98 
99  evtNumberOffset_ = evtDiscardOffset_ + nRawCells_ * sizeof(unsigned int);
100  addr = (void*) ((unsigned long) this + evtNumberOffset_);
101  new (addr) unsigned int[nRawCells_];
102 
103  evtPrcIdOffset_ = evtNumberOffset_ + nRawCells_ * sizeof(unsigned int);
104  addr = (void*) ((unsigned long) this + evtPrcIdOffset_);
105  new (addr) pid_t[nRawCells_];
106 
107  evtTimeStampOffset_ = evtPrcIdOffset_ + nRawCells_ * sizeof(pid_t);
108  addr = (void*) ((unsigned long) this + evtTimeStampOffset_);
109  new (addr) time_t[nRawCells_];
110 
111  dqmStateOffset_ = evtTimeStampOffset_ + nRawCells_ * sizeof(time_t);
112  addr = (void*) ((unsigned long) this + dqmStateOffset_);
113  new (addr) dqm::State_t[nDqmCells_];
114 
116  addr = (void*) ((unsigned long) this + clientPrcIdOffset_);
117  new (addr) pid_t[nClientsMax_];
118 
119  rawCellOffset_ = clientPrcIdOffset_ + nClientsMax_ * sizeof(pid_t);
120 
121  if (segmentationMode_) {
122  recoCellOffset_ = rawCellOffset_ + nRawCells_ * sizeof(key_t);
123  dqmCellOffset_ = recoCellOffset_ + nRecoCells_ * sizeof(key_t);
124  addr = (void*) ((unsigned long) this + rawCellOffset_);
125  new (addr) key_t[nRawCells_];
126  addr = (void*) ((unsigned long) this + recoCellOffset_);
127  new (addr) key_t[nRecoCells_];
128  addr = (void*) ((unsigned long) this + dqmCellOffset_);
129  new (addr) key_t[nDqmCells_];
130  } else {
132  dqmCellOffset_ = recoCellOffset_ + nRecoCells_ * recoCellTotalSize_;
133  for (unsigned int i = 0; i < nRawCells_; i++) {
134  addr = (void*) ((unsigned long) this + rawCellOffset_ + i
136  new (addr) FUShmRawCell(rawCellSize);
137  }
138  for (unsigned int i = 0; i < nRecoCells_; i++) {
139  addr = (void*) ((unsigned long) this + recoCellOffset_ + i
141  new (addr) FUShmRecoCell(recoCellSize);
142  }
143  for (unsigned int i = 0; i < nDqmCells_; i++) {
144  addr = (void*) ((unsigned long) this + dqmCellOffset_ + i
146  new (addr) FUShmDqmCell(dqmCellSize);
147  }
148  }
149 }
unsigned int clientPrcIdOffset_
Definition: FUShmBuffer.h:309
int i
Definition: DBlmapReader.cc:9
unsigned int nRecoCells() const
Definition: FUShmBuffer.h:66
unsigned int rawReadOffset_
Definition: FUShmBuffer.h:283
static unsigned int size(unsigned int payloadSize)
unsigned int recoCellPayloadSize_
Definition: FUShmBuffer.h:319
unsigned int dqmReadOffset_
Definition: FUShmBuffer.h:298
unsigned int evtDiscardOffset_
Definition: FUShmBuffer.h:301
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int dqmStateOffset_
Definition: FUShmBuffer.h:305
unsigned int dqmWriteOffset_
Definition: FUShmBuffer.h:295
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtNumberOffset_
Definition: FUShmBuffer.h:302
unsigned int dqmCellOffset_
Definition: FUShmBuffer.h:328
unsigned int evtStateOffset_
Definition: FUShmBuffer.h:300
static unsigned int size(unsigned int payloadSize)
unsigned int recoReadOffset_
Definition: FUShmBuffer.h:291
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int nRawCells() const
Definition: FUShmBuffer.h:65
unsigned int dqmCellPayloadSize_
Definition: FUShmBuffer.h:326
unsigned int rawCellPayloadSize_
Definition: FUShmBuffer.h:312
unsigned int rawWriteOffset_
Definition: FUShmBuffer.h:280
unsigned int dqmCellTotalSize_
Definition: FUShmBuffer.h:327
unsigned int recoCellTotalSize_
Definition: FUShmBuffer.h:320
unsigned int nClientsMax_
Definition: FUShmBuffer.h:308
unsigned int rawCellTotalSize_
Definition: FUShmBuffer.h:313
FUShmBuffer(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
Definition: FUShmBuffer.cc:53
unsigned int nDqmCells() const
Definition: FUShmBuffer.h:67
unsigned int evtPrcIdOffset_
Definition: FUShmBuffer.h:303
unsigned int recoWriteOffset_
Definition: FUShmBuffer.h:288
static unsigned int size(unsigned int payloadSize)
Definition: FUShmDqmCell.cc:97
unsigned int rawCellOffset_
Definition: FUShmBuffer.h:314
unsigned int recoCellOffset_
Definition: FUShmBuffer.h:321
unsigned int evtTimeStampOffset_
Definition: FUShmBuffer.h:304
FUShmBuffer::~FUShmBuffer ( )

Definition at line 152 of file FUShmBuffer.cc.

152  {
153 
154 }

Member Function Documentation

pid_t FUShmBuffer::clientPrcId ( unsigned int  index)

Definition at line 1444 of file FUShmBuffer.cc.

References clientPrcIdOffset_, getHLTprescales::index, and nClientsMax_.

1444  {
1445  if (!(index < nClientsMax_)) {
1446  stringstream details;
1447  details << "index<nClientsMax_ assertion failed! Actual index is " << index;
1448  XCEPT_ASSERT(false, evf::Exception, details.str());
1449  }
1450  pid_t *prcid = (pid_t*) ((unsigned long) this + clientPrcIdOffset_);
1451  prcid += index;
1452  return *prcid;
1453 }
unsigned int clientPrcIdOffset_
Definition: FUShmBuffer.h:309
unsigned int nClientsMax_
Definition: FUShmBuffer.h:308
FUShmBuffer * FUShmBuffer::createShmBuffer ( bool  semgmentationMode,
unsigned int  nRawCells,
unsigned int  nRecoCells,
unsigned int  nDqmCells,
unsigned int  rawCellSize = 0x400000,
unsigned int  recoCellSize = 0x400000,
unsigned int  dqmCellSize = 0x400000 
)
static

Definition at line 917 of file FUShmBuffer.cc.

References gather_cfg::cout, FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), initialize(), nDqmCells(), nRawCells(), nRecoCells(), AlCaHLTBitMon_ParallelJobs::p, releaseSharedMemory(), sem_create(), semid(), shm_attach(), shm_create(), shm_nattch(), shmid(), and size().

Referenced by evf::FUResourceTable::initialize().

920  {
921  // if necessary, release shared memory first!
923  cout << "FUShmBuffer::createShmBuffer: "
924  << "REMOVAL OF OLD SHARED MEM SEGMENTS SUCCESSFULL." << endl;
925 
926  // create bookkeeping shared memory segment
927  int size = sizeof(unsigned int) * 7;
929  if (shmid < 0)
930  return 0;
931  void*shmAddr = shm_attach(shmid);
932  if (0 == shmAddr)
933  return 0;
934 
935  if (1 != shm_nattch(shmid)) {
936  cout << "FUShmBuffer::createShmBuffer() FAILED: nattch=" << shm_nattch(
937  shmid) << endl;
938  shmdt(shmAddr);
939  return 0;
940  }
941 
942  unsigned int* p = (unsigned int*) shmAddr;
943  *p++ = segmentationMode;
944  *p++ = nRawCells;
945  *p++ = nRecoCells;
946  *p++ = nDqmCells;
947  *p++ = rawCellSize;
948  *p++ = recoCellSize;
949  *p++ = dqmCellSize;
950  shmdt(shmAddr);
951 
952  // create the 'real' shared memory buffer
953  size = FUShmBuffer::size(segmentationMode, nRawCells, nRecoCells,
954  nDqmCells, rawCellSize, recoCellSize, dqmCellSize);
955  shmid = shm_create(FUShmBuffer::getShmKey(), size);
956  if (shmid < 0)
957  return 0;
959  if (semid < 0)
960  return 0;
961  shmAddr = shm_attach(shmid);
962  if (0 == shmAddr)
963  return 0;
964 
965  if (1 != shm_nattch(shmid)) {
966  cout << "FUShmBuffer::createShmBuffer FAILED: nattch=" << shm_nattch(
967  shmid) << endl;
968  shmdt(shmAddr);
969  return 0;
970  }
971  FUShmBuffer* buffer = new (shmAddr) FUShmBuffer(segmentationMode,
972  nRawCells, nRecoCells, nDqmCells, rawCellSize, recoCellSize,
973  dqmCellSize);
974 
975  cout << "FUShmBuffer::createShmBuffer(): CREATED shared memory buffer."
976  << endl;
977  cout << " segmentationMode="
978  << segmentationMode << endl;
979 
980  buffer->initialize(shmid, semid);
981 
982  return buffer;
983 }
unsigned int nRecoCells() const
Definition: FUShmBuffer.h:66
static int shm_nattch(int shmid)
static void * shm_attach(int shmid)
int shmid() const
Definition: FUShmBuffer.h:69
static key_t getShmDescriptorKey()
static bool releaseSharedMemory()
static int sem_create(key_t key, int nsem)
static unsigned int size(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
void initialize(unsigned int shmid, unsigned int semid)
Definition: FUShmBuffer.cc:162
unsigned int nRawCells() const
Definition: FUShmBuffer.h:65
static key_t getShmKey()
static key_t getSemKey()
FUShmBuffer(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
Definition: FUShmBuffer.cc:53
tuple cout
Definition: gather_cfg.py:121
static int shm_create(key_t key, int size)
unsigned int nDqmCells() const
Definition: FUShmBuffer.h:67
int semid() const
Definition: FUShmBuffer.h:70
void FUShmBuffer::discardDqmCell ( unsigned int  iCell)

Definition at line 527 of file FUShmBuffer.cc.

References evf::FUShmDqmCell::clear(), evf::dqm::DISCARDING, dqmCell(), dqmState(), evf::dqm::EMPTY, postDqmIndexToWrite(), postDqmWrite(), segmentationMode_, evf::dqm::SENT, setDqmState(), and evf::utils::state.

527  {
528  dqm::State_t state = dqmState(iCell);
529  if(!(state == dqm::EMPTY || state == dqm::SENT)) {
530  stringstream details;
531  details << "state==dqm::EMPTY||state==dqm::SENT assertion failed! Actual state is "
532  << state << ", iCell = " << iCell;
533  XCEPT_ASSERT(false, evf::Exception,details.str());
534  }
536  FUShmDqmCell* cell = dqmCell(iCell);
537  cell->clear();
538  if (segmentationMode_)
539  shmdt(cell);
540  setDqmState(iCell, dqm::EMPTY);
541  postDqmIndexToWrite(iCell);
542  postDqmWrite();
543 }
void postDqmIndexToWrite(unsigned int index)
dqm::State_t dqmState(unsigned int index)
char state
Definition: procUtils.cc:75
bool setDqmState(unsigned int index, dqm::State_t state)
FUShmDqmCell * dqmCell(unsigned int iCell)
void FUShmBuffer::discardOrphanedRecoCell ( unsigned int  iCell)

Definition at line 517 of file FUShmBuffer.cc.

References evf::FUShmRecoCell::clear(), postRecoIndexToWrite(), postRecoWrite(), recoCell(), and segmentationMode_.

517  {
518  FUShmRecoCell* cell = recoCell(iCell);
519  cell->clear();
520  if (segmentationMode_)
521  shmdt(cell);
522  postRecoIndexToWrite(iCell);
523  postRecoWrite();
524 }
FUShmRecoCell * recoCell(unsigned int iCell)
void postRecoWrite()
Definition: FUShmBuffer.h:261
void postRecoIndexToWrite(unsigned int index)
void FUShmBuffer::discardRawCell ( FUShmRawCell cell)

Definition at line 495 of file FUShmBuffer.cc.

References postRawDiscard(), and releaseRawCell().

Referenced by evf::FUShmClient::readNext().

495  {
496  releaseRawCell(cell);
497  postRawDiscard();
498 }
void releaseRawCell(FUShmRawCell *cell)
Definition: FUShmBuffer.cc:546
void postRawDiscard()
Definition: FUShmBuffer.h:257
void FUShmBuffer::discardRecoCell ( unsigned int  iCell)

Definition at line 501 of file FUShmBuffer.cc.

References evf::FUShmRecoCell::clear(), nRawCells_, postRecoIndexToWrite(), postRecoWrite(), evf::FUShmRecoCell::rawCellIndex(), recoCell(), scheduleRawCellForDiscard(), and segmentationMode_.

501  {
502  FUShmRecoCell* cell = recoCell(iCell);
503  unsigned int iRawCell = cell->rawCellIndex();
504  if (iRawCell < nRawCells_) {
505  //evt::State_t state=evtState(iRawCell);
506  //XCEPT_ASSERT(state==evt::SENT, evf::Exception, "state==evt::SENT assertion failed!");
507  scheduleRawCellForDiscard(iRawCell);
508  }
509  cell->clear();
510  if (segmentationMode_)
511  shmdt(cell);
512  postRecoIndexToWrite(iCell);
513  postRecoWrite();
514 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawCellIndex() const
Definition: FUShmRecoCell.h:23
FUShmRecoCell * recoCell(unsigned int iCell)
void postRecoWrite()
Definition: FUShmBuffer.h:261
void postRecoIndexToWrite(unsigned int index)
void scheduleRawCellForDiscard(unsigned int iCell)
Definition: FUShmBuffer.cc:454
FUShmDqmCell * FUShmBuffer::dqmCell ( unsigned int  iCell)

Definition at line 1678 of file FUShmBuffer.cc.

References gather_cfg::cout, dqmCellOffset_, dqmCellPayloadSize_, dqmCellShmKey(), dqmCellTotalSize_, nDqmCells_, query::result, segmentationMode_, shm_attach(), shm_get(), and shmid().

Referenced by discardDqmCell(), dqmCellToRead(), reset(), writeDqmEmptyEvent(), and writeDqmEventData().

1678  {
1679  FUShmDqmCell* result(0);
1680 
1681  if (iCell >= nDqmCells_) {
1682  cout << "FUShmBuffer::dqmCell(" << iCell << ") ERROR: " << "iCell="
1683  << iCell << " >= nDqmCells=" << nDqmCells_ << endl;
1684  return result;
1685  }
1686 
1687  if (segmentationMode_) {
1688  key_t shmkey = dqmCellShmKey(iCell);
1689  int shmid = shm_get(shmkey, dqmCellTotalSize_);
1690  void* cellAddr = shm_attach(shmid);
1691  result = new (cellAddr) FUShmDqmCell(dqmCellPayloadSize_);
1692  } else {
1693  result = (FUShmDqmCell*) ((unsigned long) this + dqmCellOffset_ + iCell
1694  * dqmCellTotalSize_);
1695  }
1696 
1697  return result;
1698 }
static void * shm_attach(int shmid)
int shmid() const
Definition: FUShmBuffer.h:69
static int shm_get(key_t key, int size)
unsigned int dqmCellOffset_
Definition: FUShmBuffer.h:328
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
tuple result
Definition: query.py:137
unsigned int dqmCellPayloadSize_
Definition: FUShmBuffer.h:326
key_t dqmCellShmKey(unsigned int iCell)
unsigned int dqmCellTotalSize_
Definition: FUShmBuffer.h:327
tuple cout
Definition: gather_cfg.py:121
key_t FUShmBuffer::dqmCellShmKey ( unsigned int  iCell)
private

Definition at line 1758 of file FUShmBuffer.cc.

References gather_cfg::cout, dqmCellOffset_, nDqmCells_, and shmKey().

Referenced by dqmCell(), and releaseSharedMemory().

1758  {
1759  if (iCell >= nDqmCells_) {
1760  cout << "FUShmBuffer::dqmCellShmKey() ERROR: " << "iCell>=nDqmCells: "
1761  << iCell << ">=" << nDqmCells_ << endl;
1762  return -1;
1763  }
1764  return shmKey(iCell, dqmCellOffset_);
1765 }
unsigned int dqmCellOffset_
Definition: FUShmBuffer.h:328
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
tuple cout
Definition: gather_cfg.py:121
key_t shmKey(unsigned int iCell, unsigned int offset)
FUShmDqmCell * FUShmBuffer::dqmCellToRead ( )

Definition at line 354 of file FUShmBuffer.cc.

References dqmCell(), dqmState(), evf::dqm::EMPTY, nextDqmReadIndex(), evf::dqm::SENDING, setDqmState(), evf::utils::state, waitDqmRead(), and evf::dqm::WRITTEN.

354  {
355  waitDqmRead();
356  unsigned int iCell = nextDqmReadIndex();
357  FUShmDqmCell* cell = dqmCell(iCell);
358  dqm::State_t state = dqmState(iCell);
359 
360  if(!(state == dqm::WRITTEN || state == dqm::EMPTY)) {
361  stringstream details;
362  details << "state==dqm::WRITTEN || state==dqm::EMPTY assertion failed! Actual state is "
363  << state << ", iCell = " << iCell;
364  XCEPT_ASSERT(false, evf::Exception, details.str());
365  }
366 
367  if (state == dqm::WRITTEN)
368  setDqmState(iCell, dqm::SENDING);
369  return cell;
370 }
unsigned int nextDqmReadIndex()
dqm::State_t dqmState(unsigned int index)
char state
Definition: procUtils.cc:75
bool setDqmState(unsigned int index, dqm::State_t state)
FUShmDqmCell * dqmCell(unsigned int iCell)
dqm::State_t FUShmBuffer::dqmState ( unsigned int  index)

Definition at line 1394 of file FUShmBuffer.cc.

References dqmStateOffset_, getHLTprescales::index, and nDqmCells_.

Referenced by discardDqmCell(), dqmCellToRead(), finishReadingDqmCell(), printDqmState(), and writeDqmEventData().

1394  {
1395  if (!(index < nDqmCells_)) {
1396  stringstream details;
1397  details << "index<nDqmCells_ assertion failed! Actual index is " << index;
1398  XCEPT_ASSERT(false, evf::Exception, details.str());
1399  }
1400  dqm::State_t *pstate = (dqm::State_t*) ((unsigned long) this
1401  + dqmStateOffset_);
1402  pstate += index;
1403  return *pstate;
1404 }
unsigned int dqmStateOffset_
Definition: FUShmBuffer.h:305
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int FUShmBuffer::evtNumber ( unsigned int  index)

Definition at line 1407 of file FUShmBuffer.cc.

References evtNumberOffset_, getHLTprescales::index, and nRawCells_.

Referenced by indexForEvtNumber(), and setEvtNumber().

1407  {
1408  if (!(index < nRawCells_)) {
1409  stringstream details;
1410  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1411  XCEPT_ASSERT(false, evf::Exception, details.str());
1412  }
1413  unsigned int *pevt = (unsigned int*) ((unsigned long) this
1414  + evtNumberOffset_);
1415  pevt += index;
1416  return *pevt;
1417 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtNumberOffset_
Definition: FUShmBuffer.h:302
pid_t FUShmBuffer::evtPrcId ( unsigned int  index)

Definition at line 1420 of file FUShmBuffer.cc.

References evtPrcIdOffset_, getHLTprescales::index, and nRawCells_.

1420  {
1421  if (!(index < nRawCells_)) {
1422  stringstream details;
1423  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1424  XCEPT_ASSERT(false, evf::Exception, details.str());
1425  }
1426  pid_t *prcid = (pid_t*) ((unsigned long) this + evtPrcIdOffset_);
1427  prcid += index;
1428  return *prcid;
1429 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtPrcIdOffset_
Definition: FUShmBuffer.h:303
evt::State_t FUShmBuffer::evtState ( unsigned int  index)

Definition at line 1381 of file FUShmBuffer.cc.

References evtStateOffset_, getHLTprescales::index, and nRawCells_.

Referenced by FUShmReader::fillRawData(), finishReadingRawCell(), finishWritingRawCell(), printEvtState(), rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), releaseRawCell(), scheduleRawCellForDiscard(), scheduleRawCellForDiscardServerSide(), writeRawEmptyEvent(), and writeRawLumiSectionEvent().

1381  {
1382  if (!(index < nRawCells_)) {
1383  stringstream details;
1384  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1385  XCEPT_ASSERT(false, evf::Exception, details.str());
1386  }
1387  evt::State_t *pstate = (evt::State_t*) ((unsigned long) this
1388  + evtStateOffset_);
1389  pstate += index;
1390  return *pstate;
1391 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtStateOffset_
Definition: FUShmBuffer.h:300
time_t FUShmBuffer::evtTimeStamp ( unsigned int  index)

Definition at line 1432 of file FUShmBuffer.cc.

References evtTimeStampOffset_, getHLTprescales::index, and nRawCells_.

1432  {
1433  if (!(index < nRawCells_)) {
1434  stringstream details;
1435  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1436  XCEPT_ASSERT(false, evf::Exception, details.str());
1437  }
1438  time_t *ptstmp = (time_t*) ((unsigned long) this + evtTimeStampOffset_);
1439  ptstmp += index;
1440  return *ptstmp;
1441 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtTimeStampOffset_
Definition: FUShmBuffer.h:304
void FUShmBuffer::finishReadingDqmCell ( FUShmDqmCell cell)

Definition at line 438 of file FUShmBuffer.cc.

References dqmState(), evf::dqm::EMPTY, evf::FUShmDqmCell::index(), segmentationMode_, evf::dqm::SENDING, evf::dqm::SENT, setDqmState(), and evf::utils::state.

438  {
439  dqm::State_t state = dqmState(cell->index());
440  if(!(state == dqm::SENDING || state == dqm::EMPTY)) {
441  stringstream details;
442  details << "state==dqm::SENDING||state==dqm::EMPTY assertion failed! Actual state is "
443  << state << ", index = " << cell->index();
444  XCEPT_ASSERT(false, evf::Exception, details.str());
445 
446  }
447  if (state == dqm::SENDING)
448  setDqmState(cell->index(), dqm::SENT);
449  if (segmentationMode_)
450  shmdt(cell);
451 }
unsigned int index() const
Definition: FUShmDqmCell.h:22
dqm::State_t dqmState(unsigned int index)
char state
Definition: procUtils.cc:75
bool setDqmState(unsigned int index, dqm::State_t state)
void FUShmBuffer::finishReadingRawCell ( FUShmRawCell cell)

Definition at line 410 of file FUShmBuffer.cc.

References evtState(), evf::FUShmRawCell::index(), evf::evt::PROCESSING, evf::evt::RAWREAD, evf::evt::RAWREADING, segmentationMode_, setEvtState(), setEvtTimeStamp(), evf::utils::state, and cond::rpcobgas::time.

Referenced by FUShmReader::fillRawData(), and evf::FUShmClient::readNext().

410  {
411  evt::State_t state = evtState(cell->index());
412  if(!(state == evt::RAWREADING)) {
413  stringstream details;
414  details << "state==evt::RAWREADING assertion failed! Actual state is "
415  << state << ", index = " << cell->index();
416  XCEPT_ASSERT(false, evf::Exception, details.str());
417  }
418  setEvtState(cell->index(), evt::RAWREAD);
420  setEvtTimeStamp(cell->index(), time(0));
421  if (segmentationMode_)
422  shmdt(cell);
423 }
evt::State_t evtState(unsigned int index)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
bool setEvtTimeStamp(unsigned int index, time_t timeStamp)
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
void FUShmBuffer::finishReadingRecoCell ( FUShmRecoCell cell)

Definition at line 426 of file FUShmBuffer.cc.

References nRawCells_, evf::FUShmRecoCell::rawCellIndex(), segmentationMode_, evf::evt::SENT, and setEvtState().

426  {
427  unsigned int iRawCell = cell->rawCellIndex();
428  if (iRawCell < nRawCells_) {
429  //evt::State_t state=evtState(cell->rawCellIndex());
430  //XCEPT_ASSERT(state==evt::SENDING, evf::Exception, "state==evt::SENDING assertion failed!");
432  }
433  if (segmentationMode_)
434  shmdt(cell);
435 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawCellIndex() const
Definition: FUShmRecoCell.h:23
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
void FUShmBuffer::finishWritingRawCell ( FUShmRawCell cell)

Definition at line 393 of file FUShmBuffer.cc.

References evf::FUShmRawCell::evtNumber(), evtState(), evf::FUShmRawCell::index(), postRawIndexToRead(), postRawRead(), evf::evt::RAWWRITING, evf::evt::RAWWRITTEN, segmentationMode_, setEvtNumber(), setEvtState(), and evf::utils::state.

Referenced by evf::FUShmServer::writeNext().

393  {
394  evt::State_t state = evtState(cell->index());
395  if(!(state == evt::RAWWRITING)) {
396  stringstream details;
397  details << "state==evt::RAWWRITING assertion failed! Actual state is "
398  << state << ", index = " << cell->index();
399  XCEPT_ASSERT(false, evf::Exception, details.str());
400  }
402  setEvtNumber(cell->index(), cell->evtNumber());
403  postRawIndexToRead(cell->index());
404  if (segmentationMode_)
405  shmdt(cell);
406  postRawRead();
407 }
void postRawIndexToRead(unsigned int index)
evt::State_t evtState(unsigned int index)
unsigned int evtNumber() const
Definition: FUShmRawCell.h:28
bool setEvtNumber(unsigned int index, unsigned int evtNumber)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
key_t FUShmBuffer::getSemKey ( )
static

Definition at line 1169 of file FUShmBuffer.cc.

References gather_cfg::cout, query::result, SEM_KEYID, and semKeyPath_.

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

1169  {
1170  key_t result = getuid() * 1000 + SEM_KEYID;
1171  if (result == (key_t) -1)
1172  cout << "FUShmBuffer::getSemKey: ftok() failed " << "for file "
1173  << semKeyPath_ << "!" << endl;
1174  return result;
1175 }
static const char * semKeyPath_
Definition: FUShmBuffer.h:331
tuple result
Definition: query.py:137
#define SEM_KEYID
Definition: FUShmBuffer.cc:33
tuple cout
Definition: gather_cfg.py:121
FUShmBuffer * FUShmBuffer::getShmBuffer ( )
static

Definition at line 986 of file FUShmBuffer.cc.

References gather_cfg::cout, FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), nDqmCells(), nRawCells(), nRecoCells(), AlCaHLTBitMon_ParallelJobs::p, sem_get(), semid(), setClientPrcId(), shm_attach(), shm_get(), shm_nattch(), shmid(), and size().

Referenced by FUShmDQMOutputService::attachToShm(), and SM_SharedMemoryHandle::getShmBuffer().

986  {
987  // get bookkeeping shared memory segment
988  int size = sizeof(unsigned int) * 7;
990  if (shmid < 0)
991  return 0;
992  void* shmAddr = shm_attach(shmid);
993  if (0 == shmAddr)
994  return 0;
995 
996  unsigned int *p = (unsigned int*) shmAddr;
997  bool segmentationMode = *p++;
998  unsigned int nRawCells = *p++;
999  unsigned int nRecoCells = *p++;
1000  unsigned int nDqmCells = *p++;
1001  unsigned int rawCellSize = *p++;
1002  unsigned int recoCellSize = *p++;
1003  unsigned int dqmCellSize = *p++;
1004  shmdt(shmAddr);
1005 
1006  cout << "FUShmBuffer::getShmBuffer():" << " segmentationMode="
1007  << segmentationMode << " nRawCells=" << nRawCells << " nRecoCells="
1008  << nRecoCells << " nDqmCells=" << nDqmCells << " rawCellSize="
1009  << rawCellSize << " recoCellSize=" << recoCellSize
1010  << " dqmCellSize=" << dqmCellSize << endl;
1011 
1012  // get the 'real' shared memory buffer
1013  size = FUShmBuffer::size(segmentationMode, nRawCells, nRecoCells,
1014  nDqmCells, rawCellSize, recoCellSize, dqmCellSize);
1015  shmid = shm_get(FUShmBuffer::getShmKey(), size);
1016  if (shmid < 0)
1017  return 0;
1018  int semid = sem_get(FUShmBuffer::getSemKey(), 9);
1019  if (semid < 0)
1020  return 0;
1021  shmAddr = shm_attach(shmid);
1022  if (0 == shmAddr)
1023  return 0;
1024 
1025  if (0 == shm_nattch(shmid)) {
1026  cout << "FUShmBuffer::getShmBuffer() FAILED: nattch=" << shm_nattch(
1027  shmid) << endl;
1028  return 0;
1029  }
1030  FUShmBuffer* buffer = new (shmAddr) FUShmBuffer(segmentationMode,
1031  nRawCells, nRecoCells, nDqmCells, rawCellSize, recoCellSize,
1032  dqmCellSize);
1033 
1034  cout << "FUShmBuffer::getShmBuffer(): shared memory buffer RETRIEVED. PID:" << getpid()
1035  << endl;
1036  cout << " segmentationMode="
1037  << segmentationMode << endl;
1038 
1039  buffer->setClientPrcId(getpid());
1040 
1041  return buffer;
1042 }
unsigned int nRecoCells() const
Definition: FUShmBuffer.h:66
static int shm_nattch(int shmid)
static void * shm_attach(int shmid)
int shmid() const
Definition: FUShmBuffer.h:69
static key_t getShmDescriptorKey()
static int shm_get(key_t key, int size)
static unsigned int size(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
bool setClientPrcId(pid_t prcId)
unsigned int nRawCells() const
Definition: FUShmBuffer.h:65
static key_t getShmKey()
static key_t getSemKey()
static int sem_get(key_t key, int nsem)
FUShmBuffer(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
Definition: FUShmBuffer.cc:53
tuple cout
Definition: gather_cfg.py:121
unsigned int nDqmCells() const
Definition: FUShmBuffer.h:67
int semid() const
Definition: FUShmBuffer.h:70
key_t FUShmBuffer::getShmDescriptorKey ( )
static

Definition at line 1151 of file FUShmBuffer.cc.

References gather_cfg::cout, query::result, SHM_DESCRIPTOR_KEYID, and shmKeyPath_.

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

1151  {
1152  key_t result = getuid() * 1000 + SHM_DESCRIPTOR_KEYID;
1153  if (result == (key_t) -1)
1154  cout << "FUShmBuffer::getShmDescriptorKey: failed " << "for file "
1155  << shmKeyPath_ << "!" << endl;
1156  return result;
1157 }
static const char * shmKeyPath_
Definition: FUShmBuffer.h:330
tuple result
Definition: query.py:137
#define SHM_DESCRIPTOR_KEYID
Definition: FUShmBuffer.cc:31
tuple cout
Definition: gather_cfg.py:121
key_t FUShmBuffer::getShmKey ( )
static

Definition at line 1160 of file FUShmBuffer.cc.

References gather_cfg::cout, query::result, SHM_KEYID, and shmKeyPath_.

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

1160  {
1161  key_t result = getuid() * 1000 + SHM_KEYID;
1162  if (result == (key_t) -1)
1163  cout << "FUShmBuffer::getShmKey: ftok() failed " << "for file "
1164  << shmKeyPath_ << "!" << endl;
1165  return result;
1166 }
#define SHM_KEYID
Definition: FUShmBuffer.cc:32
static const char * shmKeyPath_
Definition: FUShmBuffer.h:330
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
int FUShmBuffer::incEvtDiscard ( unsigned int  index,
bool  lockShm = true 
)

Definition at line 1512 of file FUShmBuffer.cc.

References evtDiscardOffset_, getHLTprescales::index, lock(), nRawCells_, query::result, and unlock().

Referenced by writeRecoEventData().

1512  {
1513  int result = 0;
1514  if(!(index < nRawCells_)) {
1515  stringstream details;
1516  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1517  //unlock here as it will skip external unlock
1518  if (!lockShm) unlock();
1519  XCEPT_ASSERT(false,evf::Exception,details.str());
1520  }
1521  unsigned int *pcount = (unsigned int*) ((unsigned long) this
1522  + evtDiscardOffset_);
1523  pcount += index;
1524  if (lockShm) lock();
1525  (*pcount)++;
1526  result = *pcount;
1527  if (lockShm) unlock();
1528  return result;
1529 }
unsigned int evtDiscardOffset_
Definition: FUShmBuffer.h:301
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
tuple result
Definition: query.py:137
unsigned int FUShmBuffer::indexForEvtNumber ( unsigned int  evtNumber)
private

Definition at line 1358 of file FUShmBuffer.cc.

References evtNumber(), evtNumberOffset_, i, and nRawCells_.

Referenced by writeRecoEventData().

1358  {
1359  unsigned int *pevt = (unsigned int*) ((unsigned long) this
1360  + evtNumberOffset_);
1361  for (unsigned int i = 0; i < nRawCells_; i++) {
1362  if ((*pevt++) == evtNumber)
1363  return i;
1364  }
1365  XCEPT_ASSERT(false, evf::Exception, "This point should not be reached!");
1366  return 0xffffffff;
1367 }
int i
Definition: DBlmapReader.cc:9
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtNumberOffset_
Definition: FUShmBuffer.h:302
unsigned int evtNumber(unsigned int index)
unsigned int FUShmBuffer::indexForEvtPrcId ( pid_t  evtNumber)
private

Definition at line 1370 of file FUShmBuffer.cc.

References evtPrcIdOffset_, i, and nRawCells_.

1370  {
1371  pid_t *pevt = (pid_t*) ((unsigned long) this + evtPrcIdOffset_);
1372  for (unsigned int i = 0; i < nRawCells_; i++) {
1373  if ((*pevt++) == prcid)
1374  return i;
1375  }
1376  XCEPT_ASSERT(false, evf::Exception, "This point should not be reached!");
1377  return 0xffffffff;
1378 }
int i
Definition: DBlmapReader.cc:9
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtPrcIdOffset_
Definition: FUShmBuffer.h:303
void FUShmBuffer::initialize ( unsigned int  shmid,
unsigned int  semid 
)

Definition at line 162 of file FUShmBuffer.cc.

References dqmCellOffset_, dqmCellPayloadSize_, dqmCellTotalSize_, i, nDqmCells_, nRawCells_, nRecoCells_, rawCellOffset_, rawCellPayloadSize_, rawCellTotalSize_, recoCellOffset_, recoCellPayloadSize_, recoCellTotalSize_, reset(), segmentationMode_, semid(), semid_, shm_attach(), shm_create(), shmid(), shmid_, and shmKeyPath_.

Referenced by createShmBuffer().

162  {
163  shmid_ = shmid;
164  semid_ = semid;
165 
166  if (segmentationMode_) {
167  int shmKeyId = 666;
168  key_t* keyAddr = (key_t*) ((unsigned long) this + rawCellOffset_);
169  for (unsigned int i = 0; i < nRawCells_; i++) {
170  *keyAddr = ftok(shmKeyPath_, shmKeyId++);
171  int shmid = shm_create(*keyAddr, rawCellTotalSize_);
172  void* shmAddr = shm_attach(shmid);
173  new (shmAddr) FUShmRawCell(rawCellPayloadSize_);
174  shmdt(shmAddr);
175  ++keyAddr;
176  }
177  keyAddr = (key_t*) ((unsigned long) this + recoCellOffset_);
178  for (unsigned int i = 0; i < nRecoCells_; i++) {
179  *keyAddr = ftok(shmKeyPath_, shmKeyId++);
180  int shmid = shm_create(*keyAddr, recoCellTotalSize_);
181  void* shmAddr = shm_attach(shmid);
182  new (shmAddr) FUShmRecoCell(recoCellPayloadSize_);
183  shmdt(shmAddr);
184  ++keyAddr;
185  }
186  keyAddr = (key_t*) ((unsigned long) this + dqmCellOffset_);
187  for (unsigned int i = 0; i < nDqmCells_; i++) {
188  *keyAddr = ftok(shmKeyPath_, shmKeyId++);
189  int shmid = shm_create(*keyAddr, dqmCellTotalSize_);
190  void* shmAddr = shm_attach(shmid);
191  new (shmAddr) FUShmDqmCell(dqmCellPayloadSize_);
192  shmdt(shmAddr);
193  ++keyAddr;
194  }
195  }
196 
197  reset(true);
198 }
int i
Definition: DBlmapReader.cc:9
static void * shm_attach(int shmid)
unsigned int recoCellPayloadSize_
Definition: FUShmBuffer.h:319
int shmid() const
Definition: FUShmBuffer.h:69
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int dqmCellOffset_
Definition: FUShmBuffer.h:328
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
static const char * shmKeyPath_
Definition: FUShmBuffer.h:330
unsigned int dqmCellPayloadSize_
Definition: FUShmBuffer.h:326
unsigned int rawCellPayloadSize_
Definition: FUShmBuffer.h:312
unsigned int dqmCellTotalSize_
Definition: FUShmBuffer.h:327
void reset(bool)
Definition: FUShmBuffer.cc:201
unsigned int recoCellTotalSize_
Definition: FUShmBuffer.h:320
unsigned int rawCellTotalSize_
Definition: FUShmBuffer.h:313
static int shm_create(key_t key, int size)
unsigned int rawCellOffset_
Definition: FUShmBuffer.h:314
unsigned int recoCellOffset_
Definition: FUShmBuffer.h:321
int semid() const
Definition: FUShmBuffer.h:70
void evf::FUShmBuffer::lock ( void  )
inline
int FUShmBuffer::nbRawCellsToRead ( ) const

Definition at line 293 of file FUShmBuffer.cc.

References semid().

293  {
294  return semctl(semid(), 2, GETVAL);
295 }
int semid() const
Definition: FUShmBuffer.h:70
unsigned int FUShmBuffer::nbRawCellsToWrite ( ) const

Definition at line 288 of file FUShmBuffer.cc.

References semid().

288  {
289  return semctl(semid(), 1, GETVAL);
290 }
int semid() const
Definition: FUShmBuffer.h:70
unsigned int evf::FUShmBuffer::nClients ( ) const
inline

Definition at line 71 of file FUShmBuffer.h.

References nClients_.

71 { return nClients_; }
unsigned int nClients_
Definition: FUShmBuffer.h:307
unsigned int evf::FUShmBuffer::nDqmCells ( ) const
inline

Definition at line 67 of file FUShmBuffer.h.

References nDqmCells_.

Referenced by createShmBuffer(), getShmBuffer(), releaseSharedMemory(), and size().

67 { return nDqmCells_; }
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int FUShmBuffer::nextDqmReadIndex ( )
private

Definition at line 1343 of file FUShmBuffer.cc.

References dqmReadNext_, dqmReadOffset_, nDqmCells_, and nextIndex().

Referenced by dqmCellToRead().

1343  {
1345 }
unsigned int dqmReadOffset_
Definition: FUShmBuffer.h:298
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int dqmReadNext_
Definition: FUShmBuffer.h:296
unsigned int FUShmBuffer::nextDqmWriteIndex ( )
private

Definition at line 1338 of file FUShmBuffer.cc.

References dqmWriteNext_, dqmWriteOffset_, nDqmCells_, and nextIndex().

Referenced by writeDqmEmptyEvent(), and writeDqmEventData().

1338  {
1340 }
unsigned int dqmWriteNext_
Definition: FUShmBuffer.h:293
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int dqmWriteOffset_
Definition: FUShmBuffer.h:295
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int FUShmBuffer::nextIndex ( unsigned int  offset,
unsigned int  nCells,
unsigned int &  iNext 
)
private

Definition at line 1275 of file FUShmBuffer.cc.

References lock(), evf::evtn::offset(), query::result, and unlock().

Referenced by nextDqmReadIndex(), nextDqmWriteIndex(), nextRawReadIndex(), nextRawWriteIndex(), nextRecoReadIndex(), and nextRecoWriteIndex().

1276  {
1277  lock();
1278  unsigned int* pindex = (unsigned int*) ((unsigned long) this + offset);
1279  pindex += iNext;
1280  iNext = (iNext + 1) % nCells;
1281  unsigned int result = *pindex;
1282  unlock();
1283  return result;
1284 }
tuple result
Definition: query.py:137
unsigned int offset(bool)
unsigned int FUShmBuffer::nextRawReadIndex ( )
private

Definition at line 1303 of file FUShmBuffer.cc.

References nextIndex(), nRawCells_, rawReadNext_, and rawReadOffset_.

Referenced by rawCellToRead().

1303  {
1305 }
unsigned int rawReadOffset_
Definition: FUShmBuffer.h:283
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawReadNext_
Definition: FUShmBuffer.h:281
unsigned int FUShmBuffer::nextRawWriteIndex ( )
private

Definition at line 1298 of file FUShmBuffer.cc.

References nextIndex(), nRawCells_, rawWriteNext_, and rawWriteOffset_.

Referenced by rawCellToWrite().

1298  {
1300 }
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawWriteNext_
Definition: FUShmBuffer.h:278
unsigned int rawWriteOffset_
Definition: FUShmBuffer.h:280
unsigned int FUShmBuffer::nextRecoReadIndex ( )
private

Definition at line 1323 of file FUShmBuffer.cc.

References nextIndex(), nRecoCells_, recoReadNext_, and recoReadOffset_.

Referenced by recoCellToRead().

1323  {
1325 }
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int recoReadOffset_
Definition: FUShmBuffer.h:291
unsigned int recoReadNext_
Definition: FUShmBuffer.h:289
unsigned int FUShmBuffer::nextRecoWriteIndex ( )
private

Definition at line 1318 of file FUShmBuffer.cc.

References nextIndex(), nRecoCells_, recoWriteNext_, and recoWriteOffset_.

Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().

1318  {
1320 }
unsigned int nextIndex(unsigned int offset, unsigned int nCells, unsigned int &iNext)
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int recoWriteNext_
Definition: FUShmBuffer.h:286
unsigned int recoWriteOffset_
Definition: FUShmBuffer.h:288
unsigned int evf::FUShmBuffer::nRawCells ( ) const
inline

Definition at line 65 of file FUShmBuffer.h.

References nRawCells_.

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

65 { return nRawCells_; }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evf::FUShmBuffer::nRecoCells ( ) const
inline

Definition at line 66 of file FUShmBuffer.h.

References nRecoCells_.

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

66 { return nRecoCells_; }
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
void FUShmBuffer::postDqmIndexToRead ( unsigned int  index)
private

Definition at line 1353 of file FUShmBuffer.cc.

References dqmReadLast_, dqmReadOffset_, nDqmCells_, and postIndex().

Referenced by writeDqmEmptyEvent(), and writeDqmEventData().

1353  {
1355 }
unsigned int dqmReadLast_
Definition: FUShmBuffer.h:297
unsigned int dqmReadOffset_
Definition: FUShmBuffer.h:298
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void FUShmBuffer::postDqmIndexToWrite ( unsigned int  index)
private

Definition at line 1348 of file FUShmBuffer.cc.

References dqmWriteLast_, dqmWriteOffset_, nDqmCells_, and postIndex().

Referenced by discardDqmCell().

1348  {
1350 }
unsigned int dqmWriteLast_
Definition: FUShmBuffer.h:294
unsigned int dqmWriteOffset_
Definition: FUShmBuffer.h:295
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void evf::FUShmBuffer::postDqmRead ( )
inlineprivate

Definition at line 267 of file FUShmBuffer.h.

References sem_post().

Referenced by writeDqmEmptyEvent(), and writeDqmEventData().

267 { sem_post(8); }
void sem_post(int isem)
void evf::FUShmBuffer::postDqmWrite ( )
inlineprivate

Definition at line 265 of file FUShmBuffer.h.

References sem_post().

Referenced by discardDqmCell().

265 { sem_post(7); }
void sem_post(int isem)
void FUShmBuffer::postIndex ( unsigned int  index,
unsigned int  offset,
unsigned int  nCells,
unsigned int &  iLast 
)
private

Definition at line 1287 of file FUShmBuffer.cc.

References getHLTprescales::index, lock(), evf::evtn::offset(), and unlock().

Referenced by postDqmIndexToRead(), postDqmIndexToWrite(), postRawIndexToRead(), postRawIndexToWrite(), postRecoIndexToRead(), and postRecoIndexToWrite().

1288  {
1289  lock();
1290  unsigned int* pindex = (unsigned int*) ((unsigned long) this + offset);
1291  pindex += iLast;
1292  *pindex = index;
1293  iLast = (iLast + 1) % nCells;
1294  unlock();
1295 }
unsigned int offset(bool)
void evf::FUShmBuffer::postRawDiscard ( )
inlineprivate
void evf::FUShmBuffer::postRawDiscarded ( )
inlineprivate
void FUShmBuffer::postRawIndexToRead ( unsigned int  index)
private

Definition at line 1313 of file FUShmBuffer.cc.

References nRawCells_, postIndex(), rawReadLast_, and rawReadOffset_.

Referenced by finishWritingRawCell(), writeRawEmptyEvent(), and writeRawLumiSectionEvent().

1313  {
1315 }
unsigned int rawReadOffset_
Definition: FUShmBuffer.h:283
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawReadLast_
Definition: FUShmBuffer.h:282
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void FUShmBuffer::postRawIndexToWrite ( unsigned int  index)
private

Definition at line 1308 of file FUShmBuffer.cc.

References nRawCells_, postIndex(), rawWriteLast_, and rawWriteOffset_.

Referenced by releaseRawCell().

1308  {
1310 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawWriteOffset_
Definition: FUShmBuffer.h:280
unsigned int rawWriteLast_
Definition: FUShmBuffer.h:279
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void evf::FUShmBuffer::postRawRead ( )
inlineprivate

Definition at line 255 of file FUShmBuffer.h.

References sem_post().

Referenced by finishWritingRawCell(), writeRawEmptyEvent(), and writeRawLumiSectionEvent().

255 { sem_post(2); }
void sem_post(int isem)
void evf::FUShmBuffer::postRawWrite ( )
inlineprivate

Definition at line 253 of file FUShmBuffer.h.

References sem_post().

Referenced by releaseRawCell().

253 { sem_post(1); }
void sem_post(int isem)
void FUShmBuffer::postRecoIndexToRead ( unsigned int  index)
private

Definition at line 1333 of file FUShmBuffer.cc.

References nRecoCells_, postIndex(), recoReadLast_, and recoReadOffset_.

Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().

1333  {
1335 }
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int recoReadOffset_
Definition: FUShmBuffer.h:291
unsigned int recoReadLast_
Definition: FUShmBuffer.h:290
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void FUShmBuffer::postRecoIndexToWrite ( unsigned int  index)
private

Definition at line 1328 of file FUShmBuffer.cc.

References nRecoCells_, postIndex(), recoWriteLast_, and recoWriteOffset_.

Referenced by discardOrphanedRecoCell(), and discardRecoCell().

1328  {
1330 }
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int recoWriteLast_
Definition: FUShmBuffer.h:287
unsigned int recoWriteOffset_
Definition: FUShmBuffer.h:288
void postIndex(unsigned int index, unsigned int offset, unsigned int nCells, unsigned int &iLast)
void evf::FUShmBuffer::postRecoRead ( )
inlineprivate

Definition at line 263 of file FUShmBuffer.h.

References sem_post().

Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().

263 { sem_post(6); }
void sem_post(int isem)
void evf::FUShmBuffer::postRecoWrite ( )
inlineprivate

Definition at line 261 of file FUShmBuffer.h.

References sem_post().

Referenced by discardOrphanedRecoCell(), and discardRecoCell().

261 { sem_post(5); }
void sem_post(int isem)
void FUShmBuffer::printDqmState ( unsigned int  index)

Definition at line 911 of file FUShmBuffer.cc.

References gather_cfg::cout, dqmState(), and evf::utils::state.

911  {
913  cout << "dqm evt " << index << " in state '" << state << "'." << endl;
914 }
dqm::State_t dqmState(unsigned int index)
char state
Definition: procUtils.cc:75
tuple cout
Definition: gather_cfg.py:121
void FUShmBuffer::printEvtState ( unsigned int  index)

Definition at line 878 of file FUShmBuffer.cc.

References gather_cfg::cout, evf::evt::DISCARDING, evf::evt::EMPTY, evtState(), evf::evt::PROCESSED, evf::evt::PROCESSING, evf::evt::RAWREAD, evf::evt::RAWREADING, evf::evt::RAWWRITING, evf::evt::RAWWRITTEN, evf::evt::RECOWRITING, evf::evt::RECOWRITTEN, evf::evt::SENDING, evf::evt::SENT, evf::utils::state, evf::evt::STOP, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by evf::FUShmServer::writeNext().

878  {
880  std::string stateName;
881  if (state == evt::EMPTY)
882  stateName = "EMPTY";
883  else if (state == evt::STOP)
884  stateName = "STOP";
885  else if (state == evt::RAWWRITING)
886  stateName = "RAWWRITING";
887  else if (state == evt::RAWWRITTEN)
888  stateName = "RAWRITTEN";
889  else if (state == evt::RAWREADING)
890  stateName = "RAWREADING";
891  else if (state == evt::RAWREAD)
892  stateName = "RAWREAD";
893  else if (state == evt::PROCESSING)
894  stateName = "PROCESSING";
895  else if (state == evt::PROCESSED)
896  stateName = "PROCESSED";
897  else if (state == evt::RECOWRITING)
898  stateName = "RECOWRITING";
899  else if (state == evt::RECOWRITTEN)
900  stateName = "RECOWRITTEN";
901  else if (state == evt::SENDING)
902  stateName = "SENDING";
903  else if (state == evt::SENT)
904  stateName = "SENT";
905  else if (state == evt::DISCARDING)
906  stateName = "DISCARDING";
907  cout << "evt " << index << " in state '" << stateName << "'." << endl;
908 }
evt::State_t evtState(unsigned int index)
char state
Definition: procUtils.cc:75
tuple cout
Definition: gather_cfg.py:121
FUShmRawCell * FUShmBuffer::rawCell ( unsigned int  iCell)

Definition at line 1632 of file FUShmBuffer.cc.

References gather_cfg::cout, nRawCells_, rawCellOffset_, rawCellPayloadSize_, rawCellShmKey(), rawCellTotalSize_, query::result, segmentationMode_, shm_attach(), shm_get(), and shmid().

Referenced by rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), reset(), and writeErrorEventData().

1632  {
1633  FUShmRawCell* result(0);
1634 
1635  if (iCell >= nRawCells_) {
1636  cout << "FUShmBuffer::rawCell(" << iCell << ") ERROR: " << "iCell="
1637  << iCell << " >= nRawCells()=" << nRawCells_ << endl;
1638  return result;
1639  }
1640 
1641  if (segmentationMode_) {
1642  key_t shmkey = rawCellShmKey(iCell);
1643  int shmid = shm_get(shmkey, rawCellTotalSize_);
1644  void* cellAddr = shm_attach(shmid);
1645  result = new (cellAddr) FUShmRawCell(rawCellPayloadSize_);
1646  } else {
1647  result = (FUShmRawCell*) ((unsigned long) this + rawCellOffset_ + iCell
1648  * rawCellTotalSize_);
1649  }
1650 
1651  return result;
1652 }
static void * shm_attach(int shmid)
int shmid() const
Definition: FUShmBuffer.h:69
static int shm_get(key_t key, int size)
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
tuple result
Definition: query.py:137
key_t rawCellShmKey(unsigned int iCell)
unsigned int rawCellPayloadSize_
Definition: FUShmBuffer.h:312
unsigned int rawCellTotalSize_
Definition: FUShmBuffer.h:313
tuple cout
Definition: gather_cfg.py:121
unsigned int rawCellOffset_
Definition: FUShmBuffer.h:314
bool FUShmBuffer::rawCellReadyForDiscard ( unsigned int  index)
private

Definition at line 1701 of file FUShmBuffer.cc.

References evtDiscardOffset_, getHLTprescales::index, lock(), nRawCells_, query::result, and unlock().

Referenced by scheduleRawCellForDiscard(), scheduleRawCellForDiscardServerSide(), scheduleRawEmptyCellForDiscard(), and scheduleRawEmptyCellForDiscardServerSide().

1701  {
1702  if(!(index < nRawCells_)) {
1703  stringstream details;
1704  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1705  XCEPT_ASSERT(false, evf::Exception, details.str());
1706  }
1707  unsigned int *pcount = (unsigned int*) ((unsigned long) this
1708  + evtDiscardOffset_);
1709  pcount += index;
1710  lock();
1711  if(!(*pcount > 0)) {
1712  stringstream details;
1713  details << "*pcount>0 assertion failed! Value at pcount is " << *pcount << " for cell index " << index;
1714  unlock();
1715  XCEPT_ASSERT(false, evf::Exception, details.str());
1716  }
1717  --(*pcount);
1718  bool result = (*pcount == 0);
1719  unlock();
1720  return result;
1721 }
unsigned int evtDiscardOffset_
Definition: FUShmBuffer.h:301
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
tuple result
Definition: query.py:137
key_t FUShmBuffer::rawCellShmKey ( unsigned int  iCell)
private

Definition at line 1737 of file FUShmBuffer.cc.

References gather_cfg::cout, nRawCells_, rawCellOffset_, and shmKey().

Referenced by rawCell(), and releaseSharedMemory().

1737  {
1738  if (iCell >= nRawCells_) {
1739  cout << "FUShmBuffer::rawCellShmKey() ERROR: " << "iCell>=nRawCells: "
1740  << iCell << ">=" << nRawCells_ << endl;
1741  return -1;
1742  }
1743  return shmKey(iCell, rawCellOffset_);
1744 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
tuple cout
Definition: gather_cfg.py:121
unsigned int rawCellOffset_
Definition: FUShmBuffer.h:314
key_t shmKey(unsigned int iCell, unsigned int offset)
FUShmRawCell * FUShmBuffer::rawCellToDiscard ( )

Definition at line 373 of file FUShmBuffer.cc.

References evf::evt::DISCARDING, evf::evt::EMPTY, evtState(), evf::FUShmRawCell::index(), evf::evt::PROCESSED, rawCell(), rawDiscardIndex_, evf::evt::SENT, setEvtState(), evf::utils::state, evf::evt::STOP, evf::evt::USEDLS, and waitRawDiscarded().

Referenced by evf::FUShmClient::readNext().

373  {
376  evt::State_t state = evtState(cell->index());
377  if(!(state == evt::PROCESSED || state == evt::SENT ||
378  state == evt::EMPTY || state == evt::STOP ||
379  state == evt::USEDLS)) {
380  stringstream details;
381  details << "state==evt::PROCESSED || state==evt::SENT || "
382  << "state==evt::EMPTY || state==evt::STOP || "
383  << "state==evt::USEDLS assertion failed! Actual state is "
384  << state << ", index = " << cell->index();
385  XCEPT_ASSERT(false,evf::Exception,details.str());
386  }
387  if (state != evt::EMPTY && state != evt::USEDLS && state != evt::STOP)
389  return cell;
390 }
evt::State_t evtState(unsigned int index)
FUShmRawCell * rawCell(unsigned int iCell)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
void waitRawDiscarded()
Definition: FUShmBuffer.h:258
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
FUShmRawCell * FUShmBuffer::rawCellToRead ( )

Definition at line 317 of file FUShmBuffer.cc.

References evf::evt::EMPTY, evtState(), evf::evt::LUMISECTION, nextRawReadIndex(), rawCell(), evf::evt::RAWREADING, evf::evt::RAWWRITTEN, setEvtPrcId(), setEvtState(), evf::utils::state, evf::evt::STOP, and waitRawRead().

Referenced by FUShmReader::fillRawData(), and evf::FUShmClient::readNext().

317  {
318  waitRawRead();
319  unsigned int iCell = nextRawReadIndex();
320  FUShmRawCell* cell = rawCell(iCell);
321  evt::State_t state = evtState(iCell);
322  if(!(state == evt::RAWWRITTEN || state == evt::EMPTY ||
323  state == evt::STOP || state == evt::LUMISECTION))
324  {
325  stringstream details;
326  details
327  << "state==evt::RAWWRITTEN ||state==evt::EMPTY ||state==evt::STOP"
328  << "||state==evt::LUMISECTION assertion failed! Actual state is "
329  << state << ", iCell = " << iCell;
330  XCEPT_ASSERT(false,evf::Exception, details.str());
331  }
332  if (state == evt::RAWWRITTEN) {
333  setEvtPrcId(iCell, getpid());
335  }
336  return cell;
337 }
bool setEvtPrcId(unsigned int index, pid_t prcId)
evt::State_t evtState(unsigned int index)
unsigned int nextRawReadIndex()
FUShmRawCell * rawCell(unsigned int iCell)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
char state
Definition: procUtils.cc:75
FUShmRawCell * FUShmBuffer::rawCellToWrite ( )

Definition at line 298 of file FUShmBuffer.cc.

References evf::evt::EMPTY, evtState(), lock(), nextRawWriteIndex(), rawCell(), evf::evt::RAWWRITING, setEvtDiscard(), setEvtState(), evf::utils::state, unlock(), and waitRawWrite().

Referenced by scheduleRawEmptyCellForDiscard(), evf::FUShmServer::writeNext(), writeRawEmptyEvent(), and writeRawLumiSectionEvent().

298  {
299  if (waitRawWrite() != 0)
300  return 0;
301  unsigned int iCell = nextRawWriteIndex();
302  FUShmRawCell* cell = rawCell(iCell);
303  evt::State_t state = evtState(iCell);
304  if(!(state == evt::EMPTY)) {
305  stringstream details;
306  details << "state==evt::EMPTY assertion failed! Actual state is " << state << ", iCell = " << iCell;
307  XCEPT_ASSERT(false, evf::Exception, details.str());
308  }
309  lock();
310  setEvtState(iCell, evt::RAWWRITING,false);
311  setEvtDiscard(iCell, 1,false,false);
312  unlock();
313  return cell;
314 }
evt::State_t evtState(unsigned int index)
FUShmRawCell * rawCell(unsigned int iCell)
bool setEvtDiscard(unsigned int index, unsigned int discard, bool checkValue=false, bool lockShm=true)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
unsigned int nextRawWriteIndex()
char state
Definition: procUtils.cc:75
FUShmRecoCell * FUShmBuffer::recoCell ( unsigned int  iCell)

Definition at line 1655 of file FUShmBuffer.cc.

References gather_cfg::cout, nRecoCells_, recoCellOffset_, recoCellPayloadSize_, recoCellShmKey(), recoCellTotalSize_, query::result, segmentationMode_, shm_attach(), shm_get(), and shmid().

Referenced by discardOrphanedRecoCell(), discardRecoCell(), recoCellToRead(), reset(), writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().

1655  {
1656  FUShmRecoCell* result(0);
1657 
1658  if (iCell >= nRecoCells_) {
1659  cout << "FUShmBuffer::recoCell(" << iCell << ") ERROR: " << "iCell="
1660  << iCell << " >= nRecoCells=" << nRecoCells_ << endl;
1661  return result;
1662  }
1663 
1664  if (segmentationMode_) {
1665  key_t shmkey = recoCellShmKey(iCell);
1666  int shmid = shm_get(shmkey, recoCellTotalSize_);
1667  void* cellAddr = shm_attach(shmid);
1668  result = new (cellAddr) FUShmRecoCell(recoCellPayloadSize_);
1669  } else {
1670  result = (FUShmRecoCell*) ((unsigned long) this + recoCellOffset_
1671  + iCell * recoCellTotalSize_);
1672  }
1673 
1674  return result;
1675 }
key_t recoCellShmKey(unsigned int iCell)
static void * shm_attach(int shmid)
unsigned int recoCellPayloadSize_
Definition: FUShmBuffer.h:319
int shmid() const
Definition: FUShmBuffer.h:69
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
static int shm_get(key_t key, int size)
tuple result
Definition: query.py:137
unsigned int recoCellTotalSize_
Definition: FUShmBuffer.h:320
tuple cout
Definition: gather_cfg.py:121
unsigned int recoCellOffset_
Definition: FUShmBuffer.h:321
key_t FUShmBuffer::recoCellShmKey ( unsigned int  iCell)
private

Definition at line 1747 of file FUShmBuffer.cc.

References gather_cfg::cout, nRecoCells_, recoCellOffset_, and shmKey().

Referenced by recoCell(), and releaseSharedMemory().

1747  {
1748  if (iCell >= nRecoCells_) {
1749  cout << "FUShmBuffer::recoCellShmKey() ERROR: "
1750  << "iCell>=nRecoCells: " << iCell << ">=" << nRecoCells_
1751  << endl;
1752  return -1;
1753  }
1754  return shmKey(iCell, recoCellOffset_);
1755 }
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
tuple cout
Definition: gather_cfg.py:121
key_t shmKey(unsigned int iCell, unsigned int offset)
unsigned int recoCellOffset_
Definition: FUShmBuffer.h:321
FUShmRecoCell * FUShmBuffer::recoCellToRead ( )

Definition at line 340 of file FUShmBuffer.cc.

References nextRecoReadIndex(), nRawCells_, evf::FUShmRecoCell::rawCellIndex(), recoCell(), evf::evt::SENDING, setEvtState(), and waitRecoRead().

340  {
341  waitRecoRead();
342  unsigned int iCell = nextRecoReadIndex();
343  FUShmRecoCell* cell = recoCell(iCell);
344  unsigned int iRawCell = cell->rawCellIndex();
345  if (iRawCell < nRawCells_) {
346  //evt::State_t state=evtState(iRawCell);
347  //XCEPT_ASSERT(state==evt::RECOWRITTEN, evf::Exception, "state==evt::RECOWRITTEN assertion failed!");
348  setEvtState(iRawCell, evt::SENDING);
349  }
350  return cell;
351 }
unsigned int nextRecoReadIndex()
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int rawCellIndex() const
Definition: FUShmRecoCell.h:23
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRecoCell * recoCell(unsigned int iCell)
void FUShmBuffer::releaseRawCell ( FUShmRawCell cell)

Definition at line 546 of file FUShmBuffer.cc.

References evf::FUShmRawCell::clear(), gather_cfg::cout, evf::evt::DISCARDING, evf::evt::EMPTY, evtState(), evf::FUShmRawCell::index(), postRawIndexToWrite(), postRawWrite(), evf::evt::RAWWRITING, segmentationMode_, setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), setEvtTimeStamp(), evf::utils::state, evf::evt::STOP, and evf::evt::USEDLS.

Referenced by discardRawCell().

546  {
547  evt::State_t state = evtState(cell->index());
548  if(!( state == evt::DISCARDING || state == evt::RAWWRITING ||
549  state== evt::EMPTY || state == evt::STOP ||
550  /*||state==evt::LUMISECTION*/
551  state == evt::USEDLS)) {
552  std::cout << "=================releaseRawCell state " << state << std::endl;
553  stringstream details;
554  details << "state==evt::DISCARDING||state==evt::RAWWRITING||"
555  << "state==evt::EMPTY||state==evt::STOP||state==evt::USEDLS"
556  << " assertion failed! Actual state is " << state << ", index = " << cell->index();
557  XCEPT_ASSERT( false, evf::Exception, details.str());
558  }
559  setEvtState(cell->index(), evt::EMPTY);
560  setEvtDiscard(cell->index(), 0);
561  setEvtNumber(cell->index(), 0xffffffff);
562  setEvtPrcId(cell->index(), 0);
563  setEvtTimeStamp(cell->index(), 0);
564  cell->clear();
565  postRawIndexToWrite(cell->index());
566  if (segmentationMode_)
567  shmdt(cell);
568  postRawWrite();
569 }
bool setEvtPrcId(unsigned int index, pid_t prcId)
evt::State_t evtState(unsigned int index)
bool setEvtNumber(unsigned int index, unsigned int evtNumber)
void postRawIndexToWrite(unsigned int index)
bool setEvtDiscard(unsigned int index, unsigned int discard, bool checkValue=false, bool lockShm=true)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
bool setEvtTimeStamp(unsigned int index, time_t timeStamp)
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
tuple cout
Definition: gather_cfg.py:121
bool FUShmBuffer::releaseSharedMemory ( )
static

Definition at line 1045 of file FUShmBuffer.cc.

References gather_cfg::cout, dqmCellShmKey(), FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), i, nDqmCells(), nRawCells(), nRecoCells(), AlCaHLTBitMon_ParallelJobs::p, rawCellShmKey(), recoCellShmKey(), sem_destroy(), sem_get(), semid(), shm_attach(), shm_destroy(), shm_get(), shm_nattch(), shmid(), evf::FUShmDqmCell::size(), evf::FUShmRecoCell::size(), evf::FUShmRawCell::size(), size(), and stor::utils::sleep().

Referenced by createShmBuffer(), and evf::FUResourceTable::~FUResourceTable().

1045  {
1046  // get bookkeeping shared memory segment
1047  int size = sizeof(unsigned int) * 7;
1048  int shmidd = shm_get(FUShmBuffer::getShmDescriptorKey(), size);
1049  if (shmidd < 0)
1050  return false;
1051  void* shmAddr = shm_attach(shmidd);
1052  if (0 == shmAddr)
1053  return false;
1054 
1055  unsigned int*p = (unsigned int*) shmAddr;
1056  bool segmentationMode = *p++;
1057  unsigned int nRawCells = *p++;
1058  unsigned int nRecoCells = *p++;
1059  unsigned int nDqmCells = *p++;
1060  unsigned int rawCellSize = *p++;
1061  unsigned int recoCellSize = *p++;
1062  unsigned int dqmCellSize = *p++;
1063  shmdt(shmAddr);
1064 
1065  // get the 'real' shared memory segment
1066  size = FUShmBuffer::size(segmentationMode, nRawCells, nRecoCells,
1067  nDqmCells, rawCellSize, recoCellSize, dqmCellSize);
1068  int shmid = shm_get(FUShmBuffer::getShmKey(), size);
1069  if (shmid < 0)
1070  return false;
1071  int semid = sem_get(FUShmBuffer::getSemKey(), 9);
1072  if (semid < 0)
1073  return false;
1074  shmAddr = shm_attach(shmid);
1075  if (0 == shmAddr)
1076  return false;
1077 
1078  int att = 0;
1079  for (; att < 10; att++) {
1080  if (shm_nattch(shmid) > 1) {
1081  cout << att << " FUShmBuffer::releaseSharedMemory(): nattch="
1082  << shm_nattch(shmid)
1083  << ", failed attempt to release shared memory." << endl;
1084  ::sleep(1);
1085  } else
1086  break;
1087  }
1088 
1089  if (att >= 10)
1090  return false;
1091 
1092  if (segmentationMode) {
1093  FUShmBuffer* buffer = new (shmAddr) FUShmBuffer(segmentationMode,
1094  nRawCells, nRecoCells, nDqmCells, rawCellSize, recoCellSize,
1095  dqmCellSize);
1096  int cellid;
1097  for (unsigned int i = 0; i < nRawCells; i++) {
1098  cellid = shm_get(buffer->rawCellShmKey(i),
1099  FUShmRawCell::size(rawCellSize));
1100  if ((shm_destroy(cellid) == -1))
1101  return false;
1102  }
1103  for (unsigned int i = 0; i < nRecoCells; i++) {
1104  cellid = shm_get(buffer->recoCellShmKey(i),
1105  FUShmRecoCell::size(recoCellSize));
1106  if ((shm_destroy(cellid) == -1))
1107  return false;
1108  }
1109  for (unsigned int i = 0; i < nDqmCells; i++) {
1110  cellid = shm_get(buffer->dqmCellShmKey(i),
1111  FUShmDqmCell::size(dqmCellSize));
1112  if ((shm_destroy(cellid) == -1))
1113  return false;
1114  }
1115  }
1116  shmdt(shmAddr);
1117  if (sem_destroy(semid) == -1)
1118  return false;
1119  if (shm_destroy(shmid) == -1)
1120  return false;
1121  if (shm_destroy(shmidd) == -1)
1122  return false;
1123 
1124  return true;
1125 }
key_t recoCellShmKey(unsigned int iCell)
int i
Definition: DBlmapReader.cc:9
unsigned int nRecoCells() const
Definition: FUShmBuffer.h:66
static int shm_nattch(int shmid)
static void * shm_attach(int shmid)
static unsigned int size(unsigned int payloadSize)
int shmid() const
Definition: FUShmBuffer.h:69
static key_t getShmDescriptorKey()
static int shm_get(key_t key, int size)
static unsigned int size(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
void sleep(Duration_t)
Definition: Utils.h:163
static unsigned int size(unsigned int payloadSize)
key_t rawCellShmKey(unsigned int iCell)
static int shm_destroy(int shmid)
unsigned int nRawCells() const
Definition: FUShmBuffer.h:65
key_t dqmCellShmKey(unsigned int iCell)
static key_t getShmKey()
static key_t getSemKey()
static int sem_get(key_t key, int nsem)
FUShmBuffer(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
Definition: FUShmBuffer.cc:53
static int sem_destroy(int semid)
tuple cout
Definition: gather_cfg.py:121
unsigned int nDqmCells() const
Definition: FUShmBuffer.h:67
static unsigned int size(unsigned int payloadSize)
Definition: FUShmDqmCell.cc:97
int semid() const
Definition: FUShmBuffer.h:70
bool FUShmBuffer::removeClientPrcId ( pid_t  prcId)

Definition at line 1602 of file FUShmBuffer.cc.

References clientPrcIdOffset_, lock(), nClients_, and unlock().

Referenced by scheduleRawEmptyCellForDiscard(), edm::FUShmOutputModule::unregisterFromShm(), and FUShmReader::~FUShmReader().

1602  {
1603  lock();
1604  pid_t *prcid = (pid_t*) ((unsigned long) this + clientPrcIdOffset_);
1605  unsigned int iClient(0);
1606  while (iClient < nClients_ && (*prcid) != prcId) {
1607  prcid++;
1608  iClient++;
1609  }
1610  if (iClient==nClients_) {
1611  unlock();
1612  return false;
1613  }
1614  //stringstream details;
1615  //details << "iClient!=nClients_ assertion failed! Actual iClient is "
1616  // << iClient;
1617  //XCEPT_ASSERT(iClient != nClients_, evf::Exception, details.str());
1618  pid_t* next = prcid;
1619  next++;
1620  while (iClient < nClients_ - 1) {
1621  *prcid = *next;
1622  prcid++;
1623  next++;
1624  iClient++;
1625  }
1626  nClients_--;
1627  unlock();
1628  return true;
1629 }
unsigned int clientPrcIdOffset_
Definition: FUShmBuffer.h:309
unsigned int nClients_
Definition: FUShmBuffer.h:307
void FUShmBuffer::reset ( bool  shm_detach)

Definition at line 201 of file FUShmBuffer.cc.

References dqmCell(), dqmReadLast_, dqmReadNext_, dqmReadOffset_, dqmWriteLast_, dqmWriteNext_, dqmWriteOffset_, evf::evt::EMPTY, evf::dqm::EMPTY, i, evf::FUShmRecoCell::initialize(), evf::FUShmDqmCell::initialize(), evf::FUShmRawCell::initialize(), nClients_, nDqmCells_, nRawCells_, nRecoCells_, rawCell(), rawReadLast_, rawReadNext_, rawReadOffset_, rawWriteLast_, rawWriteNext_, rawWriteOffset_, recoCell(), recoReadLast_, recoReadNext_, recoReadOffset_, recoWriteLast_, recoWriteNext_, recoWriteOffset_, segmentationMode_, sem_init(), sem_print(), setDqmState(), setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), and setEvtTimeStamp().

Referenced by initialize().

201  {
202  nClients_ = 0;
203 
204 
205  for (unsigned int i = 0; i < nRawCells_; i++) {
206  FUShmRawCell* cell = rawCell(i);
207  cell->initialize(i);
208  if (segmentationMode_ && shm_detach)
209  shmdt(cell);
210  }
211 
212  for (unsigned int i = 0; i < nRecoCells_; i++) {
213  FUShmRecoCell* cell = recoCell(i);
214  cell->initialize(i);
215  if (segmentationMode_ && shm_detach)
216  shmdt(cell);
217  }
218 
219  for (unsigned int i = 0; i < nDqmCells_; i++) {
220  FUShmDqmCell* cell = dqmCell(i);
221  cell->initialize(i);
222  if (segmentationMode_ && shm_detach)
223  shmdt(cell);
224  }
225 
226 
227  // setup ipc semaphores
228  sem_init(0, 1); // lock (binary)
229  sem_init(1, nRawCells_); // raw write semaphore
230  sem_init(2, 0); // raw read semaphore
231  sem_init(3, 1); // binary semaphore to schedule raw event for discard
232  sem_init(4, 0); // binary semaphore to discard raw event
233  sem_init(5, nRecoCells_);// reco write semaphore
234  sem_init(6, 0); // reco send (read) semaphore
235  sem_init(7, nDqmCells_); // dqm write semaphore
236  sem_init(8, 0); // dqm send (read) semaphore
237 
238  sem_print();
239 
240  unsigned int *iWrite, *iRead;
241 
242  rawWriteNext_ = 0;
243  rawWriteLast_ = 0;
244  rawReadNext_ = 0;
245  rawReadLast_ = 0;
246  iWrite = (unsigned int*) ((unsigned long) this + rawWriteOffset_);
247  iRead = (unsigned int*) ((unsigned long) this + rawReadOffset_);
248  for (unsigned int i = 0; i < nRawCells_; i++) {
249  *iWrite++ = i;
250  *iRead++ = 0xffffffff;
251  }
252 
253  recoWriteNext_ = 0;
254  recoWriteLast_ = 0;
255  recoReadNext_ = 0;
256  recoReadLast_ = 0;
257  iWrite = (unsigned int*) ((unsigned long) this + recoWriteOffset_);
258  iRead = (unsigned int*) ((unsigned long) this + recoReadOffset_);
259  for (unsigned int i = 0; i < nRecoCells_; i++) {
260  *iWrite++ = i;
261  *iRead++ = 0xffffffff;
262  }
263 
264  dqmWriteNext_ = 0;
265  dqmWriteLast_ = 0;
266  dqmReadNext_ = 0;
267  dqmReadLast_ = 0;
268  iWrite = (unsigned int*) ((unsigned long) this + dqmWriteOffset_);
269  iRead = (unsigned int*) ((unsigned long) this + dqmReadOffset_);
270  for (unsigned int i = 0; i < nDqmCells_; i++) {
271  *iWrite++ = i;
272  *iRead++ = 0xffffffff;
273  }
274 
275  for (unsigned int i = 0; i < nRawCells_; i++) {
277  setEvtDiscard(i, 0);
278  setEvtNumber(i, 0xffffffff);
279  setEvtPrcId(i, 0);
280  setEvtTimeStamp(i, 0);
281  }
282 
283  for (unsigned int i = 0; i < nDqmCells_; i++)
285 }
int i
Definition: DBlmapReader.cc:9
void initialize(unsigned int index)
bool setEvtPrcId(unsigned int index, pid_t prcId)
unsigned int dqmWriteNext_
Definition: FUShmBuffer.h:293
unsigned int rawReadOffset_
Definition: FUShmBuffer.h:283
void initialize(unsigned int index)
Definition: FUShmDqmCell.cc:46
unsigned int dqmReadLast_
Definition: FUShmBuffer.h:297
unsigned int dqmReadOffset_
Definition: FUShmBuffer.h:298
unsigned int dqmWriteLast_
Definition: FUShmBuffer.h:294
unsigned int nRecoCells_
Definition: FUShmBuffer.h:318
unsigned int dqmWriteOffset_
Definition: FUShmBuffer.h:295
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int recoWriteLast_
Definition: FUShmBuffer.h:287
unsigned int recoWriteNext_
Definition: FUShmBuffer.h:286
bool setEvtNumber(unsigned int index, unsigned int evtNumber)
void initialize(unsigned int index)
Definition: FUShmRawCell.cc:73
FUShmRawCell * rawCell(unsigned int iCell)
unsigned int recoReadOffset_
Definition: FUShmBuffer.h:291
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
unsigned int rawWriteNext_
Definition: FUShmBuffer.h:278
bool setEvtDiscard(unsigned int index, unsigned int discard, bool checkValue=false, bool lockShm=true)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRecoCell * recoCell(unsigned int iCell)
unsigned int recoReadLast_
Definition: FUShmBuffer.h:290
unsigned int rawReadNext_
Definition: FUShmBuffer.h:281
unsigned int rawReadLast_
Definition: FUShmBuffer.h:282
unsigned int rawWriteOffset_
Definition: FUShmBuffer.h:280
bool setEvtTimeStamp(unsigned int index, time_t timeStamp)
unsigned int rawWriteLast_
Definition: FUShmBuffer.h:279
unsigned int dqmReadNext_
Definition: FUShmBuffer.h:296
void sem_init(int isem, int value)
unsigned int recoWriteOffset_
Definition: FUShmBuffer.h:288
unsigned int nClients_
Definition: FUShmBuffer.h:307
unsigned int recoReadNext_
Definition: FUShmBuffer.h:289
bool setDqmState(unsigned int index, dqm::State_t state)
FUShmDqmCell * dqmCell(unsigned int iCell)
void FUShmBuffer::scheduleRawCellForDiscard ( unsigned int  iCell)

Definition at line 454 of file FUShmBuffer.cc.

References evf::evt::EMPTY, evtState(), evf::evt::LUMISECTION, postRawDiscard(), postRawDiscarded(), evf::evt::PROCESSED, evf::evt::PROCESSING, rawCellReadyForDiscard(), rawDiscardIndex_, evf::evt::RECOWRITTEN, evf::evt::SENT, setEvtState(), evf::utils::state, evf::evt::STOP, evf::evt::USEDLS, and waitRawDiscard().

Referenced by discardRecoCell(), FUShmReader::fillRawData(), and evf::FUShmClient::readNext().

454  {
455  waitRawDiscard();
456  if (rawCellReadyForDiscard(iCell)) {
457  rawDiscardIndex_ = iCell;
458  evt::State_t state = evtState(iCell);
459  if(!(state == evt::PROCESSING || state == evt::SENT ||
460  state == evt::EMPTY || state == evt::STOP ||
461  state == evt::LUMISECTION || state == evt::RECOWRITTEN)) {
462  stringstream details;
463  details << "state==evt::PROCESSING||state==evt::SENT||state==evt::EMPTY||"
464  <<"state==evt::STOP||state==evt::LUMISECTION||state==evt::RECOWRITTEN assertion failed! Actual state is "
465  << state << ", iCell = " << iCell;
466  XCEPT_ASSERT( false,evf::Exception,details.str());
467  }
468  if (state == evt::PROCESSING)
469  setEvtState(iCell, evt::PROCESSED);
470  if (state == evt::LUMISECTION)
471  setEvtState(iCell, evt::USEDLS);
473  } else
474  postRawDiscard();
475 }
void waitRawDiscard()
Definition: FUShmBuffer.h:256
evt::State_t evtState(unsigned int index)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
bool rawCellReadyForDiscard(unsigned int index)
void postRawDiscard()
Definition: FUShmBuffer.h:257
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
char state
Definition: procUtils.cc:75
void postRawDiscarded()
Definition: FUShmBuffer.h:259
void FUShmBuffer::scheduleRawCellForDiscardServerSide ( unsigned int  iCell)

Definition at line 478 of file FUShmBuffer.cc.

References evf::evt::EMPTY, evtState(), evf::evt::LUMISECTION, postRawDiscard(), postRawDiscarded(), evf::evt::PROCESSED, rawCellReadyForDiscard(), rawDiscardIndex_, setEvtState(), evf::utils::state, evf::evt::STOP, evf::evt::USEDLS, and waitRawDiscard().

478  {
479  waitRawDiscard();
480  if (rawCellReadyForDiscard(iCell)) {
481  rawDiscardIndex_ = iCell;
482  evt::State_t state = evtState(iCell);
483  // UPDATE: aspataru
484  if (state != evt::LUMISECTION && state != evt::EMPTY
485  && state != evt::USEDLS && state != evt::STOP)
486  setEvtState(iCell, evt::PROCESSED);
487  if (state == evt::LUMISECTION)
488  setEvtState(iCell, evt::USEDLS);
490  } else
491  postRawDiscard();
492 }
void waitRawDiscard()
Definition: FUShmBuffer.h:256
evt::State_t evtState(unsigned int index)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
bool rawCellReadyForDiscard(unsigned int index)
void postRawDiscard()
Definition: FUShmBuffer.h:257
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
char state
Definition: procUtils.cc:75
void postRawDiscarded()
Definition: FUShmBuffer.h:259
void FUShmBuffer::scheduleRawEmptyCellForDiscard ( )

Definition at line 638 of file FUShmBuffer.cc.

References evf::FUShmRawCell::index(), postRawDiscarded(), rawCellToWrite(), rawDiscardIndex_, evf::FUShmRawCell::setEventTypeStopper(), setEvtNumber(), setEvtPrcId(), setEvtState(), setEvtTimeStamp(), and evf::evt::STOP.

Referenced by FUShmReader::fillRawData().

638  {
639  FUShmRawCell* cell = rawCellToWrite();
640  if (cell == 0)
641  return;
642  rawDiscardIndex_ = cell->index();
643  setEvtState(cell->index(), evt::STOP);
644  cell->setEventTypeStopper();
645  setEvtNumber(cell->index(), 0xffffffff);
646  setEvtPrcId(cell->index(), 0);
647  setEvtTimeStamp(cell->index(), 0);
649 }
bool setEvtPrcId(unsigned int index, pid_t prcId)
bool setEvtNumber(unsigned int index, unsigned int evtNumber)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
FUShmRawCell * rawCellToWrite()
Definition: FUShmBuffer.cc:298
bool setEvtTimeStamp(unsigned int index, time_t timeStamp)
unsigned int index() const
Definition: FUShmRawCell.h:25
void postRawDiscarded()
Definition: FUShmBuffer.h:259
void setEventTypeStopper()
Definition: FUShmRawCell.h:65
bool FUShmBuffer::scheduleRawEmptyCellForDiscard ( FUShmRawCell cell,
bool &  pidstatus 
)

Definition at line 652 of file FUShmBuffer.cc.

References evf::FUShmRawCell::index(), postRawDiscard(), postRawDiscarded(), rawCellReadyForDiscard(), rawDiscardIndex_, removeClientPrcId(), segmentationMode_, and waitRawDiscard().

652  {
653  waitRawDiscard();
654  if (rawCellReadyForDiscard(cell->index())) {
655  rawDiscardIndex_ = cell->index();
656  // as this function is called by the reader, the state and type should
657  // already be correct
658  // setEvtState(cell->index(),evt::STOP);
659  // cell->setEventType(evt::STOPPER);
660  // setEvtNumber(cell->index(),0xffffffff);
661  // setEvtPrcId(cell->index(),0);
662  // setEvtTimeStamp(cell->index(),0);
663  pidstatus = removeClientPrcId(getpid());
664  if (segmentationMode_)
665  shmdt(cell);
667  return true;
668  } else {
669  postRawDiscard();
670  return false;
671  }
672 }
bool removeClientPrcId(pid_t prcId)
void waitRawDiscard()
Definition: FUShmBuffer.h:256
bool rawCellReadyForDiscard(unsigned int index)
void postRawDiscard()
Definition: FUShmBuffer.h:257
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
unsigned int index() const
Definition: FUShmRawCell.h:25
void postRawDiscarded()
Definition: FUShmBuffer.h:259
void FUShmBuffer::scheduleRawEmptyCellForDiscardServerSide ( FUShmRawCell cell)

Definition at line 675 of file FUShmBuffer.cc.

References evf::FUShmRawCell::index(), postRawDiscard(), postRawDiscarded(), rawCellReadyForDiscard(), rawDiscardIndex_, and segmentationMode_.

675  {
676  // waitRawDiscard();
677  if (rawCellReadyForDiscard(cell->index())) {
678  rawDiscardIndex_ = cell->index();
679  // setEvtState(cell->index(),evt::STOP);
680  // cell->setEventType(evt::STOPPER);
681  // setEvtNumber(cell->index(),0xffffffff);
682  // setEvtPrcId(cell->index(),0);
683  // setEvtTimeStamp(cell->index(),0);
684  // removeClientPrcId(getpid());
685  if (segmentationMode_)
686  shmdt(cell);
688  } else
689  postRawDiscard();
690 }
bool rawCellReadyForDiscard(unsigned int index)
void postRawDiscard()
Definition: FUShmBuffer.h:257
unsigned int rawDiscardIndex_
Definition: FUShmBuffer.h:284
unsigned int index() const
Definition: FUShmRawCell.h:25
void postRawDiscarded()
Definition: FUShmBuffer.h:259
int FUShmBuffer::sem_create ( key_t  key,
int  nsem 
)
static

Definition at line 1240 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by createShmBuffer().

1240  {
1241  int semid = semget(key, nsem, IPC_CREAT | 0666);
1242  if (semid < 0) {
1243  int err = errno;
1244  cout << "FUShmBuffer::sem_create(key=" << key << ",nsem=" << nsem
1245  << ") failed: " << strerror(err) << endl;
1246  }
1247  return semid;
1248 }
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
int FUShmBuffer::sem_destroy ( int  semid)
static

Definition at line 1262 of file FUShmBuffer.cc.

References gather_cfg::cout, and query::result.

Referenced by releaseSharedMemory().

1262  {
1263  int result = semctl(semid, 0, IPC_RMID);
1264  if (result == -1)
1265  cout << "FUShmBuffer::sem_destroy(semid=" << semid << ") failed."
1266  << endl;
1267  return result;
1268 }
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
int FUShmBuffer::sem_get ( key_t  key,
int  nsem 
)
static

Definition at line 1251 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by getShmBuffer(), and releaseSharedMemory().

1251  {
1252  int semid = semget(key, nsem, 0666);
1253  if (semid < 0) {
1254  int err = errno;
1255  cout << "FUShmBuffer::sem_get(key=" << key << ",nsem=" << nsem
1256  << ") failed: " << strerror(err) << endl;
1257  }
1258  return semid;
1259 }
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
void FUShmBuffer::sem_init ( int  isem,
int  value 
)
private

Definition at line 1768 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by reset().

1768  {
1769  if (semctl(semid(), isem, SETVAL, value) < 0) {
1770  cout << "FUShmBuffer: FATAL ERROR in semaphore initialization." << endl;
1771  }
1772 }
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
void FUShmBuffer::sem_post ( int  isem)
private

Definition at line 1788 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by postDqmRead(), postDqmWrite(), postRawDiscard(), postRawDiscarded(), postRawRead(), postRawWrite(), postRecoRead(), postRecoWrite(), and unlock().

1788  {
1789  struct sembuf sops[1];
1790  sops[0].sem_num = isem;
1791  sops[0].sem_op = 1;
1792  sops[0].sem_flg = 0;
1793  if (semop(semid(), sops, 1) == -1) {
1794  cout << "FUShmBuffer: ERROR in semaphore operation sem_post." << endl;
1795  }
1796 }
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
void FUShmBuffer::sem_print ( )

Definition at line 852 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by FUShmReader::fillRawData(), and reset().

852  {
853  cout << "--> current sem values:" << endl << " lock=" << semctl(semid(), 0,
854  GETVAL) << endl << " wraw=" << semctl(semid(), 1, GETVAL)
855  << " rraw=" << semctl(semid(), 2, GETVAL) << endl << " wdsc="
856  << semctl(semid(), 3, GETVAL) << " rdsc=" << semctl(semid(), 4,
857  GETVAL) << endl << " wrec=" << semctl(semid(), 5, GETVAL)
858  << " rrec=" << semctl(semid(), 6, GETVAL) << endl << " wdqm="
859  << semctl(semid(), 7, GETVAL) << " rdqm=" << semctl(semid(), 8,
860  GETVAL) << endl;
861 }
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
std::string FUShmBuffer::sem_print_s ( )

Definition at line 863 of file FUShmBuffer.cc.

References semid().

863  {
864  ostringstream ostr;
865  ostr << "--> current sem values:" << endl << " lock=" << semctl(semid(), 0,
866  GETVAL) << endl << " wraw=" << semctl(semid(), 1, GETVAL)
867  << " rraw=" << semctl(semid(), 2, GETVAL) << endl << " wdsc="
868  << semctl(semid(), 3, GETVAL) << " rdsc=" << semctl(semid(), 4,
869  GETVAL) << endl << " wrec=" << semctl(semid(), 5, GETVAL)
870  << " rrec=" << semctl(semid(), 6, GETVAL) << endl << " wdqm="
871  << semctl(semid(), 7, GETVAL) << " rdqm=" << semctl(semid(), 8,
872  GETVAL) << endl;
873  return ostr.str();
874 
875 }
int semid() const
Definition: FUShmBuffer.h:70
int FUShmBuffer::sem_wait ( int  isem)
private

Definition at line 1775 of file FUShmBuffer.cc.

References gather_cfg::cout, and semid().

Referenced by lock(), waitDqmRead(), waitDqmWrite(), waitRawDiscard(), waitRawDiscarded(), waitRawRead(), waitRawWrite(), waitRecoRead(), and waitRecoWrite().

1775  {
1776  struct sembuf sops[1];
1777  sops[0].sem_num = isem;
1778  sops[0].sem_op = -1;
1779  sops[0].sem_flg = 0;
1780  if (semop(semid(), sops, 1) == -1) {
1781  cout << "FUShmBuffer: ERROR in semaphore operation sem_wait." << endl;
1782  return -1;
1783  }
1784  return 0;
1785 }
tuple cout
Definition: gather_cfg.py:121
int semid() const
Definition: FUShmBuffer.h:70
int evf::FUShmBuffer::semid ( ) const
inline
bool FUShmBuffer::setClientPrcId ( pid_t  prcId)
private

Definition at line 1578 of file FUShmBuffer.cc.

References clientPrcIdOffset_, i, lock(), nClients_, nClientsMax_, and unlock().

Referenced by getShmBuffer().

1578  {
1579  lock();
1580  if(!(nClients_ < nClientsMax_)) {
1581  stringstream details;
1582  details << "nClients_<nClientsMax_ assertion failed! Actual nClients is "
1583  << nClients_ << " and nClientsMax is " << nClientsMax_;
1584  unlock();
1585  XCEPT_ASSERT(false, evf::Exception, details.str());
1586  }
1587  pid_t *prcid = (pid_t*) ((unsigned long) this + clientPrcIdOffset_);
1588  for (unsigned int i = 0; i < nClients_; i++) {
1589  if ((*prcid) == prcId) {
1590  unlock();
1591  return false;
1592  }
1593  prcid++;
1594  }
1595  nClients_++;
1596  *prcid = prcId;
1597  unlock();
1598  return true;
1599 }
unsigned int clientPrcIdOffset_
Definition: FUShmBuffer.h:309
int i
Definition: DBlmapReader.cc:9
unsigned int nClientsMax_
Definition: FUShmBuffer.h:308
unsigned int nClients_
Definition: FUShmBuffer.h:307
bool FUShmBuffer::setDqmState ( unsigned int  index,
dqm::State_t  state 
)

Definition at line 1474 of file FUShmBuffer.cc.

References dqmStateOffset_, getHLTprescales::index, lock(), nDqmCells_, evf::utils::state, and unlock().

Referenced by discardDqmCell(), dqmCellToRead(), finishReadingDqmCell(), reset(), and writeDqmEventData().

1474  {
1475  if(!(index < nDqmCells_)) {
1476  stringstream details;
1477  details << "index<nDqmCells_ assertion failed! Actual index is " << index;
1478  XCEPT_ASSERT(false, evf::Exception, details.str());
1479  }
1480  dqm::State_t *pstate = (dqm::State_t*) ((unsigned long) this
1481  + dqmStateOffset_);
1482  pstate += index;
1483  lock();
1484  *pstate = state;
1485  unlock();
1486  return true;
1487 }
unsigned int dqmStateOffset_
Definition: FUShmBuffer.h:305
unsigned int nDqmCells_
Definition: FUShmBuffer.h:325
char state
Definition: procUtils.cc:75
bool FUShmBuffer::setEvtDiscard ( unsigned int  index,
unsigned int  discard,
bool  checkValue = false,
bool  lockShm = true 
)

Definition at line 1490 of file FUShmBuffer.cc.

References evtDiscardOffset_, getHLTprescales::index, lock(), nRawCells_, and unlock().

Referenced by rawCellToWrite(), releaseRawCell(), reset(), and writeErrorEventData().

1490  {
1491  if(!(index < nRawCells_)) {
1492  stringstream details;
1493  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1494  //unlock here as it will skip external unlock
1495  if (!lockShm) unlock();
1496  XCEPT_ASSERT(false, evf::Exception, details.str());
1497  }
1498  unsigned int *pcount = (unsigned int*) ((unsigned long) this
1499  + evtDiscardOffset_);
1500  pcount += index;
1501  if (lockShm) lock();
1502  if (checkValue) {
1503  if (*pcount < discard)
1504  *pcount = discard;
1505  } else
1506  *pcount = discard;
1507  if (lockShm) unlock();
1508  return true;
1509 }
unsigned int evtDiscardOffset_
Definition: FUShmBuffer.h:301
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
bool FUShmBuffer::setEvtNumber ( unsigned int  index,
unsigned int  evtNumber 
)
private

Definition at line 1532 of file FUShmBuffer.cc.

References evtNumber(), evtNumberOffset_, getHLTprescales::index, lock(), nRawCells_, and unlock().

Referenced by finishWritingRawCell(), releaseRawCell(), reset(), scheduleRawEmptyCellForDiscard(), and writeRawLumiSectionEvent().

1532  {
1533  if(!(index < nRawCells_)) {
1534  stringstream details;
1535  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1536  XCEPT_ASSERT(false, evf::Exception, details.str());
1537  }
1538  unsigned int *pevt = (unsigned int*) ((unsigned long) this
1539  + evtNumberOffset_);
1540  pevt += index;
1541  lock();
1542  *pevt = evtNumber;
1543  unlock();
1544  return true;
1545 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtNumberOffset_
Definition: FUShmBuffer.h:302
unsigned int evtNumber(unsigned int index)
bool FUShmBuffer::setEvtPrcId ( unsigned int  index,
pid_t  prcId 
)

Definition at line 1548 of file FUShmBuffer.cc.

References evtPrcIdOffset_, getHLTprescales::index, lock(), nRawCells_, and unlock().

Referenced by rawCellToRead(), releaseRawCell(), reset(), and scheduleRawEmptyCellForDiscard().

1548  {
1549  if(!(index < nRawCells_)) {
1550  stringstream details;
1551  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1552  XCEPT_ASSERT(false, evf::Exception, details.str());
1553  }
1554  pid_t* prcid = (pid_t*) ((unsigned long) this + evtPrcIdOffset_);
1555  prcid += index;
1556  lock();
1557  *prcid = prcId;
1558  unlock();
1559  return true;
1560 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtPrcIdOffset_
Definition: FUShmBuffer.h:303
bool FUShmBuffer::setEvtState ( unsigned int  index,
evt::State_t  state,
bool  lockShm = true 
)

Definition at line 1456 of file FUShmBuffer.cc.

References evtStateOffset_, getHLTprescales::index, lock(), nRawCells_, evf::utils::state, and unlock().

Referenced by finishReadingRawCell(), finishReadingRecoCell(), finishWritingRawCell(), rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), recoCellToRead(), releaseRawCell(), reset(), scheduleRawCellForDiscard(), scheduleRawCellForDiscardServerSide(), scheduleRawEmptyCellForDiscard(), writeErrorEventData(), writeRawEmptyEvent(), writeRawLumiSectionEvent(), and writeRecoEventData().

1456  {
1457  if(!(index < nRawCells_)) {
1458  stringstream details;
1459  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1460  //unlock here as it will skip external unlock
1461  if (!lockShm) unlock();
1462  XCEPT_ASSERT(false, evf::Exception, details.str());
1463  }
1464  evt::State_t *pstate = (evt::State_t*) ((unsigned long) this
1465  + evtStateOffset_);
1466  pstate += index;
1467  if (lockShm) lock();
1468  *pstate = state;
1469  if (lockShm) unlock();
1470  return true;
1471 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
unsigned int evtStateOffset_
Definition: FUShmBuffer.h:300
char state
Definition: procUtils.cc:75
bool FUShmBuffer::setEvtTimeStamp ( unsigned int  index,
time_t  timeStamp 
)
private

Definition at line 1563 of file FUShmBuffer.cc.

References evtTimeStampOffset_, getHLTprescales::index, lock(), nRawCells_, stor::utils::timeStamp(), and unlock().

Referenced by finishReadingRawCell(), releaseRawCell(), reset(), and scheduleRawEmptyCellForDiscard().

1563  {
1564  if(!(index < nRawCells_)) {
1565  stringstream details;
1566  details << "index<nRawCells_ assertion failed! Actual index is " << index;
1567  XCEPT_ASSERT(false, evf::Exception, details.str());
1568  }
1569  time_t *ptstmp = (time_t*) ((unsigned long) this + evtTimeStampOffset_);
1570  ptstmp += index;
1571  lock();
1572  *ptstmp = timeStamp;
1573  unlock();
1574  return true;
1575 }
unsigned int nRawCells_
Definition: FUShmBuffer.h:311
std::string timeStamp(TimePoint_t)
Definition: Utils.cc:23
unsigned int evtTimeStampOffset_
Definition: FUShmBuffer.h:304
void * FUShmBuffer::shm_attach ( int  shmid)
static

Definition at line 1212 of file FUShmBuffer.cc.

References gather_cfg::cout, NULL, and query::result.

Referenced by createShmBuffer(), dqmCell(), getShmBuffer(), initialize(), rawCell(), recoCell(), and releaseSharedMemory().

1212  {
1213  void* result = shmat(shmid, NULL, 0);
1214  if (0 == result) {
1215  int err = errno;
1216  cout << "FUShmBuffer::shm_attach(" << shmid << ") failed: "
1217  << strerror(err) << endl;
1218  }
1219  return result;
1220 }
int shmid() const
Definition: FUShmBuffer.h:69
#define NULL
Definition: scimark2.h:8
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
int FUShmBuffer::shm_create ( key_t  key,
int  size 
)
static

Definition at line 1178 of file FUShmBuffer.cc.

References gather_cfg::cout, and shmid().

Referenced by createShmBuffer(), and initialize().

1178  {
1179  // first check and possibly remove existing segment with same id
1180  int shmid = shmget(key, 1, 0644);//using minimal size any segment with key "key" will be connected
1181  if (shmid != -1) {
1182  // an existing segment was found, remove it
1183  shmid_ds shmstat;
1184  shmctl(shmid, IPC_STAT, &shmstat);
1185  cout << "FUShmBuffer found segment for key 0x " << hex << key << dec
1186  << " created by process " << shmstat.shm_cpid << " owned by "
1187  << shmstat.shm_perm.uid << " permissions " << hex
1188  << shmstat.shm_perm.mode << dec << endl;
1189  shmctl(shmid, IPC_RMID, &shmstat);
1190  }
1191  shmid = shmget(key, size, IPC_CREAT | 0644);
1192  if (shmid == -1) {
1193  int err = errno;
1194  cout << "FUShmBuffer::shm_create(" << key << "," << size
1195  << ") failed: " << strerror(err) << endl;
1196  }
1197  return shmid;
1198 }
int shmid() const
Definition: FUShmBuffer.h:69
static unsigned int size(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
int FUShmBuffer::shm_destroy ( int  shmid)
static

Definition at line 1230 of file FUShmBuffer.cc.

References gather_cfg::cout, and query::result.

Referenced by releaseSharedMemory().

1230  {
1231  shmid_ds shmstat;
1232  int result = shmctl(shmid, IPC_RMID, &shmstat);
1233  if (result == -1)
1234  cout << "FUShmBuffer::shm_destroy(shmid=" << shmid << ") failed."
1235  << endl;
1236  return result;
1237 }
int shmid() const
Definition: FUShmBuffer.h:69
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
int FUShmBuffer::shm_get ( key_t  key,
int  size 
)
static

Definition at line 1201 of file FUShmBuffer.cc.

References gather_cfg::cout, and shmid().

Referenced by dqmCell(), getShmBuffer(), rawCell(), recoCell(), and releaseSharedMemory().

1201  {
1202  int shmid = shmget(key, size, 0644);
1203  if (shmid == -1) {
1204  int err = errno;
1205  cout << "FUShmBuffer::shm_get(" << key << "," << size << ") failed: "
1206  << strerror(err) << endl;
1207  }
1208  return shmid;
1209 }
int shmid() const
Definition: FUShmBuffer.h:69
static unsigned int size(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
int FUShmBuffer::shm_nattch ( int  shmid)
static

Definition at line 1223 of file FUShmBuffer.cc.

Referenced by createShmBuffer(), evf::FUResourceTable::discardNoReschedule(), getShmBuffer(), and releaseSharedMemory().

1223  {
1224  shmid_ds shmstat;
1225  shmctl(shmid, IPC_STAT, &shmstat);
1226  return shmstat.shm_nattch;
1227 }
int shmid() const
Definition: FUShmBuffer.h:69
int evf::FUShmBuffer::shmid ( ) const
inline
key_t FUShmBuffer::shmKey ( unsigned int  iCell,
unsigned int  offset 
)
private

Definition at line 1724 of file FUShmBuffer.cc.

References gather_cfg::cout, i, evf::evtn::offset(), and segmentationMode_.

Referenced by dqmCellShmKey(), rawCellShmKey(), and recoCellShmKey().

1724  {
1725  if (!segmentationMode_) {
1726  cout << "FUShmBuffer::shmKey() ERROR: only valid in segmentationMode!"
1727  << endl;
1728  return -1;
1729  }
1730  key_t* addr = (key_t*) ((unsigned long) this + offset);
1731  for (unsigned int i = 0; i < iCell; i++)
1732  ++addr;
1733  return *addr;
1734 }
int i
Definition: DBlmapReader.cc:9
unsigned int offset(bool)
tuple cout
Definition: gather_cfg.py:121
unsigned int FUShmBuffer::size ( bool  segmentationMode,
unsigned int  nRawCells,
unsigned int  nRecoCells,
unsigned int  nDqmCells,
unsigned int  rawCellSize,
unsigned int  recoCellSize,
unsigned int  dqmCellSize 
)
static

Definition at line 1128 of file FUShmBuffer.cc.

References FUShmBuffer(), nDqmCells(), evf::evtn::offset(), query::result, evf::FUShmDqmCell::size(), evf::FUShmRecoCell::size(), and evf::FUShmRawCell::size().

Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().

1131  {
1132  unsigned int offset = sizeof(FUShmBuffer) + sizeof(unsigned int) * 4
1133  * nRawCells + sizeof(evt::State_t) * nRawCells
1134  + sizeof(dqm::State_t) * nDqmCells;
1135 
1136  unsigned int rawCellTotalSize = FUShmRawCell::size(rawCellSize);
1137  unsigned int recoCellTotalSize = FUShmRecoCell::size(recoCellSize);
1138  unsigned int dqmCellTotalSize = FUShmDqmCell::size(dqmCellSize);
1139 
1140  unsigned int realSize = (segmentationMode) ? offset + sizeof(key_t)
1141  * (nRawCells + nRecoCells + nDqmCells) : offset + rawCellTotalSize
1142  * nRawCells + recoCellTotalSize * nRecoCells + dqmCellTotalSize
1143  * nDqmCells;
1144 
1145  unsigned int result = realSize / 0x10 * 0x10 + (realSize % 0x10 > 0) * 0x10;
1146 
1147  return result;
1148 }
unsigned int nRecoCells() const
Definition: FUShmBuffer.h:66
static unsigned int size(unsigned int payloadSize)
static unsigned int size(unsigned int payloadSize)
tuple result
Definition: query.py:137
unsigned int nRawCells() const
Definition: FUShmBuffer.h:65
unsigned int offset(bool)
FUShmBuffer(bool segmentationMode, unsigned int nRawCells, unsigned int nRecoCells, unsigned int nDqmCells, unsigned int rawCellSize, unsigned int recoCellSize, unsigned int dqmCellSize)
Definition: FUShmBuffer.cc:53
unsigned int nDqmCells() const
Definition: FUShmBuffer.h:67
static unsigned int size(unsigned int payloadSize)
Definition: FUShmDqmCell.cc:97
void evf::FUShmBuffer::unlock ( void  )
inline
void evf::FUShmBuffer::waitDqmRead ( )
inlineprivate

Definition at line 266 of file FUShmBuffer.h.

References sem_wait().

Referenced by dqmCellToRead().

266 { sem_wait(8); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitDqmWrite ( )
inlineprivate

Definition at line 264 of file FUShmBuffer.h.

References sem_wait().

Referenced by writeDqmEmptyEvent(), and writeDqmEventData().

264 { sem_wait(7); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitRawDiscard ( )
inlineprivate

Definition at line 256 of file FUShmBuffer.h.

References sem_wait().

Referenced by scheduleRawCellForDiscard(), scheduleRawCellForDiscardServerSide(), and scheduleRawEmptyCellForDiscard().

256 { sem_wait(3); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitRawDiscarded ( )
inlineprivate

Definition at line 258 of file FUShmBuffer.h.

References sem_wait().

Referenced by rawCellToDiscard().

258 { sem_wait(4); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitRawRead ( )
inlineprivate

Definition at line 254 of file FUShmBuffer.h.

References sem_wait().

Referenced by rawCellToRead().

254 { sem_wait(2); }
int sem_wait(int isem)
int evf::FUShmBuffer::waitRawWrite ( )
inlineprivate

Definition at line 252 of file FUShmBuffer.h.

References sem_wait().

Referenced by rawCellToWrite().

252 { return sem_wait(1); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitRecoRead ( )
inlineprivate

Definition at line 262 of file FUShmBuffer.h.

References sem_wait().

Referenced by recoCellToRead().

262 { sem_wait(6); }
int sem_wait(int isem)
void evf::FUShmBuffer::waitRecoWrite ( )
inlineprivate

Definition at line 260 of file FUShmBuffer.h.

References sem_wait().

Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().

260 { sem_wait(5); }
int sem_wait(int isem)
void FUShmBuffer::writeDqmEmptyEvent ( )

Definition at line 626 of file FUShmBuffer.cc.

References evf::FUShmDqmCell::clear(), dqmCell(), nextDqmWriteIndex(), postDqmIndexToRead(), postDqmRead(), segmentationMode_, and waitDqmWrite().

626  {
627  waitDqmWrite();
628  unsigned int iCell = nextDqmWriteIndex();
629  FUShmDqmCell* cell = dqmCell(iCell);
630  cell->clear();
631  postDqmIndexToRead(iCell);
632  if (segmentationMode_)
633  shmdt(cell);
634  postDqmRead();
635 }
void postDqmIndexToRead(unsigned int index)
unsigned int nextDqmWriteIndex()
FUShmDqmCell * dqmCell(unsigned int iCell)
bool FUShmBuffer::writeDqmEventData ( unsigned int  runNumber,
unsigned int  evtAtUpdate,
unsigned int  folderId,
unsigned int  fuProcessId,
unsigned int  fuGuid,
unsigned char *  data,
unsigned int  dataSize 
)

Definition at line 820 of file FUShmBuffer.cc.

References gather_cfg::cout, dqmCell(), dqmCellPayloadSize_, dqmState(), evf::dqm::EMPTY, nextDqmWriteIndex(), postDqmIndexToRead(), postDqmRead(), segmentationMode_, setDqmState(), evf::utils::state, waitDqmWrite(), evf::FUShmDqmCell::writeData(), evf::dqm::WRITING, and evf::dqm::WRITTEN.

Referenced by FUShmDQMOutputService::writeShmDQMData().

823  {
824  if (dataSize > dqmCellPayloadSize_) {
825  cout << "FUShmBuffer::writeDqmEventData() ERROR: buffer overflow."
826  << endl;
827  return false;
828  }
829 
830  waitDqmWrite();
831  unsigned int iCell = nextDqmWriteIndex();
832  FUShmDqmCell* cell = dqmCell(iCell);
833  dqm::State_t state = dqmState(iCell);
834  if (!(state == dqm::EMPTY)) {
835  stringstream details;
836  details << "state==dqm::EMPTY assertion failed! Actual state is " << state
837  << ", iCell = " << iCell;
838  XCEPT_ASSERT(false, evf::Exception, details.str());
839  }
840  setDqmState(iCell, dqm::WRITING);
841  cell->writeData(runNumber, evtAtUpdate, folderId, fuProcessId, fuGuid,
842  data, dataSize);
843  setDqmState(iCell, dqm::WRITTEN);
844  postDqmIndexToRead(iCell);
845  if (segmentationMode_)
846  shmdt(cell);
847  postDqmRead();
848  return true;
849 }
void postDqmIndexToRead(unsigned int index)
unsigned int dqmCellPayloadSize_
Definition: FUShmBuffer.h:326
unsigned int nextDqmWriteIndex()
dqm::State_t dqmState(unsigned int index)
char state
Definition: procUtils.cc:75
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void writeData(unsigned int runNumber, unsigned int evtAtUpdate, unsigned int folderId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
Definition: FUShmDqmCell.cc:69
tuple cout
Definition: gather_cfg.py:121
bool setDqmState(unsigned int index, dqm::State_t state)
FUShmDqmCell * dqmCell(unsigned int iCell)
bool FUShmBuffer::writeErrorEventData ( unsigned int  runNumber,
unsigned int  fuProcessId,
unsigned int  iRawCell,
bool  checkValue 
)

Definition at line 746 of file FUShmBuffer.cc.

References data, evf::FUShmRawCell::eventSize(), evf::FUShmRawCell::evtNumber(), evf::FUShmRawCell::fedAddr(), evf::FUShmRawCell::fedSize(), evf::evtn::getlbn(), i, lock(), FEDNumbering::MINTriggerGTPFEDID, nextRecoWriteIndex(), evf::FUShmRawCell::payloadAddr(), pos, postRecoIndexToRead(), postRecoRead(), rawCell(), L1Trigger_dataformats::reco, recoCell(), evf::evt::RECOWRITING, evf::evt::RECOWRITTEN, segmentationMode_, setEvtDiscard(), setEvtState(), unlock(), waitRecoWrite(), and evf::FUShmRecoCell::writeErrorEvent().

Referenced by FUShmReader::~FUShmReader().

747  {
748  FUShmRawCell *raw = rawCell(iRawCell);
749 
750  unsigned int dataSize = sizeof(uint32_t) * (4 + 1024) + raw->eventSize();
751  unsigned char *data = new unsigned char[dataSize];
752  uint32_t *pos = (uint32_t*) data;
753  // 06-Oct-2008, KAB - added a version number for the error event format.
754  //
755  // Version 1 had no version number, so the run number appeared in the
756  // first value. So, a reasonable test for version 1 is whether the
757  // first value is larger than some relatively small cutoff (say 32).
758  // Version 2 added the lumi block number.
759  //
760  *pos++ = (uint32_t) 2; // protocol version number
761  *pos++ = (uint32_t) runNumber;
762  *pos++ = (uint32_t) evf::evtn::getlbn(
764  *pos++ = (uint32_t) raw->evtNumber();
765  for (unsigned int i = 0; i < 1024; i++)
766  *pos++ = (uint32_t) raw->fedSize(i);
767  memcpy(pos, raw->payloadAddr(), raw->eventSize());
768 
769  // DEBUG
770  /*
771  if (1) {
772  stringstream ss;
773  ss<<"/tmp/run"<<runNumber<<"_evt"<<raw->evtNumber()<<".err";
774  ofstream fout;
775  fout.open(ss.str().c_str(),ios::out|ios::binary);
776  if (!fout.write((char*)data,dataSize))
777  cout<<"Failed to write error event to "<<ss.str()<<endl;
778  fout.close();
779 
780  stringstream ss2;
781  ss2<<"/tmp/run"<<runNumber<<"_evt"<<raw->evtNumber()<<".info";
782  ofstream fout2;
783  fout2.open(ss2.str().c_str());
784  fout2<<"dataSize = "<<dataSize<<endl;
785  fout2<<"runNumber = "<<runNumber<<endl;
786  fout2<<"evtNumber = "<<raw->evtNumber()<<endl;
787  fout2<<"eventSize = "<<raw->eventSize()<<endl;
788  unsigned int totalSize(0);
789  for (unsigned int i=0;i<1024;i++) {
790  unsigned int fedSize = raw->fedSize(i);
791  totalSize += fedSize;
792  if (fedSize>0) fout2<<i<<": "<<fedSize<<endl;
793  }
794  fout2<<"totalSize = "<<totalSize<<endl;
795  fout2.close();
796  }
797  */// END DEBUG
798 
799  waitRecoWrite();
800  unsigned int iRecoCell = nextRecoWriteIndex();
801  FUShmRecoCell* reco = recoCell(iRecoCell);
802  lock();
803  setEvtState(iRawCell, evt::RECOWRITING,false);
804  setEvtDiscard(iRawCell, 1, true,false);
805  unlock();
806  reco->writeErrorEvent(iRawCell, runNumber, raw->evtNumber(), fuProcessId,
807  data, dataSize);
808  delete[] data;
809  setEvtState(iRawCell, evt::RECOWRITTEN);
810  postRecoIndexToRead(iRecoCell);
811  if (segmentationMode_) {
812  shmdt(raw);
813  shmdt(reco);
814  }
815  postRecoRead();
816  return true;
817 }
int i
Definition: DBlmapReader.cc:9
void waitRecoWrite()
Definition: FUShmBuffer.h:260
unsigned int evtNumber() const
Definition: FUShmRawCell.h:28
unsigned int getlbn(const unsigned char *)
unsigned char * payloadAddr() const
FUShmRawCell * rawCell(unsigned int iCell)
bool setEvtDiscard(unsigned int index, unsigned int discard, bool checkValue=false, bool lockShm=true)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRecoCell * recoCell(unsigned int iCell)
unsigned char * fedAddr(unsigned int i) const
Definition: FUShmRawCell.cc:94
void writeErrorEvent(unsigned int rawCellIndex, unsigned int runNumber, unsigned int evtNumber, unsigned int fuProcessId, unsigned char *data, unsigned int dataSize)
unsigned int nextRecoWriteIndex()
unsigned int eventSize() const
void postRecoIndexToRead(unsigned int index)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned int fedSize(unsigned int i) const
Definition: FUShmRawCell.cc:82
void FUShmBuffer::writeRawEmptyEvent ( )

Definition at line 572 of file FUShmBuffer.cc.

References evtState(), evf::FUShmRawCell::index(), postRawIndexToRead(), postRawRead(), rawCellToWrite(), evf::evt::RAWWRITING, segmentationMode_, evf::FUShmRawCell::setEventTypeStopper(), setEvtState(), evf::utils::state, and evf::evt::STOP.

572  {
573  FUShmRawCell* cell = rawCellToWrite();
574  if (cell == 0)
575  return;
576  evt::State_t state = evtState(cell->index());
577  if(!(state == evt::RAWWRITING)) {
578  stringstream details;
579  details << "state==evt::RAWWRITING assertion failed! Actual state is "
580  << state << ", index = " << cell->index();
581  XCEPT_ASSERT(false, evf::Exception, details.str());
582  }
583  setEvtState(cell->index(), evt::STOP);
584  cell->setEventTypeStopper();
585  postRawIndexToRead(cell->index());
586  if (segmentationMode_)
587  shmdt(cell);
588  postRawRead();
589 }
void postRawIndexToRead(unsigned int index)
evt::State_t evtState(unsigned int index)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRawCell * rawCellToWrite()
Definition: FUShmBuffer.cc:298
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
void setEventTypeStopper()
Definition: FUShmRawCell.h:65
void FUShmBuffer::writeRawLumiSectionEvent ( unsigned int  ls)

Definition at line 592 of file FUShmBuffer.cc.

References evtState(), evf::FUShmRawCell::index(), evf::evt::LUMISECTION, postRawIndexToRead(), postRawRead(), rawCellToWrite(), evf::evt::RAWWRITING, segmentationMode_, evf::FUShmRawCell::setEventTypeEol(), setEvtNumber(), setEvtState(), evf::FUShmRawCell::setLumiSection(), and evf::utils::state.

592  {
593  FUShmRawCell* cell = rawCellToWrite();
594  if (cell == 0)
595  return;
596  cell->setLumiSection(ls);
597  evt::State_t state = evtState(cell->index());
598  if (!(state == evt::RAWWRITING)) {
599  stringstream details;
600  details << "state==evt::RAWWRITING assertion failed! Actual state is "
601  << state << ", index = " << cell->index();
602  XCEPT_ASSERT(false, evf::Exception, details.str());
603  }
604  setEvtNumber(cell->index(),0xfffffffe);
606  cell->setEventTypeEol();
607  postRawIndexToRead(cell->index());
608  if (segmentationMode_)
609  shmdt(cell);
610  postRawRead();
611 }
void postRawIndexToRead(unsigned int index)
evt::State_t evtState(unsigned int index)
bool setEvtNumber(unsigned int index, unsigned int evtNumber)
void setEventTypeEol()
Definition: FUShmRawCell.h:61
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRawCell * rawCellToWrite()
Definition: FUShmBuffer.cc:298
char state
Definition: procUtils.cc:75
unsigned int index() const
Definition: FUShmRawCell.h:25
void setLumiSection(unsigned int)
void FUShmBuffer::writeRecoEmptyEvent ( )

Definition at line 614 of file FUShmBuffer.cc.

References evf::FUShmRecoCell::clear(), nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), segmentationMode_, and waitRecoWrite().

614  {
615  waitRecoWrite();
616  unsigned int iCell = nextRecoWriteIndex();
617  FUShmRecoCell* cell = recoCell(iCell);
618  cell->clear();
619  postRecoIndexToRead(iCell);
620  if (segmentationMode_)
621  shmdt(cell);
622  postRecoRead();
623 }
void waitRecoWrite()
Definition: FUShmBuffer.h:260
FUShmRecoCell * recoCell(unsigned int iCell)
unsigned int nextRecoWriteIndex()
void postRecoIndexToRead(unsigned int index)
bool FUShmBuffer::writeRecoEventData ( unsigned int  runNumber,
unsigned int  evtNumber,
unsigned int  outModId,
unsigned int  fuProcessId,
unsigned int  fuGuid,
unsigned char *  data,
unsigned int  dataSize 
)

Definition at line 714 of file FUShmBuffer.cc.

References gather_cfg::cout, incEvtDiscard(), indexForEvtNumber(), lock(), nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), recoCellPayloadSize_, evf::evt::RECOWRITING, evf::evt::RECOWRITTEN, segmentationMode_, setEvtState(), unlock(), waitRecoWrite(), and evf::FUShmRecoCell::writeEventData().

Referenced by edm::FUShmOutputModule::doOutputEvent().

717  {
718  if (dataSize > recoCellPayloadSize_) {
719  cout << "FUShmBuffer::writeRecoEventData() ERROR: buffer overflow."
720  << endl;
721  return false;
722  }
723 
724  waitRecoWrite();
725  unsigned int rawCellIndex = indexForEvtNumber(evtNumber);
726  unsigned int iCell = nextRecoWriteIndex();
727  FUShmRecoCell* cell = recoCell(iCell);
728  //evt::State_t state=evtState(rawCellIndex);
729  //XCEPT_ASSERT(state==evt::PROCESSING||state==evt::RECOWRITING||state==evt::SENT,
730  //evf::Exception, "state==evt::PROCESSING||state==evt::RECOWRITING||state==evt::SENT assertion failed!");
731  lock();
732  setEvtState(rawCellIndex, evt::RECOWRITING,false);
733  incEvtDiscard(rawCellIndex,false);
734  unlock();
735  cell->writeEventData(rawCellIndex, runNumber, evtNumber, outModId,
736  fuProcessId, fuGuid, data, dataSize);
737  setEvtState(rawCellIndex, evt::RECOWRITTEN);
738  postRecoIndexToRead(iCell);
739  if (segmentationMode_)
740  shmdt(cell);
741  postRecoRead();
742  return true;
743 }
void waitRecoWrite()
Definition: FUShmBuffer.h:260
unsigned int recoCellPayloadSize_
Definition: FUShmBuffer.h:319
unsigned int evtNumber(unsigned int index)
bool setEvtState(unsigned int index, evt::State_t state, bool lockShm=true)
FUShmRecoCell * recoCell(unsigned int iCell)
unsigned int nextRecoWriteIndex()
void postRecoIndexToRead(unsigned int index)
unsigned int indexForEvtNumber(unsigned int evtNumber)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
int incEvtDiscard(unsigned int index, bool lockShm=true)
void writeEventData(unsigned int rawCellIndex, unsigned int runNumber, unsigned int evtNumber, unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
bool FUShmBuffer::writeRecoInitMsg ( unsigned int  outModId,
unsigned int  fuProcessId,
unsigned int  fuGuid,
unsigned char *  data,
unsigned int  dataSize,
unsigned int  nExpectedEPs 
)

Definition at line 693 of file FUShmBuffer.cc.

References gather_cfg::cout, nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), recoCellPayloadSize_, segmentationMode_, waitRecoWrite(), and evf::FUShmRecoCell::writeInitMsg().

Referenced by edm::FUShmOutputModule::doOutputHeader().

695  {
696  if (dataSize > recoCellPayloadSize_) {
697  cout << "FUShmBuffer::writeRecoInitMsg() ERROR: buffer overflow."
698  << endl;
699  return false;
700  }
701 
702  waitRecoWrite();
703  unsigned int iCell = nextRecoWriteIndex();
704  FUShmRecoCell* cell = recoCell(iCell);
705  cell->writeInitMsg(outModId, fuProcessId, fuGuid, data, dataSize,nExpectedEPs);
706  postRecoIndexToRead(iCell);
707  if (segmentationMode_)
708  shmdt(cell);
709  postRecoRead();
710  return true;
711 }
void waitRecoWrite()
Definition: FUShmBuffer.h:260
unsigned int recoCellPayloadSize_
Definition: FUShmBuffer.h:319
void writeInitMsg(unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize, unsigned int nExpectedEPs)
FUShmRecoCell * recoCell(unsigned int iCell)
unsigned int nextRecoWriteIndex()
void postRecoIndexToRead(unsigned int index)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

unsigned int evf::FUShmBuffer::clientPrcIdOffset_
private

Definition at line 309 of file FUShmBuffer.h.

Referenced by clientPrcId(), FUShmBuffer(), removeClientPrcId(), and setClientPrcId().

unsigned int evf::FUShmBuffer::dqmCellOffset_
private

Definition at line 328 of file FUShmBuffer.h.

Referenced by dqmCell(), dqmCellShmKey(), FUShmBuffer(), and initialize().

unsigned int evf::FUShmBuffer::dqmCellPayloadSize_
private

Definition at line 326 of file FUShmBuffer.h.

Referenced by dqmCell(), FUShmBuffer(), initialize(), and writeDqmEventData().

unsigned int evf::FUShmBuffer::dqmCellTotalSize_
private

Definition at line 327 of file FUShmBuffer.h.

Referenced by dqmCell(), FUShmBuffer(), and initialize().

unsigned int evf::FUShmBuffer::dqmReadIndex_
private

Definition at line 324 of file FUShmBuffer.h.

unsigned int evf::FUShmBuffer::dqmReadLast_
private

Definition at line 297 of file FUShmBuffer.h.

Referenced by postDqmIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::dqmReadNext_
private

Definition at line 296 of file FUShmBuffer.h.

Referenced by nextDqmReadIndex(), and reset().

unsigned int evf::FUShmBuffer::dqmReadOffset_
private

Definition at line 298 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextDqmReadIndex(), postDqmIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::dqmStateOffset_
private

Definition at line 305 of file FUShmBuffer.h.

Referenced by dqmState(), FUShmBuffer(), and setDqmState().

unsigned int evf::FUShmBuffer::dqmWriteIndex_
private

Definition at line 323 of file FUShmBuffer.h.

unsigned int evf::FUShmBuffer::dqmWriteLast_
private

Definition at line 294 of file FUShmBuffer.h.

Referenced by postDqmIndexToWrite(), and reset().

unsigned int evf::FUShmBuffer::dqmWriteNext_
private

Definition at line 293 of file FUShmBuffer.h.

Referenced by nextDqmWriteIndex(), and reset().

unsigned int evf::FUShmBuffer::dqmWriteOffset_
private

Definition at line 295 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextDqmWriteIndex(), postDqmIndexToWrite(), and reset().

unsigned int evf::FUShmBuffer::evtDiscardOffset_
private

Definition at line 301 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), incEvtDiscard(), rawCellReadyForDiscard(), and setEvtDiscard().

unsigned int evf::FUShmBuffer::evtNumberOffset_
private

Definition at line 302 of file FUShmBuffer.h.

Referenced by evtNumber(), FUShmBuffer(), indexForEvtNumber(), and setEvtNumber().

unsigned int evf::FUShmBuffer::evtPrcIdOffset_
private

Definition at line 303 of file FUShmBuffer.h.

Referenced by evtPrcId(), FUShmBuffer(), indexForEvtPrcId(), and setEvtPrcId().

unsigned int evf::FUShmBuffer::evtStateOffset_
private

Definition at line 300 of file FUShmBuffer.h.

Referenced by evtState(), FUShmBuffer(), and setEvtState().

unsigned int evf::FUShmBuffer::evtTimeStampOffset_
private

Definition at line 304 of file FUShmBuffer.h.

Referenced by evtTimeStamp(), FUShmBuffer(), and setEvtTimeStamp().

unsigned int evf::FUShmBuffer::nClients_
private

Definition at line 307 of file FUShmBuffer.h.

Referenced by nClients(), removeClientPrcId(), reset(), and setClientPrcId().

unsigned int evf::FUShmBuffer::nClientsMax_
private

Definition at line 308 of file FUShmBuffer.h.

Referenced by clientPrcId(), FUShmBuffer(), and setClientPrcId().

unsigned int evf::FUShmBuffer::nDqmCells_
private
unsigned int evf::FUShmBuffer::nRawCells_
private
unsigned int evf::FUShmBuffer::nRecoCells_
private
unsigned int evf::FUShmBuffer::rawCellOffset_
private

Definition at line 314 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), initialize(), rawCell(), and rawCellShmKey().

unsigned int evf::FUShmBuffer::rawCellPayloadSize_
private

Definition at line 312 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), initialize(), and rawCell().

unsigned int evf::FUShmBuffer::rawCellTotalSize_
private

Definition at line 313 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), initialize(), and rawCell().

unsigned int evf::FUShmBuffer::rawDiscardIndex_
private
unsigned int evf::FUShmBuffer::rawReadLast_
private

Definition at line 282 of file FUShmBuffer.h.

Referenced by postRawIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::rawReadNext_
private

Definition at line 281 of file FUShmBuffer.h.

Referenced by nextRawReadIndex(), and reset().

unsigned int evf::FUShmBuffer::rawReadOffset_
private

Definition at line 283 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextRawReadIndex(), postRawIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::rawWriteLast_
private

Definition at line 279 of file FUShmBuffer.h.

Referenced by postRawIndexToWrite(), and reset().

unsigned int evf::FUShmBuffer::rawWriteNext_
private

Definition at line 278 of file FUShmBuffer.h.

Referenced by nextRawWriteIndex(), and reset().

unsigned int evf::FUShmBuffer::rawWriteOffset_
private

Definition at line 280 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextRawWriteIndex(), postRawIndexToWrite(), and reset().

unsigned int evf::FUShmBuffer::recoCellOffset_
private

Definition at line 321 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), initialize(), recoCell(), and recoCellShmKey().

unsigned int evf::FUShmBuffer::recoCellPayloadSize_
private
unsigned int evf::FUShmBuffer::recoCellTotalSize_
private

Definition at line 320 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), initialize(), and recoCell().

unsigned int evf::FUShmBuffer::recoReadIndex_
private

Definition at line 317 of file FUShmBuffer.h.

unsigned int evf::FUShmBuffer::recoReadLast_
private

Definition at line 290 of file FUShmBuffer.h.

Referenced by postRecoIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::recoReadNext_
private

Definition at line 289 of file FUShmBuffer.h.

Referenced by nextRecoReadIndex(), and reset().

unsigned int evf::FUShmBuffer::recoReadOffset_
private

Definition at line 291 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextRecoReadIndex(), postRecoIndexToRead(), and reset().

unsigned int evf::FUShmBuffer::recoWriteIndex_
private

Definition at line 316 of file FUShmBuffer.h.

unsigned int evf::FUShmBuffer::recoWriteLast_
private

Definition at line 287 of file FUShmBuffer.h.

Referenced by postRecoIndexToWrite(), and reset().

unsigned int evf::FUShmBuffer::recoWriteNext_
private

Definition at line 286 of file FUShmBuffer.h.

Referenced by nextRecoWriteIndex(), and reset().

unsigned int evf::FUShmBuffer::recoWriteOffset_
private

Definition at line 288 of file FUShmBuffer.h.

Referenced by FUShmBuffer(), nextRecoWriteIndex(), postRecoIndexToWrite(), and reset().

bool evf::FUShmBuffer::segmentationMode_
private
int evf::FUShmBuffer::semid_
private

Definition at line 276 of file FUShmBuffer.h.

Referenced by initialize(), and semid().

const char * FUShmBuffer::semKeyPath_
staticprivate
Initial value:
=
(getenv("FUSEM_KEYFILE") == NULL ? "/dev/null"
: getenv("FUSEM_KEYFILE"))

Definition at line 331 of file FUShmBuffer.h.

Referenced by getSemKey().

int evf::FUShmBuffer::shmid_
private

Definition at line 275 of file FUShmBuffer.h.

Referenced by initialize(), and shmid().

const char * FUShmBuffer::shmKeyPath_
staticprivate
Initial value:
=
(getenv("FUSHM_KEYFILE") == NULL ? "/dev/null"
: getenv("FUSHM_KEYFILE"))

Definition at line 330 of file FUShmBuffer.h.

Referenced by getShmDescriptorKey(), getShmKey(), and initialize().