Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::FileStatsCollector Class Reference

#include <FileStatsCollector.h>

Public Member Functions

 FileStatsCollector (std::string const &moduleLabel, std::string const &processName)
 
void recordFileOpen ()
 
void recordInputFile (std::string const &inputFileName)
 
void recordEvent (EventID const &id)
 
void recordRun (RunID const &id)
 
void recordSubRun (SubRunID const &id)
 
void recordFileClose ()
 
std::string const & moduleLabel () const
 
std::string const & processName () const
 
boost::posix_time::ptime outputFileOpenTime () const
 
boost::posix_time::ptime outputFileCloseTime () const
 
boost::posix_time::ptime lowestRunStartTime () const
 
boost::posix_time::ptime highestRunStartTime () const
 
boost::posix_time::ptime lowestSubRunStartTime () const
 
boost::posix_time::ptime highestSubRunStartTime () const
 
RunID lowestRunID () const
 
RunID highestRunID () const
 
SubRunID const & lowestSubRunID () const
 
SubRunID const & highestSubRunID () const
 
EventID const & lowestEventID () const
 
EventID const & highestEventID () const
 
std::string const & lastOpenedInputFile () const
 
std::vector< std::stringparents (bool want_basename=true) const
 
bool fileCloseRecorded () const
 
std::size_t eventsThisFile () const
 
std::set< SubRunID > const & seenSubRuns () const
 

Private Member Functions

void resetStatistics_ ()
 

Private Attributes

std::string const moduleLabel_
 
std::string const processName_
 
RunID lowestRun_ {}
 
RunID highestRun_ {}
 
SubRunID lowestSubRun_ {}
 
SubRunID highestSubRun_ {}
 
EventID lowestEventIDSeen_ {}
 
EventID highestEventIDSeen_ {}
 
boost::posix_time::ptime fo_ {}
 
boost::posix_time::ptime fc_ {}
 
boost::posix_time::ptime lowestRunStartTime_ {}
 
boost::posix_time::ptime highestRunStartTime_ {}
 
boost::posix_time::ptime lowestSubRunStartTime_ {}
 
boost::posix_time::ptime highestSubRunStartTime_ {}
 
bool fileCloseRecorded_ {false}
 
std::string lastOpenedInputFile_ {}
 
std::vector< std::stringinputFilesSeen_ {}
 
std::size_t nEvents_ {}
 
std::set< SubRunIDsubRunsSeen_ {}
 

Detailed Description

Definition at line 24 of file FileStatsCollector.h.

Constructor & Destructor Documentation

art::FileStatsCollector::FileStatsCollector ( std::string const &  moduleLabel,
std::string const &  processName 
)

Definition at line 12 of file FileStatsCollector.cc.

15 {}
std::string const & processName() const
std::string const & moduleLabel() const
std::string const moduleLabel_
std::string const processName_

Member Function Documentation

std::size_t art::FileStatsCollector::eventsThisFile ( ) const
inline

Definition at line 177 of file FileStatsCollector.h.

178 {
179  return nEvents_;
180 }
bool art::FileStatsCollector::fileCloseRecorded ( ) const
inline

Definition at line 171 of file FileStatsCollector.h.

172 {
173  return fileCloseRecorded_;
174 }
art::EventID const & art::FileStatsCollector::highestEventID ( ) const
inline

Definition at line 159 of file FileStatsCollector.h.

160 {
161  return highestEventIDSeen_;
162 }
art::RunID art::FileStatsCollector::highestRunID ( ) const
inline

Definition at line 135 of file FileStatsCollector.h.

136 {
137  return highestRun_;
138 }
boost::posix_time::ptime art::FileStatsCollector::highestRunStartTime ( ) const
inline

Definition at line 111 of file FileStatsCollector.h.

112 {
113  return highestRunStartTime_;
114 }
boost::posix_time::ptime highestRunStartTime_
art::SubRunID const & art::FileStatsCollector::highestSubRunID ( ) const
inline

Definition at line 147 of file FileStatsCollector.h.

148 {
149  return highestSubRun_;
150 }
boost::posix_time::ptime art::FileStatsCollector::highestSubRunStartTime ( ) const
inline

Definition at line 123 of file FileStatsCollector.h.

124 {
126 }
boost::posix_time::ptime highestSubRunStartTime_
std::string const & art::FileStatsCollector::lastOpenedInputFile ( ) const
inline

Definition at line 165 of file FileStatsCollector.h.

166 {
167  return lastOpenedInputFile_;
168 }
art::EventID const & art::FileStatsCollector::lowestEventID ( ) const
inline

Definition at line 153 of file FileStatsCollector.h.

154 {
155  return lowestEventIDSeen_;
156 }
art::RunID art::FileStatsCollector::lowestRunID ( ) const
inline

Definition at line 129 of file FileStatsCollector.h.

130 {
131  return lowestRun_;
132 }
boost::posix_time::ptime art::FileStatsCollector::lowestRunStartTime ( ) const
inline

Definition at line 105 of file FileStatsCollector.h.

106 {
107  return lowestRunStartTime_;
108 }
boost::posix_time::ptime lowestRunStartTime_
art::SubRunID const & art::FileStatsCollector::lowestSubRunID ( ) const
inline

Definition at line 141 of file FileStatsCollector.h.

142 {
143  return lowestSubRun_;
144 }
boost::posix_time::ptime art::FileStatsCollector::lowestSubRunStartTime ( ) const
inline

Definition at line 117 of file FileStatsCollector.h.

118 {
119  return lowestSubRunStartTime_;
120 }
boost::posix_time::ptime lowestSubRunStartTime_
std::string const & art::FileStatsCollector::moduleLabel ( ) const
inline

Definition at line 81 of file FileStatsCollector.h.

82 {
83  return moduleLabel_;
84 }
std::string const moduleLabel_
boost::posix_time::ptime art::FileStatsCollector::outputFileCloseTime ( ) const
inline

Definition at line 99 of file FileStatsCollector.h.

100 {
101  return fc_;
102 }
boost::posix_time::ptime fc_
boost::posix_time::ptime art::FileStatsCollector::outputFileOpenTime ( ) const
inline

Definition at line 93 of file FileStatsCollector.h.

94 {
95  return fo_;
96 }
boost::posix_time::ptime fo_
std::vector< std::string > art::FileStatsCollector::parents ( bool  want_basename = true) const

Definition at line 100 of file FileStatsCollector.cc.

101 {
102  std::vector<std::string> result;
103  if (want_basename) {
104  result.reserve(inputFilesSeen_.size());
105  for (auto const& ifile : inputFilesSeen_) {
106  boost::filesystem::path const ifp{ifile};
107  result.emplace_back(ifp.filename().native());
108  }
109  } else {
110  result = inputFilesSeen_;
111  }
112  return result;
113 }
static QCString result
std::vector< std::string > inputFilesSeen_
std::string const & art::FileStatsCollector::processName ( ) const
inline

Definition at line 87 of file FileStatsCollector.h.

88 {
89  return processName_;
90 }
std::string const processName_
void art::FileStatsCollector::recordEvent ( EventID const &  id)

Definition at line 38 of file FileStatsCollector.cc.

39 {
40  ++nEvents_;
41  if (!lowestEventIDSeen_.isValid()) {
43  } else if (id < lowestEventIDSeen_) {
44  lowestEventIDSeen_ = id;
45  } else if (id > highestEventIDSeen_) {
47  }
48 }
bool isValid() const
Definition: EventID.h:122
void art::FileStatsCollector::recordFileClose ( )

Definition at line 93 of file FileStatsCollector.cc.

94 {
95  fc_ = now();
96  fileCloseRecorded_ = true;
97 }
boost::posix_time::ptime fc_
void art::FileStatsCollector::recordFileOpen ( )

Definition at line 18 of file FileStatsCollector.cc.

19 {
21  if (!inputFilesSeen_.empty()) {
23  }
24  fo_ = now();
25  fileCloseRecorded_ = false;
26 }
boost::posix_time::ptime fo_
std::vector< std::string > inputFilesSeen_
void art::FileStatsCollector::recordInputFile ( std::string const &  inputFileName)

Definition at line 29 of file FileStatsCollector.cc.

30 {
31  if (!inputFileName.empty()) {
32  inputFilesSeen_.emplace_back(inputFileName);
33  }
34  lastOpenedInputFile_ = inputFileName;
35 }
std::vector< std::string > inputFilesSeen_
void art::FileStatsCollector::recordRun ( RunID const &  id)

Definition at line 51 of file FileStatsCollector.cc.

52 {
53  if (!lowestRun_.isValid()) {
54  lowestRun_ = highestRun_ = id;
56  return;
57  }
58 
59  if (id < lowestRun_) {
60  lowestRun_ = id;
62  if (lowestSubRun_.runID() != lowestRun_) {
63  lowestSubRun_ = SubRunID{};
64  lowestSubRunStartTime_ = ptime{};
65  }
66  } else if (id > highestRun_) {
67  highestRun_ = id;
69  if (highestSubRun_.runID() != highestRun_) {
70  highestSubRun_ = SubRunID{};
71  highestSubRunStartTime_ = ptime{};
72  }
73  }
74 }
boost::posix_time::ptime highestRunStartTime_
boost::posix_time::ptime highestSubRunStartTime_
RunID const & runID() const
Definition: SubRunID.h:79
boost::posix_time::ptime lowestSubRunStartTime_
boost::posix_time::ptime lowestRunStartTime_
bool isValid() const
Definition: RunID.h:70
void art::FileStatsCollector::recordSubRun ( SubRunID const &  id)

Definition at line 77 of file FileStatsCollector.cc.

78 {
79  if (!lowestSubRun_.isValid()) {
82  } else if (id < lowestSubRun_) {
83  lowestSubRun_ = id;
85  } else if (id > highestSubRun_) {
86  highestSubRun_ = id;
88  }
89  subRunsSeen_.emplace(id);
90 }
boost::posix_time::ptime highestSubRunStartTime_
bool isValid() const
Definition: SubRunID.h:97
boost::posix_time::ptime lowestSubRunStartTime_
std::set< SubRunID > subRunsSeen_
void art::FileStatsCollector::resetStatistics_ ( )
private

Definition at line 116 of file FileStatsCollector.cc.

117 {
118  fo_ = fc_ = ptime{};
119  lowestRun_ = highestRun_ = RunID{};
120  lowestSubRun_ = highestSubRun_ = SubRunID{};
123  inputFilesSeen_.clear();
124  nEvents_ = 0ul;
125  subRunsSeen_.clear();
126 }
boost::posix_time::ptime fo_
boost::posix_time::ptime highestRunStartTime_
std::vector< std::string > inputFilesSeen_
boost::posix_time::ptime highestSubRunStartTime_
boost::posix_time::ptime fc_
boost::posix_time::ptime lowestSubRunStartTime_
boost::posix_time::ptime lowestRunStartTime_
std::set< SubRunID > subRunsSeen_
std::set< art::SubRunID > const & art::FileStatsCollector::seenSubRuns ( ) const
inline

Definition at line 183 of file FileStatsCollector.h.

184 {
185  return subRunsSeen_;
186 }
std::set< SubRunID > subRunsSeen_

Member Data Documentation

boost::posix_time::ptime art::FileStatsCollector::fc_ {}
private

Definition at line 68 of file FileStatsCollector.h.

bool art::FileStatsCollector::fileCloseRecorded_ {false}
private

Definition at line 73 of file FileStatsCollector.h.

boost::posix_time::ptime art::FileStatsCollector::fo_ {}
private

Definition at line 67 of file FileStatsCollector.h.

EventID art::FileStatsCollector::highestEventIDSeen_ {}
private

Definition at line 66 of file FileStatsCollector.h.

RunID art::FileStatsCollector::highestRun_ {}
private

Definition at line 62 of file FileStatsCollector.h.

boost::posix_time::ptime art::FileStatsCollector::highestRunStartTime_ {}
private

Definition at line 70 of file FileStatsCollector.h.

SubRunID art::FileStatsCollector::highestSubRun_ {}
private

Definition at line 64 of file FileStatsCollector.h.

boost::posix_time::ptime art::FileStatsCollector::highestSubRunStartTime_ {}
private

Definition at line 72 of file FileStatsCollector.h.

std::vector<std::string> art::FileStatsCollector::inputFilesSeen_ {}
private

Definition at line 75 of file FileStatsCollector.h.

std::string art::FileStatsCollector::lastOpenedInputFile_ {}
private

Definition at line 74 of file FileStatsCollector.h.

EventID art::FileStatsCollector::lowestEventIDSeen_ {}
private

Definition at line 65 of file FileStatsCollector.h.

RunID art::FileStatsCollector::lowestRun_ {}
private

Definition at line 61 of file FileStatsCollector.h.

boost::posix_time::ptime art::FileStatsCollector::lowestRunStartTime_ {}
private

Definition at line 69 of file FileStatsCollector.h.

SubRunID art::FileStatsCollector::lowestSubRun_ {}
private

Definition at line 63 of file FileStatsCollector.h.

boost::posix_time::ptime art::FileStatsCollector::lowestSubRunStartTime_ {}
private

Definition at line 71 of file FileStatsCollector.h.

std::string const art::FileStatsCollector::moduleLabel_
private

Definition at line 59 of file FileStatsCollector.h.

std::size_t art::FileStatsCollector::nEvents_ {}
private

Definition at line 76 of file FileStatsCollector.h.

std::string const art::FileStatsCollector::processName_
private

Definition at line 60 of file FileStatsCollector.h.

std::set<SubRunID> art::FileStatsCollector::subRunsSeen_ {}
private

Definition at line 77 of file FileStatsCollector.h.


The documentation for this class was generated from the following files: