CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConsumerMonitorCollection.h
Go to the documentation of this file.
1 // $Id: ConsumerMonitorCollection.h,v 1.12 2011/03/07 15:31:31 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_ConsumerMonitorCollection_h
5 #define EventFilter_StorageManager_ConsumerMonitorCollection_h
6 
9 
10 #include <boost/thread/mutex.hpp>
11 #include <boost/shared_ptr.hpp>
12 
13 #include <map>
14 
15 namespace stor {
16 
17  class MonitoredQuantity;
18 
19 
29  {
30 
31  public:
32 
33  struct TotalStats
34  {
38  };
39 
41  (
42  const utils::Duration_t& updateInterval,
43  const utils::Duration_t& recentDuration
44  );
45 
49  void addQueuedEventSample( const QueueID&, const unsigned int& data_size );
50 
54  void addDroppedEvents( const QueueID&, const size_t& count );
55 
59  void addServedEventSample( const QueueID&, const unsigned int& data_size );
60 
64  bool getQueued( const QueueID& qid, MonitoredQuantity::Stats& result ) const;
65 
69  bool getServed( const QueueID& qid, MonitoredQuantity::Stats& result ) const;
70 
74  bool getDropped( const QueueID& qid, MonitoredQuantity::Stats& result ) const;
75 
79  void getTotalStats( TotalStats& ) const;
80 
84  void resetCounters();
85 
86  private:
87 
88  // Prevent copying:
91 
92  typedef std::map<QueueID, MonitoredQuantityPtr> ConsStatMap;
93 
94  void addEventSampleToMap( const QueueID&, const unsigned int& data_size, ConsStatMap& );
95  bool getValueFromMap( const QueueID&, MonitoredQuantity::Stats&, const ConsStatMap& ) const;
96 
97  virtual void do_calculateStatistics();
98  virtual void do_reset();
99 
105 
106  protected:
107 
108  ConsStatMap qmap_; // queued
109  ConsStatMap dmap_; // dropped
110  ConsStatMap smap_; // served
111 
113 
114  };
115 
116 } // namespace stor
117 
118 #endif // EventFilter_StorageManager_ConsumerMonitorCollection_h
119 
120 
void addQueuedEventSample(const QueueID &, const unsigned int &data_size)
bool getServed(const QueueID &qid, MonitoredQuantity::Stats &result) const
static boost::mutex mutex
Definition: LHEProxy.cc:11
bool getDropped(const QueueID &qid, MonitoredQuantity::Stats &result) const
void addEventSampleToMap(const QueueID &, const unsigned int &data_size, ConsStatMap &)
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
void addDroppedEvents(const QueueID &, const size_t &count)
std::map< QueueID, MonitoredQuantityPtr > ConsStatMap
tuple result
Definition: query.py:137
ConsumerMonitorCollection(const utils::Duration_t &updateInterval, const utils::Duration_t &recentDuration)
bool getQueued(const QueueID &qid, MonitoredQuantity::Stats &result) const
void addServedEventSample(const QueueID &, const unsigned int &data_size)
ConsumerMonitorCollection & operator=(const ConsumerMonitorCollection &)
bool getValueFromMap(const QueueID &, MonitoredQuantity::Stats &, const ConsStatMap &) const