CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::service::Timing Class Reference

#include <Timing.h>

Public Member Functions

 Timing (ParameterSet const &, ActivityRegistry &)
 
 ~Timing ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void postBeginJob ()
 
void postEndJob ()
 
void postEventProcessing (Event const &, EventSetup const &)
 
void postModule (ModuleDescription const &)
 
void preEventProcessing (EventID const &, Timestamp const &)
 
void preModule (ModuleDescription const &)
 

Private Attributes

EventID curr_event_
 
double curr_event_cpu_
 
double curr_event_time_
 
double curr_job_cpu_
 
double curr_job_time_
 
double curr_module_time_
 
double max_event_cpu_
 
double max_event_time_
 
double min_event_cpu_
 
double min_event_time_
 
bool report_summary_
 
bool summary_only_
 
int total_event_count_
 
double total_event_cpu_
 

Detailed Description

Definition at line 30 of file Timing.h.

Constructor & Destructor Documentation

edm::service::Timing::Timing ( ParameterSet const &  iPS,
ActivityRegistry iRegistry 
)

Definition at line 82 of file Timing.cc.

References postBeginJob(), postEndJob(), postEventProcessing(), postModule(), preEventProcessing(), preModule(), summary_only_, edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().

82  :
83  curr_event_(),
84  curr_job_time_(0.),
85  curr_job_cpu_(0.),
86  curr_event_time_(0.),
87  curr_event_cpu_(0.),
89  total_event_cpu_(0.),
90  summary_only_(iPS.getUntrackedParameter<bool>("summaryOnly")),
91  report_summary_(iPS.getUntrackedParameter<bool>("useJobReport")),
92  max_event_time_(0.),
93  max_event_cpu_(0.),
94  min_event_time_(0.),
95  min_event_cpu_(0.),
97  iRegistry.watchPostBeginJob(this, &Timing::postBeginJob);
98  iRegistry.watchPostEndJob(this, &Timing::postEndJob);
99 
100  iRegistry.watchPreProcessEvent(this, &Timing::preEventProcessing);
101  iRegistry.watchPostProcessEvent(this, &Timing::postEventProcessing);
102 
103  if(not summary_only_) {
104  iRegistry.watchPreModule(this, &Timing::preModule);
105  iRegistry.watchPostModule(this, &Timing::postModule);
106  }
107  }
double curr_job_time_
Definition: Timing.h:48
double max_event_time_
Definition: Timing.h:60
bool report_summary_
Definition: Timing.h:55
double curr_event_cpu_
Definition: Timing.h:51
double curr_job_cpu_
Definition: Timing.h:49
void preModule(ModuleDescription const &)
Definition: Timing.cc:220
EventID curr_event_
Definition: Timing.h:47
double curr_module_time_
Definition: Timing.h:52
void postModule(ModuleDescription const &)
Definition: Timing.cc:224
double max_event_cpu_
Definition: Timing.h:61
double total_event_cpu_
Definition: Timing.h:53
int total_event_count_
Definition: Timing.h:64
double min_event_cpu_
Definition: Timing.h:63
void preEventProcessing(EventID const &, Timestamp const &)
Definition: Timing.cc:185
void postEventProcessing(Event const &, EventSetup const &)
Definition: Timing.cc:191
double min_event_time_
Definition: Timing.h:62
double curr_event_time_
Definition: Timing.h:50
edm::service::Timing::~Timing ( )

Definition at line 109 of file Timing.cc.

109  {
110  }

Member Function Documentation

void edm::service::Timing::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 112 of file Timing.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and edm::ConfigurationDescriptions::setComment().

112  {
114  desc.addUntracked<bool>("summaryOnly", false)->setComment(
115  "If 'true' do not report timing for each event");
116  desc.addUntracked<bool>("useJobReport", true)->setComment(
117  "If 'true' write summary information to JobReport");
118  descriptions.add("Timing", desc);
119  descriptions.setComment(
120  "This service reports the time it takes to run each module in a job.");
121  }
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void edm::service::Timing::postBeginJob ( )
private

Definition at line 123 of file Timing.cc.

References curr_job_cpu_, curr_job_time_, edm::service::getCPU(), edm::service::getTime(), summary_only_, and total_event_cpu_.

Referenced by Timing().

123  {
125  curr_job_cpu_ = getCPU();
126  total_event_cpu_ = 0.0;
127 
128  //LogInfo("TimeReport")
129  if(not summary_only_) {
130  LogImportant("TimeReport") // ChangeLog 3
131  << "TimeReport> Report activated" << "\n"
132  << "TimeReport> Report columns headings for events: "
133  << "eventnum runnum timetaken\n"
134  << "TimeReport> Report columns headings for modules: "
135  << "eventnum runnum modulelabel modulename timetakeni\n"
136  << "TimeReport> JobTime=" << curr_job_time_ << " JobCPU=" << curr_job_cpu_ << "\n";
137  }
138  }
double curr_job_time_
Definition: Timing.h:48
static double getCPU()
Definition: Timing.cc:70
double curr_job_cpu_
Definition: Timing.h:49
double total_event_cpu_
Definition: Timing.h:53
static double getTime()
void edm::service::Timing::postEndJob ( )
private

Definition at line 140 of file Timing.cc.

References curr_job_cpu_, curr_job_time_, edm::service::d2str(), edm::service::getCPU(), edm::service::getTime(), max_event_cpu_, max_event_time_, min_event_cpu_, min_event_time_, report_summary_, total_event_count_, and total_event_cpu_.

Referenced by Timing().

140  {
141  double total_job_time = getTime() - curr_job_time_;
142  double average_event_time = total_job_time / total_event_count_;
143 
144  double total_job_cpu = getCPU() - curr_job_cpu_;
145  double average_event_cpu = total_event_cpu_ / total_event_count_;
146 
147  //LogAbsolute("FwkJob")
148  //LogAbsolute("TimeReport") // Changelog 1
149  LogImportant("TimeReport") // Changelog 3
150  << "TimeReport> Time report complete in "
151  << total_job_time << " seconds"
152  << "\n"
153  << " Time Summary: \n"
154  << " - Min event: " << min_event_time_ << "\n"
155  << " - Max event: " << max_event_time_ << "\n"
156  << " - Avg event: " << average_event_time << "\n"
157  << " - Total job: " << total_job_time << "\n"
158  << " CPU Summary: \n"
159  << " - Min event: " << min_event_cpu_ << "\n"
160  << " - Max event: " << max_event_cpu_ << "\n"
161  << " - Avg event: " << average_event_cpu << "\n"
162  << " - Total job: " << total_job_cpu << "\n"
163  << " - Total event: " << total_event_cpu_ << "\n";
164 
165  if(report_summary_) {
166  Service<JobReport> reportSvc;
167 // std::map<std::string, double> reportData;
168  std::map<std::string, std::string> reportData;
169 
170  reportData.insert(std::make_pair("MinEventTime", d2str(min_event_time_)));
171  reportData.insert(std::make_pair("MaxEventTime", d2str(max_event_time_)));
172  reportData.insert(std::make_pair("AvgEventTime", d2str(average_event_time)));
173  reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time)));
174  reportData.insert(std::make_pair("MinEventCPU", d2str(min_event_cpu_)));
175  reportData.insert(std::make_pair("MaxEventCPU", d2str(max_event_cpu_)));
176  reportData.insert(std::make_pair("AvgEventCPU", d2str(average_event_cpu)));
177  reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu)));
178  reportData.insert(std::make_pair("TotalEventCPU", d2str(total_event_cpu_)));
179 
180  reportSvc->reportPerformanceSummary("Timing", reportData);
181 // reportSvc->reportTimingInfo(reportData);
182  }
183  }
double curr_job_time_
Definition: Timing.h:48
double max_event_time_
Definition: Timing.h:60
bool report_summary_
Definition: Timing.h:55
static double getCPU()
Definition: Timing.cc:70
double curr_job_cpu_
Definition: Timing.h:49
double max_event_cpu_
Definition: Timing.h:61
double total_event_cpu_
Definition: Timing.h:53
int total_event_count_
Definition: Timing.h:64
static std::string d2str(double d)
Definition: Memory.cc:59
double min_event_cpu_
Definition: Timing.h:63
static double getTime()
double min_event_time_
Definition: Timing.h:62
void edm::service::Timing::postEventProcessing ( Event const &  ,
EventSetup const &   
)
private

Definition at line 191 of file Timing.cc.

References curr_event_, curr_event_cpu_, curr_event_time_, edm::EventID::event(), edm::service::getCPU(), edm::service::getTime(), max_event_cpu_, max_event_time_, min_event_cpu_, min_event_time_, edm::EventID::run(), summary_only_, total_event_count_, and total_event_cpu_.

Referenced by Timing().

191  {
194 
196 
197  if(not summary_only_) {
198  LogPrint("TimeEvent") // ChangeLog 3
199  << "TimeEvent> "
200  << curr_event_.event() << " "
201  << curr_event_.run() << " "
202  << curr_event_time_ << " "
203  << curr_event_cpu_ << " "
204  << total_event_cpu_;
205  }
206  if(total_event_count_ == 0) {
211  }
212 
218  }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
double max_event_time_
Definition: Timing.h:60
double curr_event_cpu_
Definition: Timing.h:51
static double getCPU()
Definition: Timing.cc:70
EventID curr_event_
Definition: Timing.h:47
double max_event_cpu_
Definition: Timing.h:61
double total_event_cpu_
Definition: Timing.h:53
int total_event_count_
Definition: Timing.h:64
double min_event_cpu_
Definition: Timing.h:63
static double getTime()
double min_event_time_
Definition: Timing.h:62
double curr_event_time_
Definition: Timing.h:50
void edm::service::Timing::postModule ( ModuleDescription const &  desc)
private

Definition at line 224 of file Timing.cc.

References curr_event_, curr_module_time_, edm::EventID::event(), edm::service::getTime(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::EventID::run(), summary_only_, and lumiQTWidget::t.

Referenced by Timing().

224  {
225  double t = getTime() - curr_module_time_;
226  //LogInfo("TimeModule")
227  if(not summary_only_) {
228  LogPrint("TimeModule") << "TimeModule> " // ChangeLog 4
229  << curr_event_.event() << " "
230  << curr_event_.run() << " "
231  << desc.moduleLabel() << " "
232  << desc.moduleName() << " "
233  << t;
234  }
235 
236  }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
EventID curr_event_
Definition: Timing.h:47
double curr_module_time_
Definition: Timing.h:52
static double getTime()
void edm::service::Timing::preEventProcessing ( EventID const &  iID,
Timestamp const &   
)
private

Definition at line 185 of file Timing.cc.

References curr_event_, curr_event_cpu_, curr_event_time_, edm::service::getCPU(), and edm::service::getTime().

Referenced by Timing().

185  {
186  curr_event_ = iID;
189  }
double curr_event_cpu_
Definition: Timing.h:51
static double getCPU()
Definition: Timing.cc:70
EventID curr_event_
Definition: Timing.h:47
static double getTime()
double curr_event_time_
Definition: Timing.h:50
void edm::service::Timing::preModule ( ModuleDescription const &  )
private

Definition at line 220 of file Timing.cc.

References curr_module_time_, and edm::service::getTime().

Referenced by Timing().

220  {
222  }
double curr_module_time_
Definition: Timing.h:52
static double getTime()

Member Data Documentation

EventID edm::service::Timing::curr_event_
private

Definition at line 47 of file Timing.h.

Referenced by postEventProcessing(), postModule(), and preEventProcessing().

double edm::service::Timing::curr_event_cpu_
private

Definition at line 51 of file Timing.h.

Referenced by postEventProcessing(), and preEventProcessing().

double edm::service::Timing::curr_event_time_
private

Definition at line 50 of file Timing.h.

Referenced by postEventProcessing(), and preEventProcessing().

double edm::service::Timing::curr_job_cpu_
private

Definition at line 49 of file Timing.h.

Referenced by postBeginJob(), and postEndJob().

double edm::service::Timing::curr_job_time_
private

Definition at line 48 of file Timing.h.

Referenced by postBeginJob(), and postEndJob().

double edm::service::Timing::curr_module_time_
private

Definition at line 52 of file Timing.h.

Referenced by postModule(), and preModule().

double edm::service::Timing::max_event_cpu_
private

Definition at line 61 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

double edm::service::Timing::max_event_time_
private

Definition at line 60 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

double edm::service::Timing::min_event_cpu_
private

Definition at line 63 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

double edm::service::Timing::min_event_time_
private

Definition at line 62 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

bool edm::service::Timing::report_summary_
private

Definition at line 55 of file Timing.h.

Referenced by postEndJob().

bool edm::service::Timing::summary_only_
private

Definition at line 54 of file Timing.h.

Referenced by postBeginJob(), postEventProcessing(), postModule(), and Timing().

int edm::service::Timing::total_event_count_
private

Definition at line 64 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

double edm::service::Timing::total_event_cpu_
private

Definition at line 53 of file Timing.h.

Referenced by postBeginJob(), postEndJob(), and postEventProcessing().