#include <EventFilter/ShmBuffer/interface/FUShmBuffer.h>
Public Member Functions | |
pid_t | clientPrcId (unsigned int index) |
void | discardDqmCell (unsigned int iCell) |
void | discardRawCell (FUShmRawCell *cell) |
void | discardRecoCell (unsigned int iCell) |
FUShmDqmCell * | dqmCellToRead () |
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) |
void | initialize (unsigned int shmid, unsigned int semid) |
void | lock () |
int | nbRawCellsToRead () const |
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) |
FUShmRawCell * | rawCellToDiscard () |
FUShmRawCell * | rawCellToRead () |
FUShmRawCell * | rawCellToWrite () |
FUShmRecoCell * | recoCellToRead () |
void | releaseRawCell (FUShmRawCell *cell) |
bool | removeClientPrcId (pid_t prcId) |
void | reset () |
void | scheduleRawCellForDiscard (unsigned int iCell) |
void | scheduleRawEmptyCellForDiscard (FUShmRawCell *cell) |
void | scheduleRawEmptyCellForDiscard () |
void | sem_print () |
int | semid () const |
bool | setEvtState (unsigned int index, evt::State_t state) |
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) |
void | writeRawEmptyEvent () |
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) |
~FUShmBuffer () | |
Static Public Member Functions | |
static 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 key_t | getSemKey () |
static FUShmBuffer * | getShmBuffer () |
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 | |
FUShmDqmCell * | dqmCell (unsigned int iCell) |
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) | |
int | incEvtDiscard (unsigned int index) |
unsigned int | indexForEvtNumber (unsigned int 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 () |
FUShmRawCell * | rawCell (unsigned int iCell) |
bool | rawCellReadyForDiscard (unsigned int index) |
key_t | rawCellShmKey (unsigned int iCell) |
FUShmRecoCell * | recoCell (unsigned int iCell) |
key_t | recoCellShmKey (unsigned int iCell) |
void | sem_init (int isem, int value) |
void | sem_post (int isem) |
void | sem_wait (int isem) |
bool | setClientPrcId (pid_t prcId) |
bool | setDqmState (unsigned int index, dqm::State_t state) |
bool | setEvtDiscard (unsigned int index, unsigned int discard) |
bool | setEvtNumber (unsigned int index, unsigned int evtNumber) |
bool | setEvtPrcId (unsigned int index, pid_t prcId) |
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 () |
void | 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_ |
Definition at line 39 of file FUShmBuffer.h.
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 44 of file FUShmBuffer.cc.
References addr, 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_, and size.
Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().
00051 : segmentationMode_(segmentationMode) 00052 , nClientsMax_(16) 00053 , nRawCells_(nRawCells) 00054 , rawCellPayloadSize_(rawCellSize) 00055 , nRecoCells_(nRecoCells) 00056 , recoCellPayloadSize_(recoCellSize) 00057 , nDqmCells_(nDqmCells) 00058 , dqmCellPayloadSize_(dqmCellSize) 00059 { 00060 rawCellTotalSize_ =FUShmRawCell::size(rawCellPayloadSize_); 00061 recoCellTotalSize_=FUShmRecoCell::size(recoCellPayloadSize_); 00062 dqmCellTotalSize_ =FUShmDqmCell::size(dqmCellPayloadSize_); 00063 00064 void* addr; 00065 00066 rawWriteOffset_=sizeof(FUShmBuffer); 00067 addr=(void*)((unsigned int)this+rawWriteOffset_); 00068 new (addr) unsigned int[nRawCells_]; 00069 00070 rawReadOffset_=rawWriteOffset_+nRawCells_*sizeof(unsigned int); 00071 addr=(void*)((unsigned int)this+rawReadOffset_); 00072 new (addr) unsigned int[nRawCells_]; 00073 00074 recoWriteOffset_=rawReadOffset_+nRawCells_*sizeof(unsigned int); 00075 addr=(void*)((unsigned int)this+recoWriteOffset_); 00076 new (addr) unsigned int[nRecoCells_]; 00077 00078 recoReadOffset_=recoWriteOffset_+nRecoCells_*sizeof(unsigned int); 00079 addr=(void*)((unsigned int)this+recoReadOffset_); 00080 new (addr) unsigned int[nRecoCells_]; 00081 00082 dqmWriteOffset_=recoReadOffset_+nRecoCells_*sizeof(unsigned int); 00083 addr=(void*)((unsigned int)this+dqmWriteOffset_); 00084 new (addr) unsigned int[nDqmCells_]; 00085 00086 dqmReadOffset_=dqmWriteOffset_+nDqmCells_*sizeof(unsigned int); 00087 addr=(void*)((unsigned int)this+dqmReadOffset_); 00088 new (addr) unsigned int[nDqmCells_]; 00089 00090 evtStateOffset_=dqmReadOffset_+nDqmCells_*sizeof(unsigned int); 00091 addr=(void*)((unsigned int)this+evtStateOffset_); 00092 new (addr) evt::State_t[nRawCells_]; 00093 00094 evtDiscardOffset_=evtStateOffset_+nRawCells_*sizeof(evt::State_t); 00095 addr=(void*)((unsigned int)this+evtDiscardOffset_); 00096 new (addr) unsigned int[nRawCells_]; 00097 00098 evtNumberOffset_=evtDiscardOffset_+nRawCells_*sizeof(unsigned int); 00099 addr=(void*)((unsigned int)this+evtNumberOffset_); 00100 new (addr) unsigned int[nRawCells_]; 00101 00102 evtPrcIdOffset_=evtNumberOffset_+nRawCells_*sizeof(unsigned int); 00103 addr=(void*)((unsigned int)this+evtPrcIdOffset_); 00104 new (addr) pid_t[nRawCells_]; 00105 00106 evtTimeStampOffset_=evtPrcIdOffset_+nRawCells_*sizeof(pid_t); 00107 addr=(void*)((unsigned int)this+evtTimeStampOffset_); 00108 new (addr) time_t[nRawCells_]; 00109 00110 dqmStateOffset_=evtTimeStampOffset_+nRawCells_*sizeof(time_t); 00111 addr=(void*)((unsigned int)this+dqmStateOffset_); 00112 new (addr) dqm::State_t[nDqmCells_]; 00113 00114 clientPrcIdOffset_=dqmStateOffset_+nDqmCells_*sizeof(dqm::State_t); 00115 addr=(void*)((unsigned int)this+clientPrcIdOffset_); 00116 new (addr) pid_t[nClientsMax_]; 00117 00118 rawCellOffset_=dqmStateOffset_+nClientsMax_*sizeof(pid_t); 00119 00120 if (segmentationMode_) { 00121 recoCellOffset_=rawCellOffset_+nRawCells_*sizeof(key_t); 00122 dqmCellOffset_ =recoCellOffset_+nRecoCells_*sizeof(key_t); 00123 addr=(void*)((unsigned int)this+rawCellOffset_); 00124 new (addr) key_t[nRawCells_]; 00125 addr=(void*)((unsigned int)this+recoCellOffset_); 00126 new (addr) key_t[nRecoCells_]; 00127 addr=(void*)((unsigned int)this+dqmCellOffset_); 00128 new (addr) key_t[nDqmCells_]; 00129 } 00130 else { 00131 recoCellOffset_=rawCellOffset_+nRawCells_*rawCellTotalSize_; 00132 dqmCellOffset_ =recoCellOffset_+nRecoCells_*recoCellTotalSize_; 00133 for (unsigned int i=0;i<nRawCells_;i++) { 00134 addr=(void*)((unsigned int)this+rawCellOffset_+i*rawCellTotalSize_); 00135 new (addr) FUShmRawCell(rawCellSize); 00136 } 00137 for (unsigned int i=0;i<nRecoCells_;i++) { 00138 addr=(void*)((unsigned int)this+recoCellOffset_+i*recoCellTotalSize_); 00139 new (addr) FUShmRecoCell(recoCellSize); 00140 } 00141 for (unsigned int i=0;i<nDqmCells_;i++) { 00142 addr=(void*)((unsigned int)this+dqmCellOffset_+i*dqmCellTotalSize_); 00143 new (addr) FUShmDqmCell(dqmCellSize); 00144 } 00145 } 00146 }
FUShmBuffer::~FUShmBuffer | ( | ) |
pid_t FUShmBuffer::clientPrcId | ( | unsigned int | index | ) |
Definition at line 1268 of file FUShmBuffer.cc.
References clientPrcIdOffset_, and nClientsMax_.
Referenced by evf::FUResourceTable::clientPrcIds(), and evf::FUResourceTable::clientPrcIdsAsString().
01269 { 01270 assert(index<nClientsMax_); 01271 pid_t *prcid=(pid_t*)((unsigned int)this+clientPrcIdOffset_); 01272 prcid+=index; 01273 return *prcid; 01274 }
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 744 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), initialize(), int, p, releaseSharedMemory(), sem_create(), semid(), shm_attach(), shm_create(), shm_nattch(), shmid(), size(), and size.
Referenced by evf::FUResourceTable::initialize().
00751 { 00752 // if necessary, release shared memory first! 00753 if (FUShmBuffer::releaseSharedMemory()) 00754 cout<<"FUShmBuffer::createShmBuffer: " 00755 <<"REMOVAL OF OLD SHARED MEM SEGMENTS SUCCESSFULL." 00756 <<endl; 00757 00758 // create bookkeeping shared memory segment 00759 int size =sizeof(unsigned int)*7; 00760 int shmid=shm_create(FUShmBuffer::getShmDescriptorKey(),size);if(shmid<0)return 0; 00761 void*shmAddr=shm_attach(shmid); if(0==shmAddr)return 0; 00762 00763 if(1!=shm_nattch(shmid)) { 00764 cout<<"FUShmBuffer::createShmBuffer() FAILED: nattch="<<shm_nattch(shmid)<<endl; 00765 shmdt(shmAddr); 00766 return 0; 00767 } 00768 00769 unsigned int* p=(unsigned int*)shmAddr; 00770 *p++=segmentationMode; 00771 *p++=nRawCells; 00772 *p++=nRecoCells; 00773 *p++=nDqmCells; 00774 *p++=rawCellSize; 00775 *p++=recoCellSize; 00776 *p++=dqmCellSize; 00777 shmdt(shmAddr); 00778 00779 // create the 'real' shared memory buffer 00780 size =FUShmBuffer::size(segmentationMode, 00781 nRawCells,nRecoCells,nDqmCells, 00782 rawCellSize,recoCellSize,dqmCellSize); 00783 shmid =shm_create(FUShmBuffer::getShmKey(),size); if (shmid<0) return 0; 00784 int semid=sem_create(FUShmBuffer::getSemKey(),9); if (semid<0) return 0; 00785 shmAddr =shm_attach(shmid); if (0==shmAddr) return 0; 00786 00787 if (1!=shm_nattch(shmid)) { 00788 cout<<"FUShmBuffer::createShmBuffer FAILED: nattch="<<shm_nattch(shmid)<<endl; 00789 shmdt(shmAddr); 00790 return 0; 00791 } 00792 FUShmBuffer* buffer=new(shmAddr) FUShmBuffer(segmentationMode, 00793 nRawCells,nRecoCells,nDqmCells, 00794 rawCellSize,recoCellSize,dqmCellSize); 00795 00796 cout<<"FUShmBuffer::createShmBuffer(): CREATED shared memory buffer."<<endl; 00797 cout<<" segmentationMode="<<segmentationMode<<endl; 00798 00799 buffer->initialize(shmid,semid); 00800 00801 return buffer; 00802 }
Definition at line 440 of file FUShmBuffer.cc.
References evf::FUShmDqmCell::clear(), evf::dqm::DISCARDING, dqmCell(), dqmState(), evf::dqm::EMPTY, postDqmIndexToWrite(), postDqmWrite(), segmentationMode_, evf::dqm::SENT, setDqmState(), and state.
Referenced by evf::FUResourceTable::discardDqmEvent(), and evf::FUResourceTable::sendDqm().
00441 { 00442 dqm::State_t state=dqmState(iCell); 00443 assert(state==dqm::EMPTY||state==dqm::SENT); 00444 setDqmState(iCell,dqm::DISCARDING); 00445 FUShmDqmCell* cell=dqmCell(iCell); 00446 cell->clear(); 00447 if (segmentationMode_) shmdt(cell); 00448 setDqmState(iCell,dqm::EMPTY); 00449 postDqmIndexToWrite(iCell); 00450 postDqmWrite(); 00451 }
void FUShmBuffer::discardRawCell | ( | FUShmRawCell * | cell | ) |
Definition at line 415 of file FUShmBuffer.cc.
References postRawDiscard(), and releaseRawCell().
Referenced by evf::FUResourceTable::discard().
00416 { 00417 releaseRawCell(cell); 00418 postRawDiscard(); 00419 }
Definition at line 423 of file FUShmBuffer.cc.
References evf::FUShmRecoCell::clear(), nRawCells_, postRecoIndexToWrite(), postRecoWrite(), evf::FUShmRecoCell::rawCellIndex(), recoCell(), scheduleRawCellForDiscard(), and segmentationMode_.
Referenced by evf::FUResourceTable::discardDataEvent(), and evf::FUResourceTable::sendData().
00424 { 00425 FUShmRecoCell* cell=recoCell(iCell); 00426 unsigned int iRawCell=cell->rawCellIndex(); 00427 if (iRawCell<nRawCells_) { 00428 //evt::State_t state=evtState(iRawCell); 00429 //assert(state==evt::SENT); 00430 scheduleRawCellForDiscard(iRawCell); 00431 } 00432 cell->clear(); 00433 if (segmentationMode_) shmdt(cell); 00434 postRecoIndexToWrite(iCell); 00435 postRecoWrite(); 00436 }
FUShmDqmCell * FUShmBuffer::dqmCell | ( | unsigned int | iCell | ) | [private] |
Definition at line 1456 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, dqmCellOffset_, dqmCellPayloadSize_, dqmCellShmKey(), dqmCellTotalSize_, lat::endl(), nDqmCells_, HLT_VtxMuL3::result, segmentationMode_, shm_attach(), shm_get(), and shmid().
Referenced by discardDqmCell(), dqmCellToRead(), initialize(), writeDqmEmptyEvent(), and writeDqmEventData().
01457 { 01458 FUShmDqmCell* result(0); 01459 01460 if (iCell>=nDqmCells_) { 01461 cout<<"FUShmBuffer::dqmCell("<<iCell<<") ERROR: " 01462 <<"iCell="<<iCell<<" >= nDqmCells="<<nDqmCells_<<endl; 01463 return result; 01464 } 01465 01466 if (segmentationMode_) { 01467 key_t shmkey =dqmCellShmKey(iCell); 01468 int shmid =shm_get(shmkey,dqmCellTotalSize_); 01469 void* cellAddr=shm_attach(shmid); 01470 result=new (cellAddr) FUShmDqmCell(dqmCellPayloadSize_); 01471 } 01472 else { 01473 result= 01474 (FUShmDqmCell*)((unsigned int)this+dqmCellOffset_+iCell*dqmCellTotalSize_); 01475 } 01476 01477 return result; 01478 }
key_t FUShmBuffer::dqmCellShmKey | ( | unsigned int | iCell | ) | [private] |
Definition at line 1534 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, dqmCellOffset_, lat::endl(), nDqmCells_, and shmKey().
Referenced by dqmCell(), and releaseSharedMemory().
01535 { 01536 if (iCell>=nDqmCells_) { 01537 cout<<"FUShmBuffer::dqmCellShmKey() ERROR: " 01538 <<"iCell>=nDqmCells: "<<iCell<<">="<<nDqmCells_<<endl; 01539 return -1; 01540 } 01541 return shmKey(iCell,dqmCellOffset_); 01542 }
FUShmDqmCell * FUShmBuffer::dqmCellToRead | ( | ) |
Definition at line 327 of file FUShmBuffer.cc.
References dqmCell(), dqmState(), evf::dqm::EMPTY, nextDqmReadIndex(), evf::dqm::SENDING, setDqmState(), state, waitDqmRead(), and evf::dqm::WRITTEN.
Referenced by evf::FUResourceTable::sendDqm().
00328 { 00329 waitDqmRead(); 00330 unsigned int iCell=nextDqmReadIndex(); 00331 FUShmDqmCell* cell=dqmCell(iCell); 00332 dqm::State_t state=dqmState(iCell); 00333 assert(state==dqm::WRITTEN||state==dqm::EMPTY); 00334 if (state==dqm::WRITTEN) setDqmState(iCell,dqm::SENDING); 00335 return cell; 00336 }
dqm::State_t FUShmBuffer::dqmState | ( | unsigned int | index | ) |
Definition at line 1228 of file FUShmBuffer.cc.
References dqmStateOffset_, and nDqmCells_.
Referenced by discardDqmCell(), dqmCellToRead(), finishReadingDqmCell(), printDqmState(), evf::FUResourceTable::sendDqm(), and writeDqmEventData().
01229 { 01230 assert(index<nDqmCells_); 01231 dqm::State_t *pstate=(dqm::State_t*)((unsigned int)this+dqmStateOffset_); 01232 pstate+=index; 01233 return *pstate; 01234 }
Definition at line 1238 of file FUShmBuffer.cc.
References evtNumberOffset_, and nRawCells_.
Referenced by evf::FUResourceTable::cellEvtNumbers().
01239 { 01240 assert(index<nRawCells_); 01241 unsigned int *pevt=(unsigned int*)((unsigned int)this+evtNumberOffset_); 01242 pevt+=index; 01243 return *pevt; 01244 }
pid_t FUShmBuffer::evtPrcId | ( | unsigned int | index | ) |
Definition at line 1248 of file FUShmBuffer.cc.
References evtPrcIdOffset_, and nRawCells_.
Referenced by evf::FUResourceTable::cellPrcIds().
01249 { 01250 assert(index<nRawCells_); 01251 pid_t *prcid=(pid_t*)((unsigned int)this+evtPrcIdOffset_); 01252 prcid+=index; 01253 return *prcid; 01254 }
evt::State_t FUShmBuffer::evtState | ( | unsigned int | index | ) |
Definition at line 1218 of file FUShmBuffer.cc.
References evtStateOffset_, and nRawCells_.
Referenced by evf::FUResourceTable::cellStates(), evf::FUResourceTable::discard(), FUShmReader::fillRawData(), finishReadingRawCell(), finishWritingRawCell(), printEvtState(), rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), releaseRawCell(), scheduleRawCellForDiscard(), and writeRawEmptyEvent().
01219 { 01220 assert(index<nRawCells_); 01221 evt::State_t *pstate=(evt::State_t*)((unsigned int)this+evtStateOffset_); 01222 pstate+=index; 01223 return *pstate; 01224 }
time_t FUShmBuffer::evtTimeStamp | ( | unsigned int | index | ) |
Definition at line 1258 of file FUShmBuffer.cc.
References evtTimeStampOffset_, and nRawCells_.
Referenced by evf::FUResourceTable::cellTimeStamps().
01259 { 01260 assert(index<nRawCells_); 01261 time_t *ptstmp=(time_t*)((unsigned int)this+evtTimeStampOffset_); 01262 ptstmp+=index; 01263 return *ptstmp; 01264 }
void FUShmBuffer::finishReadingDqmCell | ( | FUShmDqmCell * | cell | ) |
Definition at line 390 of file FUShmBuffer.cc.
References dqmState(), evf::dqm::EMPTY, evf::FUShmDqmCell::index(), segmentationMode_, evf::dqm::SENDING, evf::dqm::SENT, setDqmState(), and state.
Referenced by evf::FUResourceTable::sendDqm().
00391 { 00392 dqm::State_t state=dqmState(cell->index()); 00393 assert(state==dqm::SENDING||state==dqm::EMPTY); 00394 if (state==dqm::SENDING) setDqmState(cell->index(),dqm::SENT); 00395 if (segmentationMode_) shmdt(cell); 00396 }
void FUShmBuffer::finishReadingRawCell | ( | FUShmRawCell * | cell | ) |
Definition at line 365 of file FUShmBuffer.cc.
References evtState(), evf::FUShmRawCell::index(), evf::evt::PROCESSING, evf::evt::RAWREAD, evf::evt::RAWREADING, segmentationMode_, setEvtState(), setEvtTimeStamp(), and state.
Referenced by evf::FUResourceTable::dropEvent(), and FUShmReader::fillRawData().
00366 { 00367 evt::State_t state=evtState(cell->index()); 00368 assert(state==evt::RAWREADING); 00369 setEvtState(cell->index(),evt::RAWREAD); 00370 setEvtState(cell->index(),evt::PROCESSING); 00371 setEvtTimeStamp(cell->index(),time(0)); 00372 if (segmentationMode_) shmdt(cell); 00373 }
void FUShmBuffer::finishReadingRecoCell | ( | FUShmRecoCell * | cell | ) |
Definition at line 377 of file FUShmBuffer.cc.
References nRawCells_, evf::FUShmRecoCell::rawCellIndex(), segmentationMode_, evf::evt::SENT, and setEvtState().
Referenced by evf::FUResourceTable::sendData().
00378 { 00379 unsigned int iRawCell=cell->rawCellIndex(); 00380 if (iRawCell<nRawCells_) { 00381 //evt::State_t state=evtState(cell->rawCellIndex()); 00382 //assert(state==evt::SENDING); 00383 setEvtState(cell->rawCellIndex(),evt::SENT); 00384 } 00385 if (segmentationMode_) shmdt(cell); 00386 }
void FUShmBuffer::finishWritingRawCell | ( | FUShmRawCell * | cell | ) |
Definition at line 352 of file FUShmBuffer.cc.
References evf::FUShmRawCell::evtNumber(), evtState(), evf::FUShmRawCell::index(), postRawIndexToRead(), postRawRead(), evf::evt::RAWWRITING, evf::evt::RAWWRITTEN, segmentationMode_, setEvtNumber(), setEvtState(), and state.
Referenced by evf::FUResourceTable::buildResource(), and evf::FUShmServer::writeNext().
00353 { 00354 evt::State_t state=evtState(cell->index()); 00355 assert(state==evt::RAWWRITING); 00356 setEvtState(cell->index(),evt::RAWWRITTEN); 00357 setEvtNumber(cell->index(),cell->evtNumber()); 00358 postRawIndexToRead(cell->index()); 00359 if (segmentationMode_) shmdt(cell); 00360 postRawRead(); 00361 }
key_t FUShmBuffer::getSemKey | ( | ) | [static] |
Definition at line 984 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), HLT_VtxMuL3::result, SEM_KEYID, and semKeyPath_.
Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().
00985 { 00986 key_t result=ftok(semKeyPath_,SEM_KEYID); 00987 if (result==(key_t)-1) cout<<"FUShmBuffer::getSemKey: ftok() failed " 00988 <<"for file "<<semKeyPath_<<"!"<<endl; 00989 return result; 00990 }
FUShmBuffer * FUShmBuffer::getShmBuffer | ( | ) | [static] |
Definition at line 806 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), int, nDqmCells(), nRawCells(), nRecoCells(), p, sem_get(), semid(), setClientPrcId(), shm_attach(), shm_get(), shm_nattch(), shmid(), size(), and size.
Referenced by FUShmDQMOutputService::attachToShm(), and SM_SharedMemoryHandle::getShmBuffer().
00807 { 00808 // get bookkeeping shared memory segment 00809 int size =sizeof(unsigned int)*7; 00810 int shmid =shm_get(FUShmBuffer::getShmDescriptorKey(),size);if(shmid<0)return 0; 00811 void* shmAddr=shm_attach(shmid); if (0==shmAddr) return 0; 00812 00813 unsigned int *p=(unsigned int*)shmAddr; 00814 bool segmentationMode=*p++; 00815 unsigned int nRawCells =*p++; 00816 unsigned int nRecoCells =*p++; 00817 unsigned int nDqmCells =*p++; 00818 unsigned int rawCellSize =*p++; 00819 unsigned int recoCellSize =*p++; 00820 unsigned int dqmCellSize =*p++; 00821 shmdt(shmAddr); 00822 00823 cout<<"FUShmBuffer::getShmBuffer():" 00824 <<" segmentationMode="<<segmentationMode 00825 <<" nRawCells="<<nRawCells 00826 <<" nRecoCells="<<nRecoCells 00827 <<" nDqmCells="<<nDqmCells 00828 <<" rawCellSize="<<rawCellSize 00829 <<" recoCellSize="<<recoCellSize 00830 <<" dqmCellSize="<<dqmCellSize 00831 <<endl; 00832 00833 // get the 'real' shared memory buffer 00834 size =FUShmBuffer::size(segmentationMode, 00835 nRawCells,nRecoCells,nDqmCells, 00836 rawCellSize,recoCellSize,dqmCellSize); 00837 shmid =shm_get(FUShmBuffer::getShmKey(),size); if (shmid<0) return 0; 00838 int semid=sem_get(FUShmBuffer::getSemKey(),9); if (semid<0) return 0; 00839 shmAddr =shm_attach(shmid); if (0==shmAddr) return 0; 00840 00841 if (0==shm_nattch(shmid)) { 00842 cout<<"FUShmBuffer::getShmBuffer() FAILED: nattch="<<shm_nattch(shmid)<<endl; 00843 return 0; 00844 } 00845 00846 FUShmBuffer* buffer=new(shmAddr) FUShmBuffer(segmentationMode, 00847 nRawCells,nRecoCells,nDqmCells, 00848 rawCellSize,recoCellSize,dqmCellSize); 00849 00850 cout<<"FUShmBuffer::getShmBuffer(): shared memory buffer RETRIEVED."<<endl; 00851 cout<<" segmentationMode="<<segmentationMode<<endl; 00852 00853 buffer->setClientPrcId(getpid()); 00854 00855 return buffer; 00856 }
key_t FUShmBuffer::getShmDescriptorKey | ( | ) | [static] |
Definition at line 964 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), HLT_VtxMuL3::result, SHM_DESCRIPTOR_KEYID, and shmKeyPath_.
Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().
00965 { 00966 key_t result=ftok(shmKeyPath_,SHM_DESCRIPTOR_KEYID); 00967 if (result==(key_t)-1) cout<<"FUShmBuffer::getShmDescriptorKey: ftok() failed " 00968 <<"for file "<<shmKeyPath_<<"!"<<endl; 00969 return result; 00970 }
key_t FUShmBuffer::getShmKey | ( | ) | [static] |
Definition at line 974 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), HLT_VtxMuL3::result, SHM_KEYID, and shmKeyPath_.
Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().
00975 { 00976 key_t result=ftok(shmKeyPath_,SHM_KEYID); 00977 if (result==(key_t)-1) cout<<"FUShmBuffer::getShmKey: ftok() failed " 00978 <<"for file "<<shmKeyPath_<<"!"<<endl; 00979 return result; 00980 }
Definition at line 1317 of file FUShmBuffer.cc.
References evtDiscardOffset_, lock(), nRawCells_, HLT_VtxMuL3::result, and unlock().
Referenced by writeRecoEventData().
01318 { 01319 int result = 0; 01320 assert(index<nRawCells_); 01321 unsigned int *pcount=(unsigned int*)((unsigned int)this+evtDiscardOffset_); 01322 pcount+=index; 01323 lock(); 01324 (*pcount)++; 01325 result = *pcount; 01326 unlock(); 01327 return result; 01328 }
Definition at line 1206 of file FUShmBuffer.cc.
References evtNumberOffset_, i, and nRawCells_.
Referenced by writeRecoEventData().
01207 { 01208 unsigned int *pevt=(unsigned int*)((unsigned int)this+evtNumberOffset_); 01209 for (unsigned int i=0;i<nRawCells_;i++) { 01210 if ((*pevt++)==evtNumber) return i; 01211 } 01212 assert(false); 01213 return 0xffffffff; 01214 }
Definition at line 161 of file FUShmBuffer.cc.
References dqmCell(), dqmCellOffset_, dqmCellPayloadSize_, dqmCellTotalSize_, i, evf::FUShmDqmCell::initialize(), evf::FUShmRawCell::initialize(), evf::FUShmRecoCell::initialize(), nDqmCells_, nRawCells_, nRecoCells_, rawCell(), rawCellOffset_, rawCellPayloadSize_, rawCellTotalSize_, recoCell(), recoCellOffset_, recoCellPayloadSize_, recoCellTotalSize_, reset(), segmentationMode_, semid_, shm_attach(), shm_create(), shmid_, and shmKeyPath_.
Referenced by createShmBuffer().
00162 { 00163 shmid_=shmid; 00164 semid_=semid; 00165 00166 if (segmentationMode_) { 00167 int shmKeyId=666; 00168 key_t* keyAddr =(key_t*)((unsigned int)this+rawCellOffset_); 00169 for (unsigned int i=0;i<nRawCells_;i++) { 00170 *keyAddr =ftok(shmKeyPath_,shmKeyId++); 00171 int shmid =shm_create(*keyAddr,rawCellTotalSize_); 00172 void* shmAddr=shm_attach(shmid); 00173 new (shmAddr) FUShmRawCell(rawCellPayloadSize_); 00174 shmdt(shmAddr); 00175 ++keyAddr; 00176 } 00177 keyAddr =(key_t*)((unsigned int)this+recoCellOffset_); 00178 for (unsigned int i=0;i<nRecoCells_;i++) { 00179 *keyAddr =ftok(shmKeyPath_,shmKeyId++); 00180 int shmid =shm_create(*keyAddr,recoCellTotalSize_); 00181 void* shmAddr=shm_attach(shmid); 00182 new (shmAddr) FUShmRecoCell(recoCellPayloadSize_); 00183 shmdt(shmAddr); 00184 ++keyAddr; 00185 } 00186 keyAddr =(key_t*)((unsigned int)this+dqmCellOffset_); 00187 for (unsigned int i=0;i<nDqmCells_;i++) { 00188 *keyAddr =ftok(shmKeyPath_,shmKeyId++); 00189 int shmid =shm_create(*keyAddr,dqmCellTotalSize_); 00190 void* shmAddr=shm_attach(shmid); 00191 new (shmAddr) FUShmDqmCell(dqmCellPayloadSize_); 00192 shmdt(shmAddr); 00193 ++keyAddr; 00194 } 00195 } 00196 00197 for (unsigned int i=0;i<nRawCells_;i++) { 00198 FUShmRawCell* cell=rawCell(i); 00199 cell->initialize(i); 00200 if (segmentationMode_) shmdt(cell); 00201 } 00202 00203 for (unsigned int i=0;i<nRecoCells_;i++) { 00204 FUShmRecoCell* cell=recoCell(i); 00205 cell->initialize(i); 00206 if (segmentationMode_) shmdt(cell); 00207 } 00208 00209 for (unsigned int i=0;i<nDqmCells_;i++) { 00210 FUShmDqmCell* cell=dqmCell(i); 00211 cell->initialize(i); 00212 if (segmentationMode_) shmdt(cell); 00213 } 00214 00215 reset(); 00216 }
Definition at line 238 of file FUShmBuffer.h.
References sem_wait().
Referenced by evf::FUResourceTable::cellEvtNumbers(), evf::FUResourceTable::cellPrcIds(), evf::FUResourceTable::cellStates(), evf::FUResourceTable::cellTimeStamps(), incEvtDiscard(), nextIndex(), postIndex(), rawCellReadyForDiscard(), removeClientPrcId(), setClientPrcId(), setDqmState(), setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), and setEvtTimeStamp().
00238 { sem_wait(0); }
int FUShmBuffer::nbRawCellsToRead | ( | ) | const |
Definition at line 274 of file FUShmBuffer.cc.
References semid().
00275 { 00276 return semctl(semid(),2,GETVAL); 00277 }
int FUShmBuffer::nbRawCellsToWrite | ( | ) | const |
Definition at line 267 of file FUShmBuffer.cc.
References semid().
00268 { 00269 return semctl(semid(),1,GETVAL); 00270 }
unsigned int evf::FUShmBuffer::nClients | ( | ) | const [inline] |
Definition at line 69 of file FUShmBuffer.h.
References nClients_.
Referenced by evf::FUResourceTable::discard(), and evf::FUResourceTable::nbClients().
00069 { return nClients_; }
unsigned int evf::FUShmBuffer::nDqmCells | ( | ) | const [inline] |
Definition at line 65 of file FUShmBuffer.h.
References nDqmCells_.
Referenced by getShmBuffer(), releaseSharedMemory(), and evf::FUResourceTable::resetCounters().
00065 { return nDqmCells_; }
unsigned int FUShmBuffer::nextDqmReadIndex | ( | ) | [private] |
Definition at line 1185 of file FUShmBuffer.cc.
References dqmReadNext_, dqmReadOffset_, nDqmCells_, and nextIndex().
Referenced by dqmCellToRead().
01186 { 01187 return nextIndex(dqmReadOffset_,nDqmCells_,dqmReadNext_); 01188 }
unsigned int FUShmBuffer::nextDqmWriteIndex | ( | ) | [private] |
Definition at line 1178 of file FUShmBuffer.cc.
References dqmWriteNext_, dqmWriteOffset_, nDqmCells_, and nextIndex().
Referenced by writeDqmEmptyEvent(), and writeDqmEventData().
01179 { 01180 return nextIndex(dqmWriteOffset_,nDqmCells_,dqmWriteNext_); 01181 }
unsigned int FUShmBuffer::nextIndex | ( | unsigned int | offset, | |
unsigned int | nCells, | |||
unsigned int & | iNext | |||
) | [private] |
Definition at line 1092 of file FUShmBuffer.cc.
References lock(), HLT_VtxMuL3::result, and unlock().
Referenced by nextDqmReadIndex(), nextDqmWriteIndex(), nextRawReadIndex(), nextRawWriteIndex(), nextRecoReadIndex(), and nextRecoWriteIndex().
01095 { 01096 lock(); 01097 unsigned int* pindex=(unsigned int*)((unsigned int)this+offset); 01098 pindex+=iNext; 01099 iNext=(iNext+1)%nCells; 01100 unsigned int result=*pindex; 01101 unlock(); 01102 return result; 01103 }
unsigned int FUShmBuffer::nextRawReadIndex | ( | ) | [private] |
Definition at line 1129 of file FUShmBuffer.cc.
References nextIndex(), nRawCells_, rawReadNext_, and rawReadOffset_.
Referenced by rawCellToRead().
01130 { 01131 return nextIndex(rawReadOffset_,nRawCells_,rawReadNext_); 01132 }
unsigned int FUShmBuffer::nextRawWriteIndex | ( | ) | [private] |
Definition at line 1122 of file FUShmBuffer.cc.
References nextIndex(), nRawCells_, rawWriteNext_, and rawWriteOffset_.
Referenced by rawCellToWrite().
01123 { 01124 return nextIndex(rawWriteOffset_,nRawCells_,rawWriteNext_); 01125 }
unsigned int FUShmBuffer::nextRecoReadIndex | ( | ) | [private] |
Definition at line 1157 of file FUShmBuffer.cc.
References nextIndex(), nRecoCells_, recoReadNext_, and recoReadOffset_.
Referenced by recoCellToRead().
01158 { 01159 return nextIndex(recoReadOffset_,nRecoCells_,recoReadNext_); 01160 }
unsigned int FUShmBuffer::nextRecoWriteIndex | ( | ) | [private] |
Definition at line 1150 of file FUShmBuffer.cc.
References nextIndex(), nRecoCells_, recoWriteNext_, and recoWriteOffset_.
Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
01151 { 01152 return nextIndex(recoWriteOffset_,nRecoCells_,recoWriteNext_); 01153 }
unsigned int evf::FUShmBuffer::nRawCells | ( | ) | const [inline] |
Definition at line 63 of file FUShmBuffer.h.
References nRawCells_.
Referenced by getShmBuffer(), and releaseSharedMemory().
00063 { return nRawCells_; }
unsigned int evf::FUShmBuffer::nRecoCells | ( | ) | const [inline] |
Definition at line 64 of file FUShmBuffer.h.
References nRecoCells_.
Referenced by getShmBuffer(), releaseSharedMemory(), and evf::FUResourceTable::resetCounters().
00064 { return nRecoCells_; }
Definition at line 1199 of file FUShmBuffer.cc.
References dqmReadLast_, dqmReadOffset_, nDqmCells_, and postIndex().
Referenced by writeDqmEmptyEvent(), and writeDqmEventData().
01200 { 01201 postIndex(index,dqmReadOffset_,nDqmCells_,dqmReadLast_); 01202 }
Definition at line 1192 of file FUShmBuffer.cc.
References dqmWriteLast_, dqmWriteOffset_, nDqmCells_, and postIndex().
Referenced by discardDqmCell().
01193 { 01194 postIndex(index,dqmWriteOffset_,nDqmCells_,dqmWriteLast_); 01195 }
void evf::FUShmBuffer::postDqmRead | ( | ) | [inline, private] |
Definition at line 256 of file FUShmBuffer.h.
References sem_post().
Referenced by writeDqmEmptyEvent(), and writeDqmEventData().
00256 { sem_post(8); }
void evf::FUShmBuffer::postDqmWrite | ( | ) | [inline, private] |
Definition at line 254 of file FUShmBuffer.h.
References sem_post().
Referenced by discardDqmCell().
00254 { sem_post(7); }
void FUShmBuffer::postIndex | ( | unsigned int | index, | |
unsigned int | offset, | |||
unsigned int | nCells, | |||
unsigned int & | iLast | |||
) | [private] |
Definition at line 1107 of file FUShmBuffer.cc.
References lock(), and unlock().
Referenced by postDqmIndexToRead(), postDqmIndexToWrite(), postRawIndexToRead(), postRawIndexToWrite(), postRecoIndexToRead(), and postRecoIndexToWrite().
01111 { 01112 lock(); 01113 unsigned int* pindex=(unsigned int*)((unsigned int)this+offset); 01114 pindex+=iLast; 01115 *pindex=index; 01116 iLast=(iLast+1)%nCells; 01117 unlock(); 01118 }
void evf::FUShmBuffer::postRawDiscard | ( | ) | [inline, private] |
Definition at line 246 of file FUShmBuffer.h.
References sem_post().
Referenced by discardRawCell(), scheduleRawCellForDiscard(), and scheduleRawEmptyCellForDiscard().
00246 { sem_post(3); }
void evf::FUShmBuffer::postRawDiscarded | ( | ) | [inline, private] |
Definition at line 248 of file FUShmBuffer.h.
References sem_post().
Referenced by scheduleRawCellForDiscard(), and scheduleRawEmptyCellForDiscard().
00248 { sem_post(4); }
Definition at line 1143 of file FUShmBuffer.cc.
References nRawCells_, postIndex(), rawReadLast_, and rawReadOffset_.
Referenced by finishWritingRawCell(), and writeRawEmptyEvent().
01144 { 01145 postIndex(index,rawReadOffset_,nRawCells_,rawReadLast_); 01146 }
Definition at line 1136 of file FUShmBuffer.cc.
References nRawCells_, postIndex(), rawWriteLast_, and rawWriteOffset_.
Referenced by releaseRawCell().
01137 { 01138 postIndex(index,rawWriteOffset_,nRawCells_,rawWriteLast_); 01139 }
void evf::FUShmBuffer::postRawRead | ( | ) | [inline, private] |
Definition at line 244 of file FUShmBuffer.h.
References sem_post().
Referenced by finishWritingRawCell(), and writeRawEmptyEvent().
00244 { sem_post(2); }
void evf::FUShmBuffer::postRawWrite | ( | ) | [inline, private] |
Definition at line 242 of file FUShmBuffer.h.
References sem_post().
Referenced by releaseRawCell().
00242 { sem_post(1); }
Definition at line 1171 of file FUShmBuffer.cc.
References nRecoCells_, postIndex(), recoReadLast_, and recoReadOffset_.
Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
01172 { 01173 postIndex(index,recoReadOffset_,nRecoCells_,recoReadLast_); 01174 }
Definition at line 1164 of file FUShmBuffer.cc.
References nRecoCells_, postIndex(), recoWriteLast_, and recoWriteOffset_.
Referenced by discardRecoCell().
01165 { 01166 postIndex(index,recoWriteOffset_,nRecoCells_,recoWriteLast_); 01167 }
void evf::FUShmBuffer::postRecoRead | ( | ) | [inline, private] |
Definition at line 252 of file FUShmBuffer.h.
References sem_post().
Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
00252 { sem_post(6); }
void evf::FUShmBuffer::postRecoWrite | ( | ) | [inline, private] |
Definition at line 250 of file FUShmBuffer.h.
References sem_post().
Referenced by discardRecoCell().
00250 { sem_post(5); }
Definition at line 736 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, dqmState(), lat::endl(), and state.
00737 { 00738 dqm::State_t state=dqmState(index); 00739 cout<<"dqm evt "<<index<<" in state '"<<state<<"'."<<endl; 00740 }
Definition at line 715 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, evf::evt::DISCARDING, evf::evt::EMPTY, lat::endl(), 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, and state.
Referenced by evf::FUShmServer::writeNext().
00716 { 00717 evt::State_t state=evtState(index); 00718 std::string stateName; 00719 if (state==evt::EMPTY) stateName="EMPTY"; 00720 else if (state==evt::RAWWRITING) stateName="RAWWRITING"; 00721 else if (state==evt::RAWWRITTEN) stateName="RAWRITTEN"; 00722 else if (state==evt::RAWREADING) stateName="RAWREADING"; 00723 else if (state==evt::RAWREAD) stateName="RAWREAD"; 00724 else if (state==evt::PROCESSING) stateName="PROCESSING"; 00725 else if (state==evt::PROCESSED) stateName="PROCESSED"; 00726 else if (state==evt::RECOWRITING)stateName="RECOWRITING"; 00727 else if (state==evt::RECOWRITTEN)stateName="RECOWRITTEN"; 00728 else if (state==evt::SENDING) stateName="SENDING"; 00729 else if (state==evt::SENT) stateName="SENT"; 00730 else if (state==evt::DISCARDING) stateName="DISCARDING"; 00731 cout<<"evt "<<index<<" in state '"<<stateName<<"'."<<endl; 00732 }
FUShmRawCell * FUShmBuffer::rawCell | ( | unsigned int | iCell | ) | [private] |
Definition at line 1404 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nRawCells_, rawCellOffset_, rawCellPayloadSize_, rawCellShmKey(), rawCellTotalSize_, HLT_VtxMuL3::result, segmentationMode_, shm_attach(), shm_get(), and shmid().
Referenced by initialize(), rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), and writeErrorEventData().
01405 { 01406 FUShmRawCell* result(0); 01407 01408 if (iCell>=nRawCells_) { 01409 cout<<"FUShmBuffer::rawCell("<<iCell<<") ERROR: " 01410 <<"iCell="<<iCell<<" >= nRawCells()="<<nRawCells_<<endl; 01411 return result; 01412 } 01413 01414 if (segmentationMode_) { 01415 key_t shmkey =rawCellShmKey(iCell); 01416 int shmid =shm_get(shmkey,rawCellTotalSize_); 01417 void* cellAddr=shm_attach(shmid); 01418 result=new (cellAddr) FUShmRawCell(rawCellPayloadSize_); 01419 } 01420 else { 01421 result= 01422 (FUShmRawCell*)((unsigned int)this+rawCellOffset_+iCell*rawCellTotalSize_); 01423 } 01424 01425 return result; 01426 }
Definition at line 1482 of file FUShmBuffer.cc.
References evtDiscardOffset_, lock(), nRawCells_, HLT_VtxMuL3::result, and unlock().
Referenced by scheduleRawCellForDiscard(), and scheduleRawEmptyCellForDiscard().
01483 { 01484 assert(index<nRawCells_); 01485 unsigned int *pcount=(unsigned int*)((unsigned int)this+evtDiscardOffset_); 01486 pcount+=index; 01487 lock(); 01488 assert(*pcount>0); 01489 --(*pcount); 01490 bool result=(*pcount==0); 01491 unlock(); 01492 return result; 01493 }
key_t FUShmBuffer::rawCellShmKey | ( | unsigned int | iCell | ) | [private] |
Definition at line 1510 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nRawCells_, rawCellOffset_, and shmKey().
Referenced by rawCell(), and releaseSharedMemory().
01511 { 01512 if (iCell>=nRawCells_) { 01513 cout<<"FUShmBuffer::rawCellShmKey() ERROR: " 01514 <<"iCell>=nRawCells: "<<iCell<<">="<<nRawCells_<<endl; 01515 return -1; 01516 } 01517 return shmKey(iCell,rawCellOffset_); 01518 }
FUShmRawCell * FUShmBuffer::rawCellToDiscard | ( | ) |
Definition at line 340 of file FUShmBuffer.cc.
References evf::evt::DISCARDING, evf::evt::EMPTY, evtState(), evf::FUShmRawCell::index(), evf::evt::PROCESSED, rawCell(), rawDiscardIndex_, evf::evt::SENT, setEvtState(), state, and waitRawDiscarded().
Referenced by evf::FUResourceTable::discard().
00341 { 00342 waitRawDiscarded(); 00343 FUShmRawCell* cell=rawCell(rawDiscardIndex_); 00344 evt::State_t state=evtState(cell->index()); 00345 assert(state==evt::PROCESSED||state==evt::SENT||state==evt::EMPTY); 00346 if (state!=evt::EMPTY) setEvtState(cell->index(),evt::DISCARDING); 00347 return cell; 00348 }
FUShmRawCell * FUShmBuffer::rawCellToRead | ( | ) |
Definition at line 295 of file FUShmBuffer.cc.
References evf::evt::EMPTY, evtState(), nextRawReadIndex(), rawCell(), evf::evt::RAWREADING, evf::evt::RAWWRITTEN, setEvtPrcId(), setEvtState(), state, and waitRawRead().
Referenced by evf::FUResourceTable::dropEvent(), and FUShmReader::fillRawData().
00296 { 00297 waitRawRead(); 00298 unsigned int iCell=nextRawReadIndex(); 00299 FUShmRawCell* cell=rawCell(iCell); 00300 evt::State_t state=evtState(iCell); 00301 assert(state==evt::RAWWRITTEN||state==evt::EMPTY); 00302 if (state==evt::RAWWRITTEN) { 00303 setEvtPrcId(iCell,getpid()); 00304 setEvtState(iCell,evt::RAWREADING); 00305 } 00306 return cell; 00307 }
FUShmRawCell * FUShmBuffer::rawCellToWrite | ( | ) |
Definition at line 281 of file FUShmBuffer.cc.
References evf::evt::EMPTY, evtState(), nextRawWriteIndex(), rawCell(), evf::evt::RAWWRITING, setEvtDiscard(), setEvtState(), state, and waitRawWrite().
Referenced by evf::FUResourceTable::buildResource(), scheduleRawEmptyCellForDiscard(), evf::FUShmServer::writeNext(), and writeRawEmptyEvent().
00282 { 00283 waitRawWrite(); 00284 unsigned int iCell=nextRawWriteIndex(); 00285 FUShmRawCell* cell =rawCell(iCell); 00286 evt::State_t state=evtState(iCell); 00287 assert(state==evt::EMPTY); 00288 setEvtState(iCell,evt::RAWWRITING); 00289 setEvtDiscard(iCell,1); 00290 return cell; 00291 }
FUShmRecoCell * FUShmBuffer::recoCell | ( | unsigned int | iCell | ) | [private] |
Definition at line 1430 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nRecoCells_, recoCellOffset_, recoCellPayloadSize_, recoCellShmKey(), recoCellTotalSize_, HLT_VtxMuL3::result, segmentationMode_, shm_attach(), shm_get(), and shmid().
Referenced by discardRecoCell(), initialize(), recoCellToRead(), writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
01431 { 01432 FUShmRecoCell* result(0); 01433 01434 if (iCell>=nRecoCells_) { 01435 cout<<"FUShmBuffer::recoCell("<<iCell<<") ERROR: " 01436 <<"iCell="<<iCell<<" >= nRecoCells="<<nRecoCells_<<endl; 01437 return result; 01438 } 01439 01440 if (segmentationMode_) { 01441 key_t shmkey =recoCellShmKey(iCell); 01442 int shmid =shm_get(shmkey,recoCellTotalSize_); 01443 void* cellAddr=shm_attach(shmid); 01444 result=new (cellAddr) FUShmRecoCell(recoCellPayloadSize_); 01445 } 01446 else { 01447 result= 01448 (FUShmRecoCell*)((unsigned int)this+recoCellOffset_+iCell*recoCellTotalSize_); 01449 } 01450 01451 return result; 01452 }
key_t FUShmBuffer::recoCellShmKey | ( | unsigned int | iCell | ) | [private] |
Definition at line 1522 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nRecoCells_, recoCellOffset_, and shmKey().
Referenced by recoCell(), and releaseSharedMemory().
01523 { 01524 if (iCell>=nRecoCells_) { 01525 cout<<"FUShmBuffer::recoCellShmKey() ERROR: " 01526 <<"iCell>=nRecoCells: "<<iCell<<">="<<nRecoCells_<<endl; 01527 return -1; 01528 } 01529 return shmKey(iCell,recoCellOffset_); 01530 }
FUShmRecoCell * FUShmBuffer::recoCellToRead | ( | ) |
Definition at line 311 of file FUShmBuffer.cc.
References nextRecoReadIndex(), nRawCells_, evf::FUShmRecoCell::rawCellIndex(), recoCell(), evf::evt::SENDING, setEvtState(), and waitRecoRead().
Referenced by evf::FUResourceTable::sendData().
00312 { 00313 waitRecoRead(); 00314 unsigned int iCell =nextRecoReadIndex(); 00315 FUShmRecoCell* cell =recoCell(iCell); 00316 unsigned int iRawCell=cell->rawCellIndex(); 00317 if (iRawCell<nRawCells_) { 00318 //evt::State_t state=evtState(iRawCell); 00319 //assert(state==evt::RECOWRITTEN); 00320 setEvtState(iRawCell,evt::SENDING); 00321 } 00322 return cell; 00323 }
void FUShmBuffer::releaseRawCell | ( | FUShmRawCell * | cell | ) |
Definition at line 455 of file FUShmBuffer.cc.
References evf::FUShmRawCell::clear(), evf::evt::DISCARDING, evf::evt::EMPTY, evtState(), evf::FUShmRawCell::index(), postRawIndexToWrite(), postRawWrite(), evf::evt::RAWWRITING, segmentationMode_, setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), setEvtTimeStamp(), and state.
Referenced by evf::FUResourceTable::buildResource(), and discardRawCell().
00456 { 00457 evt::State_t state=evtState(cell->index()); 00458 assert(state==evt::DISCARDING||state==evt::RAWWRITING||state==evt::EMPTY); 00459 setEvtState(cell->index(),evt::EMPTY); 00460 setEvtDiscard(cell->index(),0); 00461 setEvtNumber(cell->index(),0xffffffff); 00462 setEvtPrcId(cell->index(),0); 00463 setEvtTimeStamp(cell->index(),0); 00464 cell->clear(); 00465 postRawIndexToWrite(cell->index()); 00466 if (segmentationMode_) shmdt(cell); 00467 postRawWrite(); 00468 }
bool FUShmBuffer::releaseSharedMemory | ( | ) | [static] |
Definition at line 860 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, dqmCellShmKey(), lat::endl(), FUShmBuffer(), getSemKey(), getShmDescriptorKey(), getShmKey(), i, int, nDqmCells(), nRawCells(), nRecoCells(), p, rawCellShmKey(), recoCellShmKey(), sem_destroy(), sem_get(), semid(), shm_attach(), shm_destroy(), shm_get(), shm_nattch(), shmid(), size(), and size.
Referenced by createShmBuffer(), and evf::FUResourceTable::~FUResourceTable().
00861 { 00862 // get bookkeeping shared memory segment 00863 int size =sizeof(unsigned int)*7; 00864 int shmidd =shm_get(FUShmBuffer::getShmDescriptorKey(),size); if(shmidd<0) return false; 00865 void* shmAddr=shm_attach(shmidd); if (0==shmAddr) return false; 00866 00867 unsigned int*p=(unsigned int*)shmAddr; 00868 bool segmentationMode=*p++; 00869 unsigned int nRawCells =*p++; 00870 unsigned int nRecoCells =*p++; 00871 unsigned int nDqmCells =*p++; 00872 unsigned int rawCellSize =*p++; 00873 unsigned int recoCellSize =*p++; 00874 unsigned int dqmCellSize =*p++; 00875 shmdt(shmAddr); 00876 00877 00878 // get the 'real' shared memory segment 00879 size =FUShmBuffer::size(segmentationMode, 00880 nRawCells,nRecoCells,nDqmCells, 00881 rawCellSize,recoCellSize,dqmCellSize); 00882 int shmid=shm_get(FUShmBuffer::getShmKey(),size);if (shmid<0) return false; 00883 int semid=sem_get(FUShmBuffer::getSemKey(),9); if (semid<0) return false; 00884 shmAddr =shm_attach(shmid); if (0==shmAddr) return false; 00885 00886 int att = 0; 00887 for(; att <10; att++) 00888 { 00889 if(shm_nattch(shmid)>1) { 00890 cout << att << " FUShmBuffer::releaseSharedMemory(): nattch="<<shm_nattch(shmid) 00891 <<", failed attempt to release shared memory."<<endl; 00892 ::sleep(1); 00893 } 00894 else 00895 break; 00896 } 00897 00898 if(att>=10) return false; 00899 00900 if (segmentationMode) { 00901 FUShmBuffer* buffer= 00902 new (shmAddr) FUShmBuffer(segmentationMode, 00903 nRawCells,nRecoCells,nDqmCells, 00904 rawCellSize,recoCellSize,dqmCellSize); 00905 int cellid; 00906 for (unsigned int i=0;i<nRawCells;i++) { 00907 cellid=shm_get(buffer->rawCellShmKey(i),FUShmRawCell::size(rawCellSize)); 00908 if ((shm_destroy(cellid)==-1)) return false; 00909 } 00910 for (unsigned int i=0;i<nRecoCells;i++) { 00911 cellid=shm_get(buffer->recoCellShmKey(i),FUShmRecoCell::size(recoCellSize)); 00912 if ((shm_destroy(cellid)==-1)) return false; 00913 } 00914 for (unsigned int i=0;i<nDqmCells;i++) { 00915 cellid=shm_get(buffer->dqmCellShmKey(i),FUShmDqmCell::size(dqmCellSize)); 00916 if ((shm_destroy(cellid)==-1)) return false; 00917 } 00918 } 00919 shmdt(shmAddr); 00920 if (sem_destroy(semid)==-1) return false; 00921 if (shm_destroy(shmid)==-1) return false; 00922 if (shm_destroy(shmidd)==-1) return false; 00923 00924 return true; 00925 }
bool FUShmBuffer::removeClientPrcId | ( | pid_t | prcId | ) |
Definition at line 1388 of file FUShmBuffer.cc.
References clientPrcIdOffset_, lock(), nClients_, and unlock().
Referenced by evf::FUResourceTable::handleCrashedEP(), scheduleRawEmptyCellForDiscard(), and FUShmReader::~FUShmReader().
01389 { 01390 lock(); 01391 pid_t *prcid=(pid_t*)((unsigned int)this+clientPrcIdOffset_); 01392 unsigned int iClient(0); 01393 while (iClient<=nClients_&&(*prcid)!=prcId) { prcid++; iClient++; } 01394 assert(iClient!=nClients_); 01395 pid_t* next=prcid; next++; 01396 while (iClient<nClients_-1) { *prcid=*next; prcid++; next++; iClient++; } 01397 nClients_--; 01398 unlock(); 01399 return true; 01400 }
Definition at line 220 of file FUShmBuffer.cc.
References dqmReadLast_, dqmReadNext_, dqmReadOffset_, dqmWriteLast_, dqmWriteNext_, dqmWriteOffset_, evf::dqm::EMPTY, evf::evt::EMPTY, i, nClients_, nDqmCells_, nRawCells_, nRecoCells_, rawReadLast_, rawReadNext_, rawReadOffset_, rawWriteLast_, rawWriteNext_, rawWriteOffset_, recoReadLast_, recoReadNext_, recoReadOffset_, recoWriteLast_, recoWriteNext_, recoWriteOffset_, sem_init(), sem_print(), setDqmState(), setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), and setEvtTimeStamp().
Referenced by initialize().
00221 { 00222 nClients_=0; 00223 00224 // setup ipc semaphores 00225 sem_init(0,1); // lock (binary) 00226 sem_init(1,nRawCells_); // raw write semaphore 00227 sem_init(2,0); // raw read semaphore 00228 sem_init(3,1); // binary semaphore to schedule raw event for discard 00229 sem_init(4,0); // binary semaphore to discard raw event 00230 sem_init(5,nRecoCells_);// reco write semaphore 00231 sem_init(6,0); // reco send (read) semaphore 00232 sem_init(7,nDqmCells_); // dqm write semaphore 00233 sem_init(8,0); // dqm send (read) semaphore 00234 00235 sem_print(); 00236 00237 unsigned int *iWrite,*iRead; 00238 00239 rawWriteNext_=0; rawWriteLast_=0; rawReadNext_ =0; rawReadLast_ =0; 00240 iWrite=(unsigned int*)((unsigned int)this+rawWriteOffset_); 00241 iRead =(unsigned int*)((unsigned int)this+rawReadOffset_); 00242 for (unsigned int i=0;i<nRawCells_;i++) { *iWrite++=i; *iRead++ =0xffffffff; } 00243 00244 recoWriteNext_=0; recoWriteLast_=0; recoReadNext_ =0; recoReadLast_ =0; 00245 iWrite=(unsigned int*)((unsigned int)this+recoWriteOffset_); 00246 iRead =(unsigned int*)((unsigned int)this+recoReadOffset_); 00247 for (unsigned int i=0;i<nRecoCells_;i++) { *iWrite++=i; *iRead++ =0xffffffff; } 00248 00249 dqmWriteNext_=0; dqmWriteLast_=0; dqmReadNext_ =0; dqmReadLast_ =0; 00250 iWrite=(unsigned int*)((unsigned int)this+dqmWriteOffset_); 00251 iRead =(unsigned int*)((unsigned int)this+dqmReadOffset_); 00252 for (unsigned int i=0;i<nDqmCells_;i++) { *iWrite++=i; *iRead++ =0xffffffff; } 00253 00254 for (unsigned int i=0;i<nRawCells_;i++) { 00255 setEvtState(i,evt::EMPTY); 00256 setEvtDiscard(i,0); 00257 setEvtNumber(i,0xffffffff); 00258 setEvtPrcId(i,0); 00259 setEvtTimeStamp(i,0); 00260 } 00261 00262 for (unsigned int i=0;i<nDqmCells_;i++) setDqmState(i,dqm::EMPTY); 00263 }
Definition at line 400 of file FUShmBuffer.cc.
References evf::evt::EMPTY, evtState(), postRawDiscard(), postRawDiscarded(), evf::evt::PROCESSED, evf::evt::PROCESSING, rawCellReadyForDiscard(), rawDiscardIndex_, evf::evt::SENT, setEvtState(), state, and waitRawDiscard().
Referenced by discardRecoCell(), evf::FUResourceTable::dropEvent(), and FUShmReader::fillRawData().
00401 { 00402 waitRawDiscard(); 00403 if (rawCellReadyForDiscard(iCell)) { 00404 rawDiscardIndex_=iCell; 00405 evt::State_t state=evtState(iCell); 00406 assert(state==evt::PROCESSING||state==evt::SENT||state==evt::EMPTY); 00407 if (state==evt::PROCESSING) setEvtState(iCell,evt::PROCESSED); 00408 postRawDiscarded(); 00409 } 00410 else postRawDiscard(); 00411 }
void FUShmBuffer::scheduleRawEmptyCellForDiscard | ( | FUShmRawCell * | cell | ) |
Definition at line 519 of file FUShmBuffer.cc.
References evf::evt::EMPTY, evf::FUShmRawCell::index(), postRawDiscard(), postRawDiscarded(), rawCellReadyForDiscard(), rawDiscardIndex_, removeClientPrcId(), segmentationMode_, setEvtNumber(), setEvtPrcId(), setEvtState(), setEvtTimeStamp(), and waitRawDiscard().
00520 { 00521 waitRawDiscard(); 00522 if (rawCellReadyForDiscard(cell->index())) { 00523 rawDiscardIndex_=cell->index(); 00524 setEvtState(cell->index(),evt::EMPTY); 00525 setEvtNumber(cell->index(),0xffffffff); 00526 setEvtPrcId(cell->index(),0); 00527 setEvtTimeStamp(cell->index(),0); 00528 removeClientPrcId(getpid()); 00529 if (segmentationMode_) shmdt(cell); 00530 postRawDiscarded(); 00531 } 00532 else postRawDiscard(); 00533 }
void FUShmBuffer::scheduleRawEmptyCellForDiscard | ( | ) |
Definition at line 511 of file FUShmBuffer.cc.
References rawCellToWrite().
Referenced by FUShmReader::fillRawData(), and evf::FUResourceTable::shutDownClients().
00512 { 00513 FUShmRawCell* cell=rawCellToWrite(); 00514 scheduleRawEmptyCellForDiscard(cell); 00515 }
Definition at line 1052 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, and semid().
Referenced by createShmBuffer().
01053 { 01054 int semid=semget(key,nsem,IPC_CREAT|0666); 01055 if (semid<0) { 01056 int err=errno; 01057 cout<<"FUShmBuffer::sem_create(key="<<key<<",nsem="<<nsem<<") failed: " 01058 <<strerror(err)<<endl; 01059 } 01060 return semid; 01061 }
Definition at line 1078 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and HLT_VtxMuL3::result.
Referenced by releaseSharedMemory().
01079 { 01080 int result=semctl(semid,0,IPC_RMID); 01081 if (result==-1) cout<<"FUShmBuffer::sem_destroy(semid="<<semid<<") failed."<<endl; 01082 return result; 01083 }
Definition at line 1065 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, and semid().
Referenced by getShmBuffer(), and releaseSharedMemory().
01066 { 01067 int semid=semget(key,nsem,0666); 01068 if (semid<0) { 01069 int err=errno; 01070 cout<<"FUShmBuffer::sem_get(key="<<key<<",nsem="<<nsem<<") failed: " 01071 <<strerror(err)<<endl; 01072 } 01073 return semid; 01074 }
Definition at line 1546 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and semid().
Referenced by reset().
01547 { 01548 if (semctl(semid(),isem,SETVAL,value)<0) { 01549 cout<<"FUShmBuffer: FATAL ERROR in semaphore initialization."<<endl; 01550 } 01551 }
Definition at line 1568 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and semid().
Referenced by postDqmRead(), postDqmWrite(), postRawDiscard(), postRawDiscarded(), postRawRead(), postRawWrite(), postRecoRead(), postRecoWrite(), and unlock().
01569 { 01570 struct sembuf sops[1]; 01571 sops[0].sem_num=isem; 01572 sops[0].sem_op = 1; 01573 sops[0].sem_flg= 0; 01574 if (semop(semid(),sops,1)==-1) { 01575 cout<<"FUShmBuffer: ERROR in semaphore operation sem_post."<<endl; 01576 } 01577 }
void FUShmBuffer::sem_print | ( | ) |
Definition at line 693 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and semid().
Referenced by reset().
00694 { 00695 cout<<"--> current sem values:" 00696 <<endl 00697 <<" lock="<<semctl(semid(),0,GETVAL) 00698 <<endl 00699 <<" wraw="<<semctl(semid(),1,GETVAL) 00700 <<" rraw="<<semctl(semid(),2,GETVAL) 00701 <<endl 00702 <<" wdsc="<<semctl(semid(),3,GETVAL) 00703 <<" rdsc="<<semctl(semid(),4,GETVAL) 00704 <<endl 00705 <<" wrec="<<semctl(semid(),5,GETVAL) 00706 <<" rrec="<<semctl(semid(),6,GETVAL) 00707 <<endl 00708 <<" wdqm="<<semctl(semid(),7,GETVAL) 00709 <<" rdqm="<<semctl(semid(),8,GETVAL) 00710 <<endl; 00711 }
Definition at line 1555 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and semid().
Referenced by lock(), waitDqmRead(), waitDqmWrite(), waitRawDiscard(), waitRawDiscarded(), waitRawRead(), waitRawWrite(), waitRecoRead(), and waitRecoWrite().
01556 { 01557 struct sembuf sops[1]; 01558 sops[0].sem_num=isem; 01559 sops[0].sem_op = -1; 01560 sops[0].sem_flg= 0; 01561 if (semop(semid(),sops,1)==-1) { 01562 cout<<"FUShmBuffer: ERROR in semaphore operation sem_wait."<<endl; 01563 } 01564 }
int evf::FUShmBuffer::semid | ( | ) | const [inline] |
Definition at line 68 of file FUShmBuffer.h.
References semid_.
Referenced by createShmBuffer(), getShmBuffer(), nbRawCellsToRead(), nbRawCellsToWrite(), releaseSharedMemory(), sem_create(), sem_get(), sem_init(), sem_post(), sem_print(), and sem_wait().
00068 { return semid_; }
bool FUShmBuffer::setClientPrcId | ( | pid_t | prcId | ) | [private] |
Definition at line 1371 of file FUShmBuffer.cc.
References clientPrcIdOffset_, i, lock(), nClients_, nClientsMax_, and unlock().
Referenced by getShmBuffer().
01372 { 01373 lock(); 01374 assert(nClients_<nClientsMax_); 01375 pid_t *prcid=(pid_t*)((unsigned int)this+clientPrcIdOffset_); 01376 for (unsigned int i=0;i<nClients_;i++) { 01377 if ((*prcid)==prcId) { unlock(); return false; } 01378 prcid++; 01379 } 01380 nClients_++; 01381 *prcid=prcId; 01382 unlock(); 01383 return true; 01384 }
bool FUShmBuffer::setDqmState | ( | unsigned int | index, | |
dqm::State_t | state | |||
) | [private] |
Definition at line 1291 of file FUShmBuffer.cc.
References dqmStateOffset_, lock(), nDqmCells_, and unlock().
Referenced by discardDqmCell(), dqmCellToRead(), finishReadingDqmCell(), reset(), and writeDqmEventData().
01292 { 01293 assert(index<nDqmCells_); 01294 dqm::State_t *pstate=(dqm::State_t*)((unsigned int)this+dqmStateOffset_); 01295 pstate+=index; 01296 lock(); 01297 *pstate=state; 01298 unlock(); 01299 return true; 01300 }
Definition at line 1304 of file FUShmBuffer.cc.
References evtDiscardOffset_, lock(), nRawCells_, and unlock().
Referenced by rawCellToWrite(), releaseRawCell(), reset(), and writeErrorEventData().
01305 { 01306 assert(index<nRawCells_); 01307 unsigned int *pcount=(unsigned int*)((unsigned int)this+evtDiscardOffset_); 01308 pcount+=index; 01309 lock(); 01310 *pcount=discard; 01311 unlock(); 01312 return true; 01313 }
Definition at line 1332 of file FUShmBuffer.cc.
References evtNumberOffset_, lock(), nRawCells_, and unlock().
Referenced by finishWritingRawCell(), releaseRawCell(), reset(), and scheduleRawEmptyCellForDiscard().
01333 { 01334 assert(index<nRawCells_); 01335 unsigned int *pevt=(unsigned int*)((unsigned int)this+evtNumberOffset_); 01336 pevt+=index; 01337 lock(); 01338 *pevt=evtNumber; 01339 unlock(); 01340 return true; 01341 }
Definition at line 1345 of file FUShmBuffer.cc.
References evtPrcIdOffset_, lock(), nRawCells_, and unlock().
Referenced by rawCellToRead(), releaseRawCell(), reset(), and scheduleRawEmptyCellForDiscard().
01346 { 01347 assert(index<nRawCells_); 01348 pid_t* prcid=(pid_t*)((unsigned int)this+evtPrcIdOffset_); 01349 prcid+=index; 01350 lock(); 01351 *prcid=prcId; 01352 unlock(); 01353 return true; 01354 }
bool FUShmBuffer::setEvtState | ( | unsigned int | index, | |
evt::State_t | state | |||
) |
Definition at line 1278 of file FUShmBuffer.cc.
References evtStateOffset_, lock(), nRawCells_, and unlock().
Referenced by finishReadingRawCell(), finishReadingRecoCell(), finishWritingRawCell(), rawCellToDiscard(), rawCellToRead(), rawCellToWrite(), recoCellToRead(), releaseRawCell(), reset(), scheduleRawCellForDiscard(), scheduleRawEmptyCellForDiscard(), writeErrorEventData(), writeRawEmptyEvent(), and writeRecoEventData().
01279 { 01280 assert(index<nRawCells_); 01281 evt::State_t *pstate=(evt::State_t*)((unsigned int)this+evtStateOffset_); 01282 pstate+=index; 01283 lock(); 01284 *pstate=state; 01285 unlock(); 01286 return true; 01287 }
Definition at line 1358 of file FUShmBuffer.cc.
References evtTimeStampOffset_, lock(), nRawCells_, and unlock().
Referenced by finishReadingRawCell(), releaseRawCell(), reset(), and scheduleRawEmptyCellForDiscard().
01359 { 01360 assert(index<nRawCells_); 01361 time_t *ptstmp=(time_t*)((unsigned int)this+evtTimeStampOffset_); 01362 ptstmp+=index; 01363 lock(); 01364 *ptstmp=timeStamp; 01365 unlock(); 01366 return true; 01367 }
Definition at line 1020 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, NULL, and HLT_VtxMuL3::result.
Referenced by createShmBuffer(), dqmCell(), getShmBuffer(), initialize(), rawCell(), recoCell(), and releaseSharedMemory().
01021 { 01022 void* result=shmat(shmid,NULL,0); 01023 if (0==result) { 01024 int err=errno; 01025 cout<<"FUShmBuffer::shm_attach("<<shmid<<") failed: " 01026 <<strerror(err)<<endl; 01027 } 01028 return result; 01029 }
Definition at line 994 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, and shmid().
Referenced by createShmBuffer(), and initialize().
00995 { 00996 int shmid=shmget(key,size,IPC_CREAT|0644); 00997 if (shmid==-1) { 00998 int err=errno; 00999 cout<<"FUShmBuffer::shm_create("<<key<<","<<size<<") failed: " 01000 <<strerror(err)<<endl; 01001 } 01002 return shmid; 01003 }
Definition at line 1042 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and HLT_VtxMuL3::result.
Referenced by releaseSharedMemory().
01043 { 01044 shmid_ds shmstat; 01045 int result=shmctl(shmid,IPC_RMID,&shmstat); 01046 if (result==-1) cout<<"FUShmBuffer::shm_destroy(shmid="<<shmid<<") failed."<<endl; 01047 return result; 01048 }
Definition at line 1007 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, and shmid().
Referenced by dqmCell(), getShmBuffer(), rawCell(), recoCell(), and releaseSharedMemory().
01008 { 01009 int shmid=shmget(key,size,0644); 01010 if (shmid==-1) { 01011 int err=errno; 01012 cout<<"FUShmBuffer::shm_get("<<key<<","<<size<<") failed: " 01013 <<strerror(err)<<endl; 01014 } 01015 return shmid; 01016 }
Definition at line 1033 of file FUShmBuffer.cc.
Referenced by createShmBuffer(), evf::FUResourceTable::discard(), getShmBuffer(), and releaseSharedMemory().
01034 { 01035 shmid_ds shmstat; 01036 shmctl(shmid,IPC_STAT,&shmstat); 01037 return shmstat.shm_nattch; 01038 }
int evf::FUShmBuffer::shmid | ( | ) | const [inline] |
Definition at line 67 of file FUShmBuffer.h.
References shmid_.
Referenced by createShmBuffer(), evf::FUResourceTable::discard(), dqmCell(), getShmBuffer(), rawCell(), recoCell(), releaseSharedMemory(), shm_create(), and shm_get().
00067 { return shmid_; }
Definition at line 1497 of file FUShmBuffer.cc.
References addr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, and segmentationMode_.
Referenced by dqmCellShmKey(), rawCellShmKey(), and recoCellShmKey().
01498 { 01499 if (!segmentationMode_) { 01500 cout<<"FUShmBuffer::shmKey() ERROR: only valid in segmentationMode!"<<endl; 01501 return -1; 01502 } 01503 key_t* addr=(key_t*)((unsigned int)this+offset); 01504 for (unsigned int i=0;i<iCell;i++) ++addr; 01505 return *addr; 01506 }
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 929 of file FUShmBuffer.cc.
References offset, HLT_VtxMuL3::result, and size.
Referenced by createShmBuffer(), getShmBuffer(), and releaseSharedMemory().
00936 { 00937 unsigned int offset= 00938 sizeof(FUShmBuffer)+ 00939 sizeof(unsigned int)*4*nRawCells+ 00940 sizeof(evt::State_t)*nRawCells+ 00941 sizeof(dqm::State_t)*nDqmCells; 00942 00943 unsigned int rawCellTotalSize=FUShmRawCell::size(rawCellSize); 00944 unsigned int recoCellTotalSize=FUShmRecoCell::size(recoCellSize); 00945 unsigned int dqmCellTotalSize=FUShmDqmCell::size(dqmCellSize); 00946 00947 unsigned int realSize = 00948 (segmentationMode) ? 00949 offset 00950 +sizeof(key_t)*(nRawCells+nRecoCells+nDqmCells) 00951 : 00952 offset 00953 +rawCellTotalSize*nRawCells 00954 +recoCellTotalSize*nRecoCells 00955 +dqmCellTotalSize*nDqmCells; 00956 00957 unsigned int result=realSize/0x10*0x10 + (realSize%0x10>0)*0x10; 00958 00959 return result; 00960 }
Definition at line 239 of file FUShmBuffer.h.
References sem_post().
Referenced by evf::FUResourceTable::cellEvtNumbers(), evf::FUResourceTable::cellPrcIds(), evf::FUResourceTable::cellStates(), evf::FUResourceTable::cellTimeStamps(), incEvtDiscard(), nextIndex(), postIndex(), rawCellReadyForDiscard(), removeClientPrcId(), setClientPrcId(), setDqmState(), setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), and setEvtTimeStamp().
00239 { sem_post(0); }
void evf::FUShmBuffer::waitDqmRead | ( | ) | [inline, private] |
Definition at line 255 of file FUShmBuffer.h.
References sem_wait().
Referenced by dqmCellToRead().
00255 { sem_wait(8); }
void evf::FUShmBuffer::waitDqmWrite | ( | ) | [inline, private] |
Definition at line 253 of file FUShmBuffer.h.
References sem_wait().
Referenced by writeDqmEmptyEvent(), and writeDqmEventData().
00253 { sem_wait(7); }
void evf::FUShmBuffer::waitRawDiscard | ( | ) | [inline, private] |
Definition at line 245 of file FUShmBuffer.h.
References sem_wait().
Referenced by scheduleRawCellForDiscard(), and scheduleRawEmptyCellForDiscard().
00245 { sem_wait(3); }
void evf::FUShmBuffer::waitRawDiscarded | ( | ) | [inline, private] |
Definition at line 247 of file FUShmBuffer.h.
References sem_wait().
Referenced by rawCellToDiscard().
00247 { sem_wait(4); }
void evf::FUShmBuffer::waitRawRead | ( | ) | [inline, private] |
Definition at line 243 of file FUShmBuffer.h.
References sem_wait().
Referenced by rawCellToRead().
00243 { sem_wait(2); }
void evf::FUShmBuffer::waitRawWrite | ( | ) | [inline, private] |
Definition at line 241 of file FUShmBuffer.h.
References sem_wait().
Referenced by rawCellToWrite().
00241 { sem_wait(1); }
void evf::FUShmBuffer::waitRecoRead | ( | ) | [inline, private] |
Definition at line 251 of file FUShmBuffer.h.
References sem_wait().
Referenced by recoCellToRead().
00251 { sem_wait(6); }
void evf::FUShmBuffer::waitRecoWrite | ( | ) | [inline, private] |
Definition at line 249 of file FUShmBuffer.h.
References sem_wait().
Referenced by writeErrorEventData(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
00249 { sem_wait(5); }
void FUShmBuffer::writeDqmEmptyEvent | ( | ) |
Definition at line 498 of file FUShmBuffer.cc.
References evf::FUShmDqmCell::clear(), dqmCell(), nextDqmWriteIndex(), postDqmIndexToRead(), postDqmRead(), segmentationMode_, and waitDqmWrite().
Referenced by evf::FUResourceTable::discard().
00499 { 00500 waitDqmWrite(); 00501 unsigned int iCell=nextDqmWriteIndex(); 00502 FUShmDqmCell* cell=dqmCell(iCell); 00503 cell->clear(); 00504 postDqmIndexToRead(iCell); 00505 if (segmentationMode_) shmdt(cell); 00506 postDqmRead(); 00507 }
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 664 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, dqmCell(), dqmCellPayloadSize_, dqmState(), evf::dqm::EMPTY, lat::endl(), nextDqmWriteIndex(), postDqmIndexToRead(), postDqmRead(), segmentationMode_, setDqmState(), state, waitDqmWrite(), evf::FUShmDqmCell::writeData(), evf::dqm::WRITING, and evf::dqm::WRITTEN.
Referenced by FUShmDQMOutputService::writeShmDQMData().
00671 { 00672 if (dataSize>dqmCellPayloadSize_) { 00673 cout<<"FUShmBuffer::writeDqmEventData() ERROR: buffer overflow."<<endl; 00674 return false; 00675 } 00676 00677 waitDqmWrite(); 00678 unsigned int iCell=nextDqmWriteIndex(); 00679 FUShmDqmCell* cell=dqmCell(iCell); 00680 dqm::State_t state=dqmState(iCell); 00681 assert(state==dqm::EMPTY); 00682 setDqmState(iCell,dqm::WRITING); 00683 cell->writeData(runNumber,evtAtUpdate,folderId,fuProcessId,fuGuid,data,dataSize); 00684 setDqmState(iCell,dqm::WRITTEN); 00685 postDqmIndexToRead(iCell); 00686 if (segmentationMode_) shmdt(cell); 00687 postDqmRead(); 00688 return true; 00689 }
bool FUShmBuffer::writeErrorEventData | ( | unsigned int | runNumber, | |
unsigned int | fuProcessId, | |||
unsigned int | iRawCell | |||
) |
Definition at line 592 of file FUShmBuffer.cc.
References data, evf::FUShmRawCell::eventSize(), evf::FUShmRawCell::evtNumber(), evf::FUShmRawCell::fedSize(), i, nextRecoWriteIndex(), evf::FUShmRawCell::payloadAddr(), postRecoIndexToRead(), postRecoRead(), rawCell(), HcalSimpleRecAlgoImpl::reco(), recoCell(), evf::evt::RECOWRITING, evf::evt::RECOWRITTEN, segmentationMode_, setEvtDiscard(), setEvtState(), waitRecoWrite(), and evf::FUShmRecoCell::writeErrorEvent().
Referenced by evf::FUResourceTable::handleCrashedEP(), and FUShmReader::~FUShmReader().
00595 { 00596 FUShmRawCell *raw=rawCell(iRawCell); 00597 00598 unsigned int dataSize=sizeof(uint32_t)*(4+1024)+raw->eventSize(); 00599 unsigned char *data =new unsigned char[dataSize]; 00600 uint32_t *pos =(uint32_t*)data; 00601 // 06-Oct-2008, KAB - added a version number for the error event format. 00602 // 00603 // Version 1 had no version number, so the run number appeared in the 00604 // first value. So, a reasonable test for version 1 is whether the 00605 // first value is larger than some relatively small cutoff (say 32). 00606 // Version 2 added the lumi block number. 00607 // 00608 *pos++=(uint32_t)2; // protocol version number 00609 *pos++=(uint32_t)runNumber; 00610 // 06-Oct-2008, KAB - added space for lumi block number, but I don't know 00611 // exactly how to get its value just yet... 00612 *pos++=(uint32_t)1; //evf::evtn::getlbn(fedAddr(/* which FED ID? */)); 00613 *pos++=(uint32_t)raw->evtNumber(); 00614 for (unsigned int i=0;i<1024;i++) *pos++ = (uint32_t)raw->fedSize(i); 00615 memcpy(pos,raw->payloadAddr(),raw->eventSize()); 00616 00617 // DEBUG 00618 /* 00619 if (1) { 00620 stringstream ss; 00621 ss<<"/tmp/run"<<runNumber<<"_evt"<<raw->evtNumber()<<".err"; 00622 ofstream fout; 00623 fout.open(ss.str().c_str(),ios::out|ios::binary); 00624 if (!fout.write((char*)data,dataSize)) 00625 cout<<"Failed to write error event to "<<ss.str()<<endl; 00626 fout.close(); 00627 00628 stringstream ss2; 00629 ss2<<"/tmp/run"<<runNumber<<"_evt"<<raw->evtNumber()<<".info"; 00630 ofstream fout2; 00631 fout2.open(ss2.str().c_str()); 00632 fout2<<"dataSize = "<<dataSize<<endl; 00633 fout2<<"runNumber = "<<runNumber<<endl; 00634 fout2<<"evtNumber = "<<raw->evtNumber()<<endl; 00635 fout2<<"eventSize = "<<raw->eventSize()<<endl; 00636 unsigned int totalSize(0); 00637 for (unsigned int i=0;i<1024;i++) { 00638 unsigned int fedSize = raw->fedSize(i); 00639 totalSize += fedSize; 00640 if (fedSize>0) fout2<<i<<": "<<fedSize<<endl; 00641 } 00642 fout2<<"totalSize = "<<totalSize<<endl; 00643 fout2.close(); 00644 } 00645 */// END DEBUG 00646 00647 waitRecoWrite(); 00648 unsigned int iRecoCell=nextRecoWriteIndex(); 00649 FUShmRecoCell* reco =recoCell(iRecoCell); 00650 setEvtState(iRawCell,evt::RECOWRITING); 00651 setEvtDiscard(iRawCell,1); 00652 reco->writeErrorEvent(iRawCell,runNumber,raw->evtNumber(),fuProcessId, 00653 data,dataSize); 00654 delete [] data; 00655 setEvtState(iRawCell,evt::RECOWRITTEN); 00656 postRecoIndexToRead(iRecoCell); 00657 if (segmentationMode_) { shmdt(raw); shmdt(reco); } 00658 postRecoRead(); 00659 return true; 00660 }
void FUShmBuffer::writeRawEmptyEvent | ( | ) |
Definition at line 472 of file FUShmBuffer.cc.
References evf::evt::EMPTY, evtState(), evf::FUShmRawCell::index(), postRawIndexToRead(), postRawRead(), rawCellToWrite(), evf::evt::RAWWRITING, segmentationMode_, setEvtState(), and state.
Referenced by evf::FUResourceTable::shutDownClients().
00473 { 00474 FUShmRawCell* cell=rawCellToWrite(); 00475 evt::State_t state=evtState(cell->index()); 00476 assert(state==evt::RAWWRITING); 00477 setEvtState(cell->index(),evt::EMPTY); 00478 postRawIndexToRead(cell->index()); 00479 if (segmentationMode_) shmdt(cell); 00480 postRawRead(); 00481 }
void FUShmBuffer::writeRecoEmptyEvent | ( | ) |
Definition at line 485 of file FUShmBuffer.cc.
References evf::FUShmRecoCell::clear(), nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), segmentationMode_, and waitRecoWrite().
Referenced by evf::FUResourceTable::discard().
00486 { 00487 waitRecoWrite(); 00488 unsigned int iCell=nextRecoWriteIndex(); 00489 FUShmRecoCell* cell =recoCell(iCell); 00490 cell->clear(); 00491 postRecoIndexToRead(iCell); 00492 if (segmentationMode_) shmdt(cell); 00493 postRecoRead(); 00494 }
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 560 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), incEvtDiscard(), indexForEvtNumber(), nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), recoCellPayloadSize_, evf::evt::RECOWRITING, evf::evt::RECOWRITTEN, segmentationMode_, setEvtState(), waitRecoWrite(), and evf::FUShmRecoCell::writeEventData().
Referenced by edm::FUShmOutputModule::doOutputEvent().
00567 { 00568 if (dataSize>recoCellPayloadSize_) { 00569 cout<<"FUShmBuffer::writeRecoEventData() ERROR: buffer overflow."<<endl; 00570 return false; 00571 } 00572 00573 waitRecoWrite(); 00574 unsigned int iCell=nextRecoWriteIndex(); 00575 FUShmRecoCell* cell =recoCell(iCell); 00576 unsigned int rawCellIndex=indexForEvtNumber(evtNumber); 00577 //evt::State_t state=evtState(rawCellIndex); 00578 //assert(state==evt::PROCESSING||state==evt::RECOWRITING||state==evt::SENT); 00579 setEvtState(rawCellIndex,evt::RECOWRITING); 00580 incEvtDiscard(rawCellIndex); 00581 cell->writeEventData(rawCellIndex,runNumber,evtNumber,outModId, 00582 fuProcessId,fuGuid,data,dataSize); 00583 setEvtState(rawCellIndex,evt::RECOWRITTEN); 00584 postRecoIndexToRead(iCell); 00585 if (segmentationMode_) shmdt(cell); 00586 postRecoRead(); 00587 return true; 00588 }
bool FUShmBuffer::writeRecoInitMsg | ( | unsigned int | outModId, | |
unsigned int | fuProcessId, | |||
unsigned int | fuGuid, | |||
unsigned char * | data, | |||
unsigned int | dataSize | |||
) |
Definition at line 537 of file FUShmBuffer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), nextRecoWriteIndex(), postRecoIndexToRead(), postRecoRead(), recoCell(), recoCellPayloadSize_, segmentationMode_, waitRecoWrite(), and evf::FUShmRecoCell::writeInitMsg().
Referenced by edm::FUShmOutputModule::doOutputHeader().
00542 { 00543 if (dataSize>recoCellPayloadSize_) { 00544 cout<<"FUShmBuffer::writeRecoInitMsg() ERROR: buffer overflow."<<endl; 00545 return false; 00546 } 00547 00548 waitRecoWrite(); 00549 unsigned int iCell=nextRecoWriteIndex(); 00550 FUShmRecoCell* cell =recoCell(iCell); 00551 cell->writeInitMsg(outModId,fuProcessId,fuGuid,data,dataSize); 00552 postRecoIndexToRead(iCell); 00553 if (segmentationMode_) shmdt(cell); 00554 postRecoRead(); 00555 return true; 00556 }
unsigned int evf::FUShmBuffer::clientPrcIdOffset_ [private] |
Definition at line 298 of file FUShmBuffer.h.
Referenced by clientPrcId(), FUShmBuffer(), removeClientPrcId(), and setClientPrcId().
unsigned int evf::FUShmBuffer::dqmCellOffset_ [private] |
Definition at line 317 of file FUShmBuffer.h.
Referenced by dqmCell(), dqmCellShmKey(), FUShmBuffer(), and initialize().
unsigned int evf::FUShmBuffer::dqmCellPayloadSize_ [private] |
Definition at line 315 of file FUShmBuffer.h.
Referenced by dqmCell(), FUShmBuffer(), initialize(), and writeDqmEventData().
unsigned int evf::FUShmBuffer::dqmCellTotalSize_ [private] |
Definition at line 316 of file FUShmBuffer.h.
Referenced by dqmCell(), FUShmBuffer(), and initialize().
unsigned int evf::FUShmBuffer::dqmReadIndex_ [private] |
Definition at line 313 of file FUShmBuffer.h.
unsigned int evf::FUShmBuffer::dqmReadLast_ [private] |
unsigned int evf::FUShmBuffer::dqmReadNext_ [private] |
unsigned int evf::FUShmBuffer::dqmReadOffset_ [private] |
Definition at line 287 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextDqmReadIndex(), postDqmIndexToRead(), and reset().
unsigned int evf::FUShmBuffer::dqmStateOffset_ [private] |
Definition at line 294 of file FUShmBuffer.h.
Referenced by dqmState(), FUShmBuffer(), and setDqmState().
unsigned int evf::FUShmBuffer::dqmWriteIndex_ [private] |
Definition at line 312 of file FUShmBuffer.h.
unsigned int evf::FUShmBuffer::dqmWriteLast_ [private] |
unsigned int evf::FUShmBuffer::dqmWriteNext_ [private] |
unsigned int evf::FUShmBuffer::dqmWriteOffset_ [private] |
Definition at line 284 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextDqmWriteIndex(), postDqmIndexToWrite(), and reset().
unsigned int evf::FUShmBuffer::evtDiscardOffset_ [private] |
Definition at line 290 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), incEvtDiscard(), rawCellReadyForDiscard(), and setEvtDiscard().
unsigned int evf::FUShmBuffer::evtNumberOffset_ [private] |
Definition at line 291 of file FUShmBuffer.h.
Referenced by evtNumber(), FUShmBuffer(), indexForEvtNumber(), and setEvtNumber().
unsigned int evf::FUShmBuffer::evtPrcIdOffset_ [private] |
Definition at line 292 of file FUShmBuffer.h.
Referenced by evtPrcId(), FUShmBuffer(), and setEvtPrcId().
unsigned int evf::FUShmBuffer::evtStateOffset_ [private] |
Definition at line 289 of file FUShmBuffer.h.
Referenced by evtState(), FUShmBuffer(), and setEvtState().
unsigned int evf::FUShmBuffer::evtTimeStampOffset_ [private] |
Definition at line 293 of file FUShmBuffer.h.
Referenced by evtTimeStamp(), FUShmBuffer(), and setEvtTimeStamp().
unsigned int evf::FUShmBuffer::nClients_ [private] |
Definition at line 296 of file FUShmBuffer.h.
Referenced by nClients(), removeClientPrcId(), reset(), and setClientPrcId().
unsigned int evf::FUShmBuffer::nClientsMax_ [private] |
Definition at line 297 of file FUShmBuffer.h.
Referenced by clientPrcId(), FUShmBuffer(), and setClientPrcId().
unsigned int evf::FUShmBuffer::nDqmCells_ [private] |
Definition at line 314 of file FUShmBuffer.h.
Referenced by dqmCell(), dqmCellShmKey(), dqmState(), FUShmBuffer(), initialize(), nDqmCells(), nextDqmReadIndex(), nextDqmWriteIndex(), postDqmIndexToRead(), postDqmIndexToWrite(), reset(), and setDqmState().
unsigned int evf::FUShmBuffer::nRawCells_ [private] |
Definition at line 300 of file FUShmBuffer.h.
Referenced by discardRecoCell(), evtNumber(), evtPrcId(), evtState(), evtTimeStamp(), finishReadingRecoCell(), FUShmBuffer(), incEvtDiscard(), indexForEvtNumber(), initialize(), nextRawReadIndex(), nextRawWriteIndex(), nRawCells(), postRawIndexToRead(), postRawIndexToWrite(), rawCell(), rawCellReadyForDiscard(), rawCellShmKey(), recoCellToRead(), reset(), setEvtDiscard(), setEvtNumber(), setEvtPrcId(), setEvtState(), and setEvtTimeStamp().
unsigned int evf::FUShmBuffer::nRecoCells_ [private] |
Definition at line 307 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), nextRecoReadIndex(), nextRecoWriteIndex(), nRecoCells(), postRecoIndexToRead(), postRecoIndexToWrite(), recoCell(), recoCellShmKey(), and reset().
unsigned int evf::FUShmBuffer::rawCellOffset_ [private] |
Definition at line 303 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), rawCell(), and rawCellShmKey().
unsigned int evf::FUShmBuffer::rawCellPayloadSize_ [private] |
Definition at line 301 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), and rawCell().
unsigned int evf::FUShmBuffer::rawCellTotalSize_ [private] |
Definition at line 302 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), and rawCell().
unsigned int evf::FUShmBuffer::rawDiscardIndex_ [private] |
Definition at line 273 of file FUShmBuffer.h.
Referenced by rawCellToDiscard(), scheduleRawCellForDiscard(), and scheduleRawEmptyCellForDiscard().
unsigned int evf::FUShmBuffer::rawReadLast_ [private] |
unsigned int evf::FUShmBuffer::rawReadNext_ [private] |
unsigned int evf::FUShmBuffer::rawReadOffset_ [private] |
Definition at line 272 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextRawReadIndex(), postRawIndexToRead(), and reset().
unsigned int evf::FUShmBuffer::rawWriteLast_ [private] |
unsigned int evf::FUShmBuffer::rawWriteNext_ [private] |
unsigned int evf::FUShmBuffer::rawWriteOffset_ [private] |
Definition at line 269 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextRawWriteIndex(), postRawIndexToWrite(), and reset().
unsigned int evf::FUShmBuffer::recoCellOffset_ [private] |
Definition at line 310 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), recoCell(), and recoCellShmKey().
unsigned int evf::FUShmBuffer::recoCellPayloadSize_ [private] |
Definition at line 308 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), recoCell(), writeRecoEventData(), and writeRecoInitMsg().
unsigned int evf::FUShmBuffer::recoCellTotalSize_ [private] |
Definition at line 309 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), initialize(), and recoCell().
unsigned int evf::FUShmBuffer::recoReadIndex_ [private] |
Definition at line 306 of file FUShmBuffer.h.
unsigned int evf::FUShmBuffer::recoReadLast_ [private] |
unsigned int evf::FUShmBuffer::recoReadNext_ [private] |
unsigned int evf::FUShmBuffer::recoReadOffset_ [private] |
Definition at line 280 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextRecoReadIndex(), postRecoIndexToRead(), and reset().
unsigned int evf::FUShmBuffer::recoWriteIndex_ [private] |
Definition at line 305 of file FUShmBuffer.h.
unsigned int evf::FUShmBuffer::recoWriteLast_ [private] |
unsigned int evf::FUShmBuffer::recoWriteNext_ [private] |
unsigned int evf::FUShmBuffer::recoWriteOffset_ [private] |
Definition at line 277 of file FUShmBuffer.h.
Referenced by FUShmBuffer(), nextRecoWriteIndex(), postRecoIndexToWrite(), and reset().
bool evf::FUShmBuffer::segmentationMode_ [private] |
Definition at line 263 of file FUShmBuffer.h.
Referenced by discardDqmCell(), discardRecoCell(), dqmCell(), finishReadingDqmCell(), finishReadingRawCell(), finishReadingRecoCell(), finishWritingRawCell(), FUShmBuffer(), initialize(), rawCell(), recoCell(), releaseRawCell(), scheduleRawEmptyCellForDiscard(), shmKey(), writeDqmEmptyEvent(), writeDqmEventData(), writeErrorEventData(), writeRawEmptyEvent(), writeRecoEmptyEvent(), writeRecoEventData(), and writeRecoInitMsg().
int evf::FUShmBuffer::semid_ [private] |
const char * FUShmBuffer::semKeyPath_ [static, private] |
Initial value:
(getenv("FUSEM_KEYFILE") == NULL ? "/dev/null" : getenv("FUSEM_KEYFILE"))
Definition at line 320 of file FUShmBuffer.h.
Referenced by getSemKey().
int evf::FUShmBuffer::shmid_ [private] |
const char * FUShmBuffer::shmKeyPath_ [static, private] |
Initial value:
(getenv("FUSHM_KEYFILE") == NULL ? "/dev/null" : getenv("FUSHM_KEYFILE"))
Definition at line 319 of file FUShmBuffer.h.
Referenced by getShmDescriptorKey(), getShmKey(), and initialize().