CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FilesMonitorCollection.h
Go to the documentation of this file.
1 // $Id: FilesMonitorCollection.h,v 1.17 2011/07/07 09:22:44 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_FilesMonitorCollection_h
5 #define EventFilter_StorageManager_FilesMonitorCollection_h
6 
7 #include <iomanip>
8 #include <sstream>
9 #include <stdint.h>
10 #include <vector>
11 
12 #include <boost/circular_buffer.hpp>
13 #include <boost/thread/mutex.hpp>
14 #include <boost/shared_ptr.hpp>
15 
16 #include "xdata/UnsignedInteger32.h"
17 
19 
20 
21 namespace stor {
22 
32  {
33  public:
34 
35  struct FileRecord
36  {
38  {
39  notClosed = 0,
46  };
47 
49  {
53  };
54 
55  uint32_t entryCounter; // file counter
56  uint32_t runNumber; // run number
57  uint32_t lumiSection; // luminosity section
58  std::string streamLabel; // datastream label
59  std::string baseFilePath; // file path w/o the working directory
60  std::string coreFileName; // file name w/o instance & file ending
61  uint32_t fileCounter; // counter of number of coreFileNames used
62  ClosingReason whyClosed; // reason why the given file was closed
63  bool isOpen; // true if file is in open directory
64  uint64_t fileSize; // file size in bytes
65  uint32_t eventCount; // number of events
66  uint32_t adler32; // Adler32 checksum
67  std::string closingReason(); // reason why file was closed
68  std::string fileName(); // full file name
69  std::string filePath(FileStatus status=current); // complete file path for the given file status
71  { return ( filePath(status) + "/" + fileName() ); }
72 
73  };
74 
75  // We do not know how many files there will be.
76  // Thus, we need a vector of them.
77  typedef boost::shared_ptr<FileRecord> FileRecordPtr;
78  typedef boost::circular_buffer<FileRecordPtr> FileRecordList;
79 
80 
81  explicit FilesMonitorCollection(const utils::Duration_t& updateInterval);
82 
84 
85  void getFileRecords(FileRecordList&) const;
86 
87 
88  private:
89 
90  //Prevent copying of the FilesMonitorCollection
93 
94  virtual void do_calculateStatistics();
95  virtual void do_reset();
97  virtual void do_updateInfoSpaceItems();
98 
101 
102  const unsigned int maxFileEntries_; // maximum number of files to remember
103  uint32_t entryCounter_;
104 
105  xdata::UnsignedInteger32 closedFiles_; // number of closed files
106  xdata::UnsignedInteger32 openFiles_; // number of open files
107 
108  };
109 
110 } // namespace stor
111 
112 #endif // EventFilter_StorageManager_FilesMonitorCollection_h
113 
114 
FilesMonitorCollection(const utils::Duration_t &updateInterval)
const FileRecordPtr getNewFileRecord()
std::string completeFileName(FileStatus status=current)
static boost::mutex mutex
Definition: LHEProxy.cc:11
FilesMonitorCollection & operator=(FilesMonitorCollection const &)
boost::shared_ptr< FileRecord > FileRecordPtr
virtual void do_appendInfoSpaceItems(InfoSpaceItems &)
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
std::string filePath(FileStatus status=current)
void getFileRecords(FileRecordList &) const
xdata::UnsignedInteger32 closedFiles_
unsigned long long uint64_t
Definition: Time.h:15
std::vector< std::pair< std::string, xdata::Serializable * > > InfoSpaceItems
xdata::UnsignedInteger32 openFiles_
boost::circular_buffer< FileRecordPtr > FileRecordList
tuple status
Definition: ntuplemaker.py:245