CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataSenderMonitorCollection.h
Go to the documentation of this file.
1 // $Id: DataSenderMonitorCollection.h,v 1.20 2012/04/20 10:48:18 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_DataSenderMonitorCollection_h
5 #define EventFilter_StorageManager_DataSenderMonitorCollection_h
6 
7 #include <map>
8 
9 #include "xdata/UnsignedInteger32.h"
10 #include "xdata/Integer32.h"
11 
12 #include <boost/thread/mutex.hpp>
13 #include <boost/shared_ptr.hpp>
14 
19 
20 namespace stor {
21 
32  {
33  public:
34 
39  {
40  bool isValid;
41  std::string hltURL;
42  uint32_t hltTid;
43  uint32_t hltInstance;
44  uint32_t hltLocalId;
45  std::string hltClassName;
46 
47  explicit ResourceBrokerKey(I2OChain const& i2oChain)
48  {
49  if (i2oChain.messageCode() != Header::INVALID)
50  {
51  isValid = true;
52  hltURL = i2oChain.hltURL();
53  hltTid = i2oChain.hltTid();
54  hltInstance = i2oChain.hltInstance();
55  hltLocalId = i2oChain.hltLocalId();
56  hltClassName = i2oChain.hltClassName();
57  }
58  else
59  {
60  isValid = false;
61  }
62  }
63 
64  bool operator<(ResourceBrokerKey const& other) const
65  {
66  if (isValid != other.isValid) return isValid < other.isValid;
67  if (hltURL != other.hltURL) return hltURL < other.hltURL;
68  if (hltTid != other.hltTid) return hltTid < other.hltTid;
69  if (hltInstance != other.hltInstance) return hltInstance < other.hltInstance;
70  if (hltLocalId != other.hltLocalId) return hltLocalId < other.hltLocalId;
71  return hltClassName < other.hltClassName;
72  }
73  };
74 
79  {
80  bool isValid;
81  uint32_t fuProcessId;
82  uint32_t fuGuid;
83 
84  explicit FilterUnitKey(I2OChain const& i2oChain)
85  {
86  if (i2oChain.messageCode() != Header::INVALID)
87  {
88  isValid = true;
89  fuProcessId = i2oChain.fuProcessId();
90  fuGuid = i2oChain.fuGuid();
91  }
92  else
93  {
94  isValid = false;
95  }
96  }
97 
98  bool operator<(FilterUnitKey const& other) const
99  {
100  if (isValid != other.isValid) return isValid < other.isValid;
101 
102  // 30-Jun-2009, KAB - we want to keep stats for each filter unit without
103  // separating out the output modules. So, we should only use the process ID
104  // in the key. (The GUID is different for each output module.)
105  //if (fuProcessId != other.fuProcessId) return fuProcessId < other.fuProcessId;
106  //return fuGuid < other.fuGuid;
107 
108  return fuProcessId < other.fuProcessId;
109  }
110  };
111 
115  typedef uint32_t OutputModuleKey;
116 
117 
122  {
123  std::string name;
125  uint32_t initMsgSize;
128 
129  OutputModuleRecord(const utils::Duration_t& updateInterval) :
130  fragmentSize(updateInterval,boost::posix_time::seconds(10)),
131  eventSize(updateInterval,boost::posix_time::seconds(10)) {}
132  };
133  typedef boost::shared_ptr<OutputModuleRecord> OutModRecordPtr;
134  typedef std::map<OutputModuleKey, OutModRecordPtr> OutputModuleRecordMap;
135 
140  {
152  uint32_t initMsgCount;
153  uint32_t lastRunNumber;
155 
156  explicit FilterUnitRecord
157  (
158  FilterUnitKey fuKey,
159  const utils::Duration_t& updateInterval
160  ) :
161  key(fuKey),
164  dqmEventSize(updateInterval,boost::posix_time::seconds(10)),
165  errorEventSize(updateInterval,boost::posix_time::seconds(10)),
166  faultyEventSize(updateInterval,boost::posix_time::seconds(10)),
168  dataDiscardCount(updateInterval,boost::posix_time::seconds(10)),
169  dqmDiscardCount(updateInterval,boost::posix_time::seconds(10)),
172  };
173  typedef boost::shared_ptr<FilterUnitRecord> FURecordPtr;
174 
179  {
181  std::map<FilterUnitKey, FURecordPtr> filterUnitMap;
191  uint32_t nExpectedEPs;
192  uint32_t initMsgCount;
193  uint32_t lastRunNumber;
195 
196  explicit ResourceBrokerRecord
197  (
198  ResourceBrokerKey rbKey,
199  const utils::Duration_t& updateInterval
200  ) :
201  key(rbKey),
202  eventSize(updateInterval,boost::posix_time::seconds(10)),
203  dqmEventSize(updateInterval,boost::posix_time::seconds(10)),
204  errorEventSize(updateInterval,boost::posix_time::seconds(10)),
205  faultyEventSize(updateInterval,boost::posix_time::seconds(10)),
207  dataDiscardCount(updateInterval,boost::posix_time::seconds(10)),
208  dqmDiscardCount(updateInterval,boost::posix_time::seconds(10)),
211  };
212  typedef boost::shared_ptr<ResourceBrokerRecord> RBRecordPtr;
213 
214 
219  {
220  std::string name;
222  uint32_t initMsgSize;
224  };
225  typedef std::vector< boost::shared_ptr<OutputModuleResult> >
227 
231  typedef long long UniqueResourceBrokerID_t;
233  {
235  uint32_t filterUnitCount;
236  uint32_t initMsgCount;
237  uint32_t lastRunNumber;
250 
251  explicit ResourceBrokerResult(ResourceBrokerKey const& rbKey):
252  key(rbKey), filterUnitCount(0), initMsgCount(0),
255 
256  bool operator<(ResourceBrokerResult const& other) const
257  {
258  return key < other.key;
259  }
260  };
261  typedef boost::shared_ptr<ResourceBrokerResult> RBResultPtr;
262  typedef std::vector<RBResultPtr> ResourceBrokerResultsList;
263 
268  {
270  uint32_t initMsgCount;
271  uint32_t lastRunNumber;
284 
285  explicit FilterUnitResult(FilterUnitKey const& fuKey):
286  key(fuKey), initMsgCount(0), lastRunNumber(0), lastEventNumber(0),
288  };
289  typedef boost::shared_ptr<FilterUnitResult> FUResultPtr;
290  typedef std::vector<FUResultPtr> FilterUnitResultsList;
291 
292 
297  (
298  const utils::Duration_t& updateInterval,
300  );
301 
305  void addInitSample(I2OChain const&);
306 
310  void addEventSample(I2OChain const&);
311 
315  void addDQMEventSample(I2OChain const&);
316 
320  void addErrorEventSample(I2OChain const&);
321 
325  void addFaultyEventSample(I2OChain const&);
326 
330  void incrementDataDiscardCount(I2OChain const&);
331 
335  void incrementDQMDiscardCount(I2OChain const&);
336 
341 
346 
351 
356 
361 
366 
370  size_t getConnectedEPs() const;
371 
372 
373  private:
374 
375  //Prevent copying of the DataSenderMonitorCollection
378 
379  virtual void do_calculateStatistics();
380  virtual void do_reset();
382  virtual void do_updateInfoSpaceItems();
383 
384  void faultyEventsAlarm(const uint32_t&) const;
385  void ignoredDiscardAlarm(const uint32_t&) const;
386 
387  bool getAllNeededPointers(I2OChain const& i2oChain,
388  RBRecordPtr& rbRecordPtr,
389  FURecordPtr& fuRecordPtr,
390  OutModRecordPtr& topLevelOutModPtr,
391  OutModRecordPtr& rbSpecificOutModPtr,
392  OutModRecordPtr& fuSpecificOutModPtr);
393 
394  bool getRBRecordPointer(I2OChain const& i2oChain,
395  RBRecordPtr& rbRecordPtr);
396 
397  bool getFURecordPointer(I2OChain const& i2oChain,
398  RBRecordPtr& rbRecordPtr,
399  FURecordPtr& fuRecordPtr);
400 
403 
405 
407  OutputModuleKey const&);
408 
410 
412 
413  void calcStatsForOutputModules(OutputModuleRecordMap& outputModuleMap);
414 
416 
417  xdata::UnsignedInteger32 connectedRBs_;
418  xdata::UnsignedInteger32 connectedEPs_;
419  xdata::UnsignedInteger32 activeEPs_;
420  xdata::Integer32 outstandingDataDiscards_;
421  xdata::Integer32 outstandingDQMDiscards_;
422  xdata::UnsignedInteger32 faultyEvents_;
423  xdata::UnsignedInteger32 ignoredDiscards_;
424 
426 
427  std::map<ResourceBrokerKey, UniqueResourceBrokerID_t> resourceBrokerIDs_;
428  std::map<UniqueResourceBrokerID_t, RBRecordPtr> resourceBrokerMap_;
429 
432 
433  };
434 
437 
438 } // namespace stor
439 
440 #endif // EventFilter_StorageManager_DataSenderMonitorCollection_h
441 
442 
RBRecordPtr getResourceBrokerRecord(ResourceBrokerKey const &)
bool operator<(FilterUnitKey const &other) const
DataSenderMonitorCollection(const utils::Duration_t &updateInterval, AlarmHandlerPtr)
double seconds()
std::map< UniqueResourceBrokerID_t, RBRecordPtr > resourceBrokerMap_
OutputModuleResultsList getTopLevelOutputModuleResults() const
std::string hltClassName() const
Definition: I2OChain.cc:260
boost::shared_ptr< FilterUnitRecord > FURecordPtr
void calcStatsForOutputModules(OutputModuleRecordMap &outputModuleMap)
RBResultPtr getOneResourceBrokerResult(UniqueResourceBrokerID_t) const
std::map< OutputModuleKey, OutModRecordPtr > OutputModuleRecordMap
static boost::mutex mutex
Definition: LHEProxy.cc:11
OutputModuleRecord(const utils::Duration_t &updateInterval)
unsigned int fuProcessId() const
Definition: I2OChain.cc:266
virtual void do_appendInfoSpaceItems(InfoSpaceItems &)
boost::shared_ptr< ResourceBrokerRecord > RBRecordPtr
std::map< ResourceBrokerKey, UniqueResourceBrokerID_t > resourceBrokerIDs_
UniqueResourceBrokerID_t getUniqueResourceBrokerID(ResourceBrokerKey const &)
unsigned int messageCode() const
Definition: I2OChain.cc:218
FilterUnitResultsList getFilterUnitResultsForRB(UniqueResourceBrokerID_t uniqueRBID) const
unsigned int hltInstance() const
Definition: I2OChain.cc:242
unsigned int hltLocalId() const
Definition: I2OChain.cc:236
void ignoredDiscardAlarm(const uint32_t &) const
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
bool getAllNeededPointers(I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr, FURecordPtr &fuRecordPtr, OutModRecordPtr &topLevelOutModPtr, OutModRecordPtr &rbSpecificOutModPtr, OutModRecordPtr &fuSpecificOutModPtr)
bool getFURecordPointer(I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr, FURecordPtr &fuRecordPtr)
unsigned int fuGuid() const
Definition: I2OChain.cc:272
bool operator<(ResourceBrokerResult const &other) const
DataSenderMonitorCollection & operator=(DataSenderMonitorCollection const &)
bool getRBRecordPointer(I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr)
boost::shared_ptr< AlarmHandler > AlarmHandlerPtr
Definition: AlarmHandler.h:116
boost::shared_ptr< OutputModuleRecord > OutModRecordPtr
OutModRecordPtr getOutputModuleRecord(OutputModuleRecordMap &, OutputModuleKey const &)
std::vector< boost::shared_ptr< OutputModuleResult > > OutputModuleResultsList
OutputModuleResultsList buildOutputModuleResults(OutputModuleRecordMap const &) const
boost::shared_ptr< FilterUnitResult > FUResultPtr
unsigned long long uint64_t
Definition: Time.h:15
std::vector< RBResultPtr > ResourceBrokerResultsList
unsigned int hltTid() const
Definition: I2OChain.cc:248
std::vector< std::pair< std::string, xdata::Serializable * > > InfoSpaceItems
void faultyEventsAlarm(const uint32_t &) const
boost::shared_ptr< ResourceBrokerResult > RBResultPtr
bool compareRBResultPtrValues(DataSenderMonitorCollection::RBResultPtr firstValue, DataSenderMonitorCollection::RBResultPtr secondValue)
ResourceBrokerResultsList getAllResourceBrokerResults() const
bool operator<(ResourceBrokerKey const &other) const
ResourceBrokerRecord(ResourceBrokerKey rbKey, const utils::Duration_t &updateInterval)
OutputModuleResultsList getOutputModuleResultsForRB(UniqueResourceBrokerID_t uniqueRBID) const
RBResultPtr buildResourceBrokerResult(RBRecordPtr const &) const
std::vector< FUResultPtr > FilterUnitResultsList
std::string hltURL() const
Definition: I2OChain.cc:254
FURecordPtr getFilterUnitRecord(RBRecordPtr &, FilterUnitKey const &)
FilterUnitRecord(FilterUnitKey fuKey, const utils::Duration_t &updateInterval)