LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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::string > parents (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::string > inputFilesSeen_ {}
 
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.

References processName(), and processName_.

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.

References nEvents_.

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

Definition at line 171 of file FileStatsCollector.h.

References fileCloseRecorded_.

Referenced by art::PostCloseFileRenamer::applySubstitutions().

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

Definition at line 159 of file FileStatsCollector.h.

References highestEventIDSeen_.

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

Definition at line 135 of file FileStatsCollector.h.

References highestRun_.

Referenced by art::PostCloseFileRenamer::subFilledNumericNoIndex_().

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

Definition at line 111 of file FileStatsCollector.h.

References highestRunStartTime_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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.

References highestSubRun_.

Referenced by art::PostCloseFileRenamer::subFilledNumericNoIndex_().

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

Definition at line 123 of file FileStatsCollector.h.

References highestSubRunStartTime_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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

Definition at line 165 of file FileStatsCollector.h.

References lastOpenedInputFile_.

Referenced by art::PostCloseFileRenamer::subInputFileName_().

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

Definition at line 153 of file FileStatsCollector.h.

References lowestEventIDSeen_.

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

Definition at line 129 of file FileStatsCollector.h.

References lowestRun_.

Referenced by art::PostCloseFileRenamer::subFilledNumericNoIndex_().

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

Definition at line 105 of file FileStatsCollector.h.

References lowestRunStartTime_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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.

References lowestSubRun_.

Referenced by art::PostCloseFileRenamer::subFilledNumericNoIndex_().

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

Definition at line 117 of file FileStatsCollector.h.

References lowestSubRunStartTime_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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.

References moduleLabel_.

Referenced by art::PostCloseFileRenamer::applySubstitutionsNoIndex_().

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.

References fc_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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.

References fo_.

Referenced by art::PostCloseFileRenamer::subTimestamp_().

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.

References inputFilesSeen_.

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 }
std::vector< std::string > inputFilesSeen_
std::string const & art::FileStatsCollector::processName ( ) const
inline

Definition at line 87 of file FileStatsCollector.h.

References processName_.

Referenced by art::PostCloseFileRenamer::applySubstitutionsNoIndex_(), and FileStatsCollector().

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

Definition at line 38 of file FileStatsCollector.cc.

References highestEventIDSeen_, art::EventID::isValid(), lowestEventIDSeen_, and nEvents_.

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.

References fc_, and fileCloseRecorded_.

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.

References fileCloseRecorded_, fo_, inputFilesSeen_, lastOpenedInputFile_, and resetStatistics_().

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.

References inputFilesSeen_, and lastOpenedInputFile_.

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.

References highestRun_, highestRunStartTime_, highestSubRun_, highestSubRunStartTime_, art::RunID::isValid(), lowestRun_, lowestRunStartTime_, lowestSubRun_, lowestSubRunStartTime_, and art::SubRunID::runID().

52 {
53  if (!lowestRun_.isValid()) {
54  lowestRun_ = highestRun_ = id;
56  return;
57  }
58 
59  if (id < lowestRun_) {
60  lowestRun_ = id;
61  lowestRunStartTime_ = now();
62  if (lowestSubRun_.runID() != lowestRun_) {
63  lowestSubRun_ = SubRunID{};
64  lowestSubRunStartTime_ = ptime{};
65  }
66  } else if (id > highestRun_) {
67  highestRun_ = id;
68  highestRunStartTime_ = now();
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.

References highestSubRun_, highestSubRunStartTime_, art::SubRunID::isValid(), lowestSubRun_, lowestSubRunStartTime_, and subRunsSeen_.

78 {
79  if (!lowestSubRun_.isValid()) {
82  } else if (id < lowestSubRun_) {
83  lowestSubRun_ = id;
84  lowestSubRunStartTime_ = now();
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.

References fc_, fo_, highestRun_, highestRunStartTime_, highestSubRun_, highestSubRunStartTime_, inputFilesSeen_, lowestRun_, lowestRunStartTime_, lowestSubRun_, lowestSubRunStartTime_, nEvents_, and subRunsSeen_.

Referenced by recordFileOpen().

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.

References subRunsSeen_.

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.

Referenced by outputFileCloseTime(), recordFileClose(), and resetStatistics_().

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

Definition at line 73 of file FileStatsCollector.h.

Referenced by fileCloseRecorded(), recordFileClose(), and recordFileOpen().

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

Definition at line 67 of file FileStatsCollector.h.

Referenced by outputFileOpenTime(), recordFileOpen(), and resetStatistics_().

EventID art::FileStatsCollector::highestEventIDSeen_ {}
private

Definition at line 66 of file FileStatsCollector.h.

Referenced by highestEventID(), and recordEvent().

RunID art::FileStatsCollector::highestRun_ {}
private

Definition at line 62 of file FileStatsCollector.h.

Referenced by highestRunID(), recordRun(), and resetStatistics_().

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

Definition at line 70 of file FileStatsCollector.h.

Referenced by highestRunStartTime(), recordRun(), and resetStatistics_().

SubRunID art::FileStatsCollector::highestSubRun_ {}
private

Definition at line 64 of file FileStatsCollector.h.

Referenced by highestSubRunID(), recordRun(), recordSubRun(), and resetStatistics_().

boost::posix_time::ptime art::FileStatsCollector::highestSubRunStartTime_ {}
private
std::vector<std::string> art::FileStatsCollector::inputFilesSeen_ {}
private

Definition at line 75 of file FileStatsCollector.h.

Referenced by parents(), recordFileOpen(), recordInputFile(), and resetStatistics_().

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

Definition at line 74 of file FileStatsCollector.h.

Referenced by lastOpenedInputFile(), recordFileOpen(), and recordInputFile().

EventID art::FileStatsCollector::lowestEventIDSeen_ {}
private

Definition at line 65 of file FileStatsCollector.h.

Referenced by lowestEventID(), and recordEvent().

RunID art::FileStatsCollector::lowestRun_ {}
private

Definition at line 61 of file FileStatsCollector.h.

Referenced by lowestRunID(), recordRun(), and resetStatistics_().

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

Definition at line 69 of file FileStatsCollector.h.

Referenced by lowestRunStartTime(), recordRun(), and resetStatistics_().

SubRunID art::FileStatsCollector::lowestSubRun_ {}
private

Definition at line 63 of file FileStatsCollector.h.

Referenced by lowestSubRunID(), recordRun(), recordSubRun(), and resetStatistics_().

boost::posix_time::ptime art::FileStatsCollector::lowestSubRunStartTime_ {}
private
std::string const art::FileStatsCollector::moduleLabel_
private

Definition at line 59 of file FileStatsCollector.h.

Referenced by moduleLabel().

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

Definition at line 76 of file FileStatsCollector.h.

Referenced by eventsThisFile(), recordEvent(), and resetStatistics_().

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

Definition at line 60 of file FileStatsCollector.h.

Referenced by FileStatsCollector(), and processName().

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

Definition at line 77 of file FileStatsCollector.h.

Referenced by recordSubRun(), resetStatistics_(), and seenSubRuns().


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