CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamsMonitorCollection.h
Go to the documentation of this file.
1 // $Id: StreamsMonitorCollection.h,v 1.12 2011/03/07 15:31:32 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_StreamsMonitorCollection_h
5 #define EventFilter_StorageManager_StreamsMonitorCollection_h
6 
7 #include <sstream>
8 #include <iomanip>
9 #include <vector>
10 #include <set>
11 
12 #include <boost/thread/mutex.hpp>
13 #include <boost/shared_ptr.hpp>
14 
15 #include "xdata/Double.h"
16 #include "xdata/String.h"
17 #include "xdata/UnsignedInteger32.h"
18 #include "xdata/Vector.h"
19 
23 
24 
25 namespace stor {
26 
36  {
37  public:
38 
39  struct StreamRecord
40  {
42  (
44  const utils::Duration_t& updateInterval,
45  const utils::Duration_t& timeWindowForRecentResults
46  ) :
47  fileCount(updateInterval,timeWindowForRecentResults),
48  volume(updateInterval,timeWindowForRecentResults),
49  bandwidth(updateInterval,timeWindowForRecentResults),
50  parentCollection(coll) {}
51 
53  { fileCountPerLS.clear(); }
54 
55  void incrementFileCount(const uint32_t lumiSection);
56  void addSizeInBytes(double);
58  (
59  const uint32_t& lumiSection,
60  std::string& str
61  );
62 
63  std::string streamName; // name of the stream
64  double fractionToDisk; // fraction of events written to disk
65  MonitoredQuantity fileCount; // number of files written for this stream
66  MonitoredQuantity volume; // data in MBytes stored in this stream
67  MonitoredQuantity bandwidth; // bandwidth in MBytes for this stream
68 
70 
71  typedef std::map<uint32_t, unsigned int> FileCountPerLumiSectionMap;
73  };
74 
75  // We do not know how many streams there will be.
76  // Thus, we need a vector of them.
77  typedef boost::shared_ptr<StreamRecord> StreamRecordPtr;
78  typedef std::vector<StreamRecordPtr> StreamRecordList;
79 
80 
81  explicit StreamsMonitorCollection(const utils::Duration_t& updateInterval);
82 
84 
86 
87  bool streamRecordsExist() const;
88 
90  return allStreamsFileCount_;
91  }
93  return allStreamsFileCount_;
94  }
95 
97  return allStreamsVolume_;
98  }
100  return allStreamsVolume_;
101  }
102 
104  return allStreamsBandwidth_;
105  }
107  return allStreamsBandwidth_;
108  }
109 
111 
112 
113  private:
114 
115  //Prevent copying of the StreamsMonitorCollection
118 
119  typedef std::set<uint32_t> UnreportedLS;
121 
122  virtual void do_calculateStatistics();
123  virtual void do_reset();
125  virtual void do_updateInfoSpaceItems();
126 
129 
132 
136 
137  xdata::UnsignedInteger32 storedEvents_; // number of events stored in all streams
138  xdata::Double storedVolume_; // total volume in MB stored on disk
139  xdata::Double bandwidthToDisk_; // recent bandwidth in MB/s written to disk
140  xdata::Vector<xdata::String> streamNames_; // names of all streams written
141  xdata::Vector<xdata::UnsignedInteger32> eventsPerStream_; // total number of events stored per stream
142  xdata::Vector<xdata::Double> ratePerStream_; // recent event rate (Hz) per stream
143  xdata::Vector<xdata::Double> bandwidthPerStream_; // recent bandwidth (MB/s) per stream
144  };
145 
146 } // namespace stor
147 
148 #endif // EventFilter_StorageManager_StreamsMonitorCollection_h
149 
150 
std::map< uint32_t, unsigned int > FileCountPerLumiSectionMap
static boost::mutex mutex
Definition: LHEProxy.cc:11
StreamsMonitorCollection & operator=(StreamsMonitorCollection const &)
const utils::Duration_t timeWindowForRecentResults_
xdata::Vector< xdata::UnsignedInteger32 > eventsPerStream_
xdata::Vector< xdata::String > streamNames_
const MonitoredQuantity & getAllStreamsBandwidthMQ() const
void reportLumiSectionInfo(const uint32_t &lumiSection, std::string &str)
std::vector< StreamRecordPtr > StreamRecordList
xdata::UnsignedInteger32 storedEvents_
void reportAllLumiSectionInfos(DbFileHandlerPtr)
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
MonitoredQuantity & getAllStreamsFileCountMQ()
boost::shared_ptr< DbFileHandler > DbFileHandlerPtr
Definition: DbFileHandler.h:65
const MonitoredQuantity & getAllStreamsVolumeMQ() const
boost::shared_ptr< StreamRecord > StreamRecordPtr
void incrementFileCount(const uint32_t lumiSection)
StreamRecord(StreamsMonitorCollection *coll, const utils::Duration_t &updateInterval, const utils::Duration_t &timeWindowForRecentResults)
virtual void do_appendInfoSpaceItems(InfoSpaceItems &)
MonitoredQuantity & getAllStreamsBandwidthMQ()
xdata::Vector< xdata::Double > ratePerStream_
JetCorrectorParametersCollection coll
Definition: classes.h:14
MonitoredQuantity & getAllStreamsVolumeMQ()
std::vector< std::pair< std::string, xdata::Serializable * > > InfoSpaceItems
void getStreamRecords(StreamRecordList &) const
const MonitoredQuantity & getAllStreamsFileCountMQ() const
StreamsMonitorCollection(const utils::Duration_t &updateInterval)
xdata::Vector< xdata::Double > bandwidthPerStream_