Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifndef FURESOURCETABLE_H
00011 #define FURESOURCETABLE_H 1
00012
00013 #include "EventFilter/ResourceBroker/interface/BUProxy.h"
00014 #include "EventFilter/ResourceBroker/interface/SMProxy.h"
00015 #include "EventFilter/ResourceBroker/interface/FUTypes.h"
00016 #include "EventFilter/ShmBuffer/interface/FUShmBuffer.h"
00017 #include "EventFilter/Utilities/interface/Exception.h"
00018
00019 #include "log4cplus/logger.h"
00020 #include "toolbox/lang/Class.h"
00021 #include "toolbox/task/Action.h"
00022 #include "toolbox/task/WorkLoop.h"
00023
00024 #include <sys/types.h>
00025 #include <string>
00026 #include <vector>
00027 #include <queue>
00028
00029 #include "IPCMethod.h"
00030
00031 namespace evf {
00032
00040 class FUResourceTable: public IPCMethod {
00041 public:
00042
00043
00044
00045 FUResourceTable(bool segmentationMode, UInt_t nbRawCells,
00046 UInt_t nbRecoCells, UInt_t nbDqmCells, UInt_t rawCellSize,
00047 UInt_t recoCellSize, UInt_t dqmCellSize, int freeResReq, BUProxy* bu, SMProxy* sm,
00048 log4cplus::Logger logger, unsigned int, EvffedFillerRB* frb,
00049 xdaq::Application*) throw (evf::Exception);
00050 virtual ~FUResourceTable();
00051
00052
00053
00054
00055
00059 void initialize(bool segmentationMode, UInt_t nbRawCells,
00060 UInt_t nbRecoCells, UInt_t nbDqmCells, UInt_t rawCellSize,
00061 UInt_t recoCellSize, UInt_t dqmCellSize) throw (evf::Exception);
00062
00066 bool sendData();
00070 bool sendDataWhileHalting();
00071
00075 bool sendDqm();
00079 bool sendDqmWhileHalting();
00080
00084 bool discard();
00088 bool discardWhileHalting(bool sendDiscards);
00089
00093 bool buildResource(MemRef_t* bufRef);
00094
00098 bool discardDataEvent(MemRef_t* bufRef);
00099
00103 bool discardDataEventWhileHalting(MemRef_t* bufRef);
00104
00108 bool discardDqmEvent(MemRef_t* bufRef);
00112 bool discardDqmEventWhileHalting(MemRef_t* bufRef);
00113
00117 void postEndOfLumiSection(MemRef_t* bufRef);
00118
00122 void dropEvent();
00123
00128 bool handleCrashedEP(UInt_t runNumber, pid_t pid);
00129
00133 void shutDownClients();
00134
00138 void clear();
00139
00143 void resetCounters();
00144
00145 UInt_t nbResources() const {
00146 return resources_.size();
00147 }
00148
00149
00150 UInt_t nbClients() const;
00151 std::vector<pid_t> clientPrcIds() const;
00152 std::string clientPrcIdsAsString() const;
00153 std::vector<std::string> cellStates() const;
00154 std::vector<std::string> dqmCellStates() const;
00155 std::vector<UInt_t> cellEvtNumbers() const;
00156 std::vector<pid_t> cellPrcIds() const;
00157 std::vector<time_t> cellTimeStamps() const;
00158
00159
00160
00161
00162 unsigned int nbResources() {
00163 return resources_.size();
00164 }
00165 void lastResort();
00167 void resetIPC();
00168
00169
00170 std::string printStatus();
00171
00172 private:
00173
00178 void discardNoReschedule();
00179
00183 void rethrowShmBufferException(evf::Exception& e, std::string where) const throw (evf::Exception);
00184
00188 void shutdownWatchdog(unsigned int timeout);
00189
00190
00191 FUShmBuffer *shmBuffer_;
00192
00193
00194 bool sDataActive_;
00195 bool sDqmActive_;
00196
00197 std::atomic_bool watchDogEnd_;
00198 std::atomic_bool watchDogSetFailed_;
00199
00200
00201 };
00202
00203 }
00204
00205
00206 #endif