CMS 3D CMS Logo

ModuleTiming.h
Go to the documentation of this file.
1 #ifndef Edm_Module_Timing_h
2 #define Edm_Module_Timing_h
3 
4 #include <vector>
5 #include <string>
6 
7 /* Original version: July 2006, Christos Leonidopoulos */
8 
9 namespace edm {
10 
11  // structure holding the processing time (per event) and name of a module
12  class ModuleTime {
13  public:
14  ModuleTime() : name_(""), time_(-1) {}
17 
18  std::string name() const { return name_; } // module name ("label")
19  double time() const { return time_; } // processing time for event (secs)
20  private:
22  double time_;
23  };
24 
25  // structure holding processing info for all modules in event (+total time)
26  class EventTime {
27  private:
28  std::vector<ModuleTime> moduleSet;
29  double tot_time_; // total time in event for all modules (in secs)
30 
31  public:
32  EventTime() { reset(); }
34 
35  // # of modules contained in event
36  unsigned size() const { return moduleSet.size(); }
37  // get hold of ModuleTime structure for module #i, where 0 <= i < size()
38  const ModuleTime& moduleTime(unsigned i) { return moduleSet.at(i); }
39  // get total processing time for event (secs)
40  double tot_time() const { return tot_time_; }
41  // get name for module #i, where 0 <= i < size()
42  std::string name(unsigned i) const { return moduleSet.at(i).name(); }
43  // get processing time for module #i (secs), where 0 <= i < size()
44  double time(unsigned i) const { return moduleSet.at(i).time(); }
45  // add module structure to event
46  void addModuleTime(const ModuleTime& m) {
47  moduleSet.push_back(m);
48  tot_time_ += m.time();
49  }
50 
51  // reset all info (ie. from previous event)
52  void reset() {
53  moduleSet.clear();
54  tot_time_ = 0;
55  }
56  };
57 
58 } // namespace edm
59 
60 #endif // #define Edm_Module_Timing_h
double time(unsigned i) const
Definition: ModuleTiming.h:44
double tot_time() const
Definition: ModuleTiming.h:40
std::string name_
Definition: ModuleTiming.h:21
const ModuleTime & moduleTime(unsigned i)
Definition: ModuleTiming.h:38
std::string name() const
Definition: ModuleTiming.h:18
void addModuleTime(const ModuleTime &m)
Definition: ModuleTiming.h:46
double time() const
Definition: ModuleTiming.h:19
std::string name(unsigned i) const
Definition: ModuleTiming.h:42
unsigned size() const
Definition: ModuleTiming.h:36
double tot_time_
Definition: ModuleTiming.h:29
std::vector< ModuleTime > moduleSet
Definition: ModuleTiming.h:28
HLT enums.
ModuleTime(std::string Name, double Time)
Definition: ModuleTiming.h:15