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.17.4.1 2011/03/07 11:33:04 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;
126  //MonitoredQuantity fragmentSize;
128 
129  OutputModuleRecord(const utils::Duration_t& updateInterval) :
130  eventSize(updateInterval,boost::posix_time::seconds(10)) {}
131  };
132  typedef boost::shared_ptr<OutputModuleRecord> OutModRecordPtr;
133  typedef std::map<OutputModuleKey, OutModRecordPtr> OutputModuleRecordMap;
134 
139  {
151  uint32_t initMsgCount;
152  uint32_t lastRunNumber;
154 
155  explicit FilterUnitRecord
156  (
157  FilterUnitKey fuKey,
158  const utils::Duration_t& updateInterval
159  ) :
160  key(fuKey),
163  dqmEventSize(updateInterval,boost::posix_time::seconds(10)),
164  errorEventSize(updateInterval,boost::posix_time::seconds(10)),
165  faultyEventSize(updateInterval,boost::posix_time::seconds(10)),
167  dataDiscardCount(updateInterval,boost::posix_time::seconds(10)),
168  dqmDiscardCount(updateInterval,boost::posix_time::seconds(10)),
171  };
172  typedef boost::shared_ptr<FilterUnitRecord> FURecordPtr;
173 
178  {
180  std::map<FilterUnitKey, FURecordPtr> filterUnitMap;
190  uint32_t initMsgCount;
191  uint32_t lastRunNumber;
193 
194  explicit ResourceBrokerRecord
195  (
196  ResourceBrokerKey rbKey,
197  const utils::Duration_t& updateInterval
198  ) :
199  key(rbKey),
200  eventSize(updateInterval,boost::posix_time::seconds(10)),
201  dqmEventSize(updateInterval,boost::posix_time::seconds(10)),
202  errorEventSize(updateInterval,boost::posix_time::seconds(10)),
203  faultyEventSize(updateInterval,boost::posix_time::seconds(10)),
205  dataDiscardCount(updateInterval,boost::posix_time::seconds(10)),
206  dqmDiscardCount(updateInterval,boost::posix_time::seconds(10)),
209  };
210  typedef boost::shared_ptr<ResourceBrokerRecord> RBRecordPtr;
211 
212 
217  {
218  std::string name;
220  uint32_t initMsgSize;
222  };
223  typedef std::vector< boost::shared_ptr<OutputModuleResult> >
225 
229  typedef long long UniqueResourceBrokerID_t;
231  {
233  uint32_t filterUnitCount;
234  uint32_t initMsgCount;
235  uint32_t lastRunNumber;
248 
249  explicit ResourceBrokerResult(ResourceBrokerKey const& rbKey):
250  key(rbKey), filterUnitCount(0), initMsgCount(0),
253 
254  bool operator<(ResourceBrokerResult const& other) const
255  {
256  return key < other.key;
257  }
258  };
259  typedef boost::shared_ptr<ResourceBrokerResult> RBResultPtr;
260  typedef std::vector<RBResultPtr> ResourceBrokerResultsList;
261 
266  {
268  uint32_t initMsgCount;
269  uint32_t lastRunNumber;
282 
283  explicit FilterUnitResult(FilterUnitKey const& fuKey):
284  key(fuKey), initMsgCount(0), lastRunNumber(0), lastEventNumber(0),
286  };
287  typedef boost::shared_ptr<FilterUnitResult> FUResultPtr;
288  typedef std::vector<FUResultPtr> FilterUnitResultsList;
289 
290 
295  (
296  const utils::Duration_t& updateInterval,
298  );
299 
303  void addFragmentSample(I2OChain const&);
304 
308  void addInitSample(I2OChain const&);
309 
313  void addEventSample(I2OChain const&);
314 
318  void addDQMEventSample(I2OChain const&);
319 
323  void addErrorEventSample(I2OChain const&);
324 
328  void addFaultyEventSample(I2OChain const&);
329 
333  void incrementDataDiscardCount(I2OChain const&);
334 
338  void incrementDQMDiscardCount(I2OChain const&);
339 
344 
349 
354 
359 
364 
369 
370  private:
371 
372  //Prevent copying of the DataSenderMonitorCollection
375 
376  virtual void do_calculateStatistics();
377  virtual void do_reset();
379  virtual void do_updateInfoSpaceItems();
380 
381  void faultyEventsAlarm(const uint32_t&) const;
382  void ignoredDiscardAlarm(const uint32_t&) const;
383 
384  bool getAllNeededPointers(I2OChain const& i2oChain,
385  RBRecordPtr& rbRecordPtr,
386  FURecordPtr& fuRecordPtr,
387  OutModRecordPtr& topLevelOutModPtr,
388  OutModRecordPtr& rbSpecificOutModPtr,
389  OutModRecordPtr& fuSpecificOutModPtr);
390 
391  bool getRBRecordPointer(I2OChain const& i2oChain,
392  RBRecordPtr& rbRecordPtr);
393 
394  bool getFURecordPointer(I2OChain const& i2oChain,
395  RBRecordPtr& rbRecordPtr,
396  FURecordPtr& fuRecordPtr);
397 
400 
402 
404  OutputModuleKey const&);
405 
407 
409 
410  void calcStatsForOutputModules(OutputModuleRecordMap& outputModuleMap);
411 
413 
414  xdata::UnsignedInteger32 connectedRBs_;
415  xdata::UnsignedInteger32 connectedEPs_;
416  xdata::UnsignedInteger32 activeEPs_;
417  xdata::Integer32 outstandingDataDiscards_;
418  xdata::Integer32 outstandingDQMDiscards_;
419  xdata::UnsignedInteger32 faultyEvents_;
420  xdata::UnsignedInteger32 ignoredDiscards_;
421 
423 
424  std::map<ResourceBrokerKey, UniqueResourceBrokerID_t> resourceBrokerIDs_;
425  std::map<UniqueResourceBrokerID_t, RBRecordPtr> resourceBrokerMap_;
426 
429 
430  };
431 
434 
435 } // namespace stor
436 
437 #endif // EventFilter_StorageManager_DataSenderMonitorCollection_h
438 
439 
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:91
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)