CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::service::Timing Class Reference
Inheritance diagram for edm::service::Timing:
edm::TimingServiceBase

Classes

struct  CountAndTime
 

Public Member Functions

void addToCPUTime (double iTime) override
 
double getTotalCPU () const override
 
 Timing (ParameterSet const &, ActivityRegistry &)
 
 ~Timing () override
 
- Public Member Functions inherited from edm::TimingServiceBase
 TimingServiceBase ()
 
virtual ~TimingServiceBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::TimingServiceBase
static void jobStarted ()
 
static double jobStartTime ()
 

Private Member Functions

void accumulateTimeBegin (std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
 
void accumulateTimeEnd (std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
 
void postBeginJob ()
 
double postCommon () const
 
void postEndJob ()
 
void postEvent (StreamContext const &)
 
void postEventSetupGet (eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
 
void postGlobalBeginLumi (GlobalContext const &)
 
void postGlobalBeginRun (GlobalContext const &)
 
void postLockEventSetupGet (eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
 
void postModule (ModuleDescription const &md)
 
void postModuleEvent (StreamContext const &, ModuleCallingContext const &)
 
void postModuleGlobal (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleStream (StreamContext const &, ModuleCallingContext const &)
 
void postOpenFile (std::string const &, bool)
 
void postSourceEvent (StreamID)
 
void postSourceLumi (LuminosityBlockIndex)
 
void postSourceRun (RunIndex)
 
void preEvent (StreamContext const &)
 
void preLockEventSetupGet (eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
 
void preModule (ModuleDescription const &md)
 
void preModuleGlobal (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleStream (StreamContext const &, ModuleCallingContext const &)
 
void preOpenFile (std::string const &, bool)
 
void preSourceEvent (StreamID)
 
void preSourceLumi (LuminosityBlockIndex)
 
void preSourceRun (RunIndex)
 

Private Attributes

double accumulatedTimeForGet_
 
double accumulatedTimeForLock_
 
std::atomic< unsigned long > begin_lumi_count_
 
std::atomic< unsigned long > begin_run_count_
 
std::atomic< CountAndTime * > countAndTimeForGet_
 
std::atomic< CountAndTime * > countAndTimeForLock_
 
CountAndTime countAndTimeZero_
 
std::vector< double > curr_events_time_
 
double curr_job_cpu_
 
double curr_job_time_
 
std::atomic< double > extra_job_cpu_
 
std::atomic< double > last_run_cpu_
 
std::atomic< double > last_run_time_
 
std::vector< double > max_events_time_
 
std::vector< double > min_events_time_
 
unsigned int nStreams_
 
unsigned int nThreads_
 
bool report_summary_
 
std::vector< double > sum_events_time_
 
bool summary_only_
 
double threshold_
 
std::atomic< unsigned long > total_event_count_
 

Detailed Description

Definition at line 43 of file Timing.cc.

Constructor & Destructor Documentation

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

Definition at line 210 of file Timing.cc.

210  :
211  curr_job_time_(0.),
212  curr_job_cpu_(0.),
213  extra_job_cpu_(0.0),
214  last_run_time_(0.0),
215  last_run_cpu_(0.0),
217  summary_only_(iPS.getUntrackedParameter<bool>("summaryOnly")),
218  report_summary_(iPS.getUntrackedParameter<bool>("useJobReport")),
219  threshold_(iPS.getUntrackedParameter<double>("excessiveTimeThreshold")),
224  begin_run_count_(0),
225  countAndTimeZero_{0, 0.0},
230 
231  iRegistry.watchPostBeginJob(this, &Timing::postBeginJob);
232  iRegistry.watchPostEndJob(this, &Timing::postEndJob);
233 
234  iRegistry.watchPreEvent(this, &Timing::preEvent);
235  iRegistry.watchPostEvent(this, &Timing::postEvent);
236 
237  iRegistry.watchPreLockEventSetupGet(this, &Timing::preLockEventSetupGet);
238  iRegistry.watchPostLockEventSetupGet(this, &Timing::postLockEventSetupGet);
239  iRegistry.watchPostEventSetupGet(this, &Timing::postEventSetupGet);
240 
241  bool checkThreshold = true;
242  if (threshold_ <= 0.0) {
243  //we need to ignore the threshold check
245  checkThreshold = false;
246  }
247 
248  if( (not summary_only_) || (checkThreshold) ) {
249  iRegistry.watchPreModuleEvent(this, &Timing::preModuleStream);
250  iRegistry.watchPostModuleEvent(this, &Timing::postModuleEvent);
251  }
252  if(checkThreshold) {
253  iRegistry.watchPreSourceEvent(this, &Timing::preSourceEvent);
254  iRegistry.watchPostSourceEvent(this, &Timing::postSourceEvent);
255 
256  iRegistry.watchPreSourceLumi(this, &Timing::preSourceLumi);
257  iRegistry.watchPostSourceLumi(this, &Timing::postSourceLumi);
258 
259  iRegistry.watchPreSourceRun(this, &Timing::preSourceRun);
260  iRegistry.watchPostSourceRun(this, &Timing::postSourceRun);
261 
262  iRegistry.watchPreOpenFile(this, &Timing::preOpenFile);
263  iRegistry.watchPostOpenFile(this, &Timing::postOpenFile);
264 
265  iRegistry.watchPreEventReadFromSource(this, &Timing::preModuleStream);
266  iRegistry.watchPostEventReadFromSource(this, &Timing::postModuleStream);
267 
268  iRegistry.watchPreModuleConstruction(this, &Timing::preModule);
269  iRegistry.watchPostModuleConstruction(this, &Timing::postModule);
270 
271  iRegistry.watchPreModuleBeginJob(this, &Timing::preModule);
272  iRegistry.watchPostModuleBeginJob(this, &Timing::postModule);
273 
274  iRegistry.watchPreModuleEndJob(this, &Timing::preModule);
275  iRegistry.watchPostModuleEndJob(this, &Timing::postModule);
276 
277  iRegistry.watchPreModuleStreamBeginRun(this, &Timing::preModuleStream);
278  iRegistry.watchPostModuleStreamBeginRun(this, &Timing::postModuleStream);
279  iRegistry.watchPreModuleStreamEndRun(this, &Timing::preModuleStream);
280  iRegistry.watchPostModuleStreamEndRun(this, &Timing::postModuleStream);
281 
282  iRegistry.watchPreModuleStreamBeginLumi(this, &Timing::preModuleStream);
283  iRegistry.watchPostModuleStreamBeginLumi(this, &Timing::postModuleStream);
284  iRegistry.watchPreModuleStreamEndLumi(this, &Timing::preModuleStream);
285  iRegistry.watchPostModuleStreamEndLumi(this, &Timing::postModuleStream);
286 
287  iRegistry.watchPreModuleGlobalBeginRun(this, &Timing::preModuleGlobal);
288  iRegistry.watchPostModuleGlobalBeginRun(this, &Timing::postModuleGlobal);
289  iRegistry.watchPreModuleGlobalEndRun(this, &Timing::preModuleGlobal);
290  iRegistry.watchPostModuleGlobalEndRun(this, &Timing::postModuleGlobal);
291 
292  iRegistry.watchPreModuleGlobalBeginLumi(this, &Timing::preModuleGlobal);
293  iRegistry.watchPostModuleGlobalBeginLumi(this, &Timing::postModuleGlobal);
294  iRegistry.watchPreModuleGlobalEndLumi(this, &Timing::preModuleGlobal);
295  iRegistry.watchPostModuleGlobalEndLumi(this, &Timing::postModuleGlobal);
296 
297  iRegistry.watchPreSourceConstruction(this, &Timing::preModule);
298  iRegistry.watchPostSourceConstruction(this, &Timing::postModule);
299  }
300 
301  iRegistry.watchPostGlobalBeginRun(this, &Timing::postGlobalBeginRun);
302  iRegistry.watchPostGlobalBeginLumi(this, &Timing::postGlobalBeginLumi);
303 
304  iRegistry.preallocateSignal_.connect([this](service::SystemBounds const& iBounds){
305  nStreams_ = iBounds.maxNumberOfStreams();
306  nThreads_ = iBounds.maxNumberOfThreads();
307  curr_events_time_.resize(nStreams_,0.);
308  sum_events_time_.resize(nStreams_,0.);
309  max_events_time_.resize(nStreams_,0.);
310  min_events_time_.resize(nStreams_,1.E6);
311 
312  });
313 
314  iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) {
316  last_run_cpu_ = getCPU();
317  });
318  }
std::vector< double > sum_events_time_
Definition: Timing.cc:126
double curr_job_time_
Definition: Timing.cc:111
std::atomic< double > last_run_cpu_
Definition: Timing.cc:116
std::vector< double > max_events_time_
Definition: Timing.cc:124
std::vector< double > curr_events_time_
Definition: Timing.cc:117
void postLockEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:586
void preModule(ModuleDescription const &md)
Definition: Timing.cc:526
static double getCPU()
Definition: Timing.cc:167
void postEvent(StreamContext const &)
Definition: Timing.cc:460
void preModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:556
double curr_job_cpu_
Definition: Timing.cc:112
std::atomic< unsigned long > begin_lumi_count_
Definition: Timing.cc:128
void preSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:501
unsigned int nThreads_
Definition: Timing.cc:131
void preOpenFile(std::string const &, bool)
Definition: Timing.cc:517
unsigned int nStreams_
Definition: Timing.cc:130
void preModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:536
void postModule(ModuleDescription const &md)
Definition: Timing.cc:531
void postGlobalBeginRun(GlobalContext const &)
Definition: Timing.cc:546
void preSourceRun(RunIndex)
Definition: Timing.cc:509
void postModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:561
std::atomic< CountAndTime * > countAndTimeForGet_
Definition: Timing.cc:138
void postModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:479
std::atomic< double > last_run_time_
Definition: Timing.cc:115
void postSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:505
std::atomic< CountAndTime * > countAndTimeForLock_
Definition: Timing.cc:135
double accumulatedTimeForLock_
Definition: Timing.cc:136
void preLockEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:578
void postGlobalBeginLumi(GlobalContext const &)
Definition: Timing.cc:551
std::atomic< unsigned long > begin_run_count_
Definition: Timing.cc:129
void postEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:595
std::atomic< unsigned long > total_event_count_
Definition: Timing.cc:127
void postSourceRun(RunIndex)
Definition: Timing.cc:513
double accumulatedTimeForGet_
Definition: Timing.cc:139
void postModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:541
CountAndTime countAndTimeZero_
Definition: Timing.cc:133
void postOpenFile(std::string const &, bool)
Definition: Timing.cc:521
static double getTime()
Definition: Timing.cc:160
void postSourceEvent(StreamID)
Definition: Timing.cc:497
std::atomic< double > extra_job_cpu_
Definition: Timing.cc:113
void preSourceEvent(StreamID)
Definition: Timing.cc:493
void preEvent(StreamContext const &)
Definition: Timing.cc:455
std::vector< double > min_events_time_
Definition: Timing.cc:125
edm::service::Timing::~Timing ( )
override

Definition at line 320 of file Timing.cc.

320  {
321  }

Member Function Documentation

void edm::service::Timing::accumulateTimeBegin ( std::atomic< CountAndTime * > &  countAndTime,
double &  accumulatedTime 
)
private

Definition at line 603 of file Timing.cc.

References edm::service::Timing::CountAndTime::count_, countAndTimeZero_, and edm::service::getTime().

Referenced by postLockEventSetupGet(), and preLockEventSetupGet().

603  {
604 
605  double newTime = getTime();
606  auto newStat = std::make_unique<CountAndTime>(0, newTime);
607 
608  CountAndTime* oldStat = countAndTime.load();
609  while (oldStat == nullptr ||
610  !countAndTime.compare_exchange_strong(oldStat, nullptr)) {
611  oldStat = countAndTime.load();
612  }
613 
614  newStat->count_ = oldStat->count_ + 1;
615  if (oldStat->count_ != 0) {
616  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
617  }
618  countAndTime.store(newStat.release());
619  if (oldStat != &countAndTimeZero_) {
620  delete oldStat;
621  }
622  }
CountAndTime countAndTimeZero_
Definition: Timing.cc:133
static double getTime()
Definition: Timing.cc:160
void edm::service::Timing::accumulateTimeEnd ( std::atomic< CountAndTime * > &  countAndTime,
double &  accumulatedTime 
)
private

Definition at line 625 of file Timing.cc.

References edm::service::Timing::CountAndTime::count_, countAndTimeZero_, cppFunctionSkipper::exception, edm::service::getTime(), edm::service::Timing::CountAndTime::time_, and trackingPlots::Timing.

Referenced by postEventSetupGet(), and postLockEventSetupGet().

625  {
626 
627  double newTime = getTime();
628 
629  CountAndTime* oldStat = countAndTime.load();
630  while (oldStat == nullptr ||
631  !countAndTime.compare_exchange_strong(oldStat, nullptr)) {
632  oldStat = countAndTime.load();
633  }
634 
635  if (oldStat->count_ == 1) {
636  accumulatedTime += newTime - oldStat->time_;
637  countAndTime.store(&countAndTimeZero_);
638  } else {
639  try {
640  auto newStat = std::make_unique<CountAndTime>(oldStat->count_ - 1, newTime);
641  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
642  countAndTime.store(newStat.release());
643  } catch (std::exception &) {
644  countAndTime.store(oldStat);
645  throw;
646  }
647  }
648  delete oldStat;
649  }
CountAndTime countAndTimeZero_
Definition: Timing.cc:133
static double getTime()
Definition: Timing.cc:160
void edm::service::Timing::addToCPUTime ( double  iTime)
overridevirtual

Extra CPU time used by a job but not seen by cmsRun The value should be in seconds. This function is safe to call from multiple threads

Implements edm::TimingServiceBase.

Definition at line 323 of file Timing.cc.

References extra_job_cpu_.

323  {
324  //For accounting purposes we effectively can say we started earlier
325  double expected = extra_job_cpu_.load();
326  while( not extra_job_cpu_.compare_exchange_strong(expected,expected+iTime) ) {}
327  }
std::atomic< double > extra_job_cpu_
Definition: Timing.cc:113
void edm::service::Timing::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 333 of file Timing.cc.

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

333  {
335  desc.addUntracked<bool>("summaryOnly", false)->setComment(
336  "If 'true' do not report timing for each event");
337  desc.addUntracked<bool>("useJobReport", true)->setComment(
338  "If 'true' write summary information to JobReport");
339  desc.addUntracked<double>("excessiveTimeThreshold", 0.)->setComment(
340  "Amount of time in seconds before reporting a module or source has taken excessive time. A value of 0.0 turns off this reporting.");
341  descriptions.add("Timing", desc);
342  descriptions.setComment(
343  "This service reports the time it takes to run each module in a job.");
344  }
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double edm::service::Timing::getTotalCPU ( ) const
overridevirtual

CPU time used by this process and all its children. The value returned should be in seconds.

Implements edm::TimingServiceBase.

Definition at line 329 of file Timing.cc.

References edm::service::getCPU().

329  {
330  return getCPU();
331  }
static double getCPU()
Definition: Timing.cc:167
void edm::service::Timing::postBeginJob ( )
private

Definition at line 346 of file Timing.cc.

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

346  {
348  curr_job_cpu_ = getCPU();
349 
350  if(not summary_only_) {
351  LogImportant("TimeReport")
352  << "TimeReport> Report activated" << "\n"
353  << "TimeReport> Report columns headings for events: "
354  << "eventnum runnum timetaken\n"
355  << "TimeReport> Report columns headings for modules: "
356  << "eventnum runnum modulelabel modulename timetakeni\n"
357  << "TimeReport> JobTime=" << curr_job_time_ << " JobCPU=" << curr_job_cpu_ << "\n";
358  }
359  }
double curr_job_time_
Definition: Timing.cc:111
static double getCPU()
Definition: Timing.cc:167
double curr_job_cpu_
Definition: Timing.cc:112
static double getTime()
Definition: Timing.cc:160
double edm::service::Timing::postCommon ( ) const
private

Definition at line 566 of file Timing.cc.

References edm::service::popStack(), lumiQTWidget::t, and threshold_.

Referenced by postModule(), postModuleEvent(), postModuleGlobal(), postModuleStream(), postOpenFile(), postSourceEvent(), postSourceLumi(), and postSourceRun().

566  {
567  double t = popStack();
568  if(t > threshold_) {
569  LogError("ExcessiveTime")
570  << "ExcessiveTime: Module used " << t
571  << " seconds of time which exceeds the error threshold configured in the Timing Service of "
572  << threshold_ << " seconds.";
573  }
574  return t;
575  }
static double popStack()
Definition: Timing.cc:195
void edm::service::Timing::postEndJob ( )
private

Definition at line 361 of file Timing.cc.

References accumulatedTimeForGet_, accumulatedTimeForLock_, begin_lumi_count_, begin_run_count_, curr_job_cpu_, curr_job_time_, edm::service::d2str(), extra_job_cpu_, edm::service::getCPU(), edm::service::getTime(), edm::TimingServiceBase::jobStartTime(), last_run_cpu_, last_run_time_, max_events_time_, min_events_time_, nStreams_, nThreads_, report_summary_, sum_events_time_, lumiQTWidget::t, total_event_count_, and edm::service::ui2str().

361  {
362  const double job_end_time =getTime();
363  const double job_end_cpu =getCPU();
364  double total_job_time = job_end_time - jobStartTime();
365 
366  double total_job_cpu = job_end_cpu+extra_job_cpu_;
367 
368  const double total_initialization_time = curr_job_time_ - jobStartTime();
369  const double total_initialization_cpu = curr_job_cpu_;
370 
371  if( 0.0 == jobStartTime()) {
372  //did not capture beginning time
373  total_job_time =job_end_time - curr_job_time_;
374  total_job_cpu =job_end_cpu + extra_job_cpu_ - curr_job_cpu_ ;
375  }
376 
377  double min_event_time = *(std::min_element(min_events_time_.begin(),
378  min_events_time_.end()));
379  double max_event_time = *(std::max_element(max_events_time_.begin(),
380  max_events_time_.end()));
381 
382  auto total_loop_time = last_run_time_ - curr_job_time_;
383  auto total_loop_cpu = last_run_cpu_ + extra_job_cpu_ - curr_job_cpu_;
384 
385  if(last_run_time_ == 0.0) {
386  total_loop_time = 0.0;
387  total_loop_cpu = 0.0;
388  }
389 
390  double sum_all_events_time = 0;
391  for(auto t : sum_events_time_) { sum_all_events_time += t; }
392 
393  double average_event_time = 0.0;
394  if(total_event_count_ != 0) {
395  average_event_time = sum_all_events_time / total_event_count_;
396  }
397 
398  double event_throughput = 0.0;
399  if(total_loop_time != 0.0) {
400  event_throughput = total_event_count_ / total_loop_time;
401  }
402 
403  LogImportant("TimeReport")
404  << "TimeReport> Time report complete in "
405  << total_job_time << " seconds"
406  << "\n"
407  << " Time Summary: \n"
408  << " - Min event: " << min_event_time << "\n"
409  << " - Max event: " << max_event_time << "\n"
410  << " - Avg event: " << average_event_time << "\n"
411  << " - Total loop: " << total_loop_time <<"\n"
412  << " - Total init: " << total_initialization_time <<"\n"
413  << " - Total job: " << total_job_time << "\n"
414  << " - EventSetup Lock: " << accumulatedTimeForLock_ << "\n"
415  << " - EventSetup Get: " << accumulatedTimeForGet_ << "\n"
416  << " Event Throughput: "<< event_throughput <<" ev/s\n"
417  << " CPU Summary: \n"
418  << " - Total loop: " << total_loop_cpu << "\n"
419  << " - Total init: " << total_initialization_cpu <<"\n"
420  << " - Total extra: " << extra_job_cpu_ << "\n"
421  << " - Total job: " << total_job_cpu << "\n"
422  << " Processing Summary: \n"
423  << " - Number of Events: " << total_event_count_ << "\n"
424  << " - Number of Global Begin Lumi Calls: " << begin_lumi_count_ << "\n"
425  << " - Number of Global Begin Run Calls: " << begin_run_count_ << "\n";
426 
427  if(report_summary_) {
428  Service<JobReport> reportSvc;
429  std::map<std::string, std::string> reportData;
430 
431  reportData.insert(std::make_pair("MinEventTime", d2str(min_event_time)));
432  reportData.insert(std::make_pair("MaxEventTime", d2str(max_event_time)));
433  reportData.insert(std::make_pair("AvgEventTime", d2str(average_event_time)));
434  reportData.insert(std::make_pair("EventThroughput", d2str(event_throughput)));
435  reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time)));
436  reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu)));
437  reportData.insert(std::make_pair("TotalLoopTime", d2str(total_loop_time)));
438  reportData.insert(std::make_pair("TotalLoopCPU", d2str(total_loop_cpu)));
439  reportData.insert(std::make_pair("TotalInitTime", d2str(total_initialization_time)));
440  reportData.insert(std::make_pair("TotalInitCPU", d2str(total_initialization_cpu)));
441  reportData.insert(std::make_pair("NumberOfStreams",ui2str(nStreams_)));
442  reportData.insert(std::make_pair("NumberOfThreads",ui2str(nThreads_)));
443  reportData.insert(std::make_pair("EventSetup Lock",d2str(accumulatedTimeForLock_)));
444  reportData.insert(std::make_pair("EventSetup Get",d2str(accumulatedTimeForGet_)));
445  reportSvc->reportPerformanceSummary("Timing", reportData);
446 
447  std::map<std::string, std::string> reportData1;
448  reportData1.insert(std::make_pair("NumberEvents", ui2str(total_event_count_)));
449  reportData1.insert(std::make_pair("NumberBeginLumiCalls", ui2str(begin_lumi_count_)));
450  reportData1.insert(std::make_pair("NumberBeginRunCalls", ui2str(begin_run_count_)));
451  reportSvc->reportPerformanceSummary("ProcessingSummary", reportData1);
452  }
453  }
std::vector< double > sum_events_time_
Definition: Timing.cc:126
double curr_job_time_
Definition: Timing.cc:111
std::atomic< double > last_run_cpu_
Definition: Timing.cc:116
std::vector< double > max_events_time_
Definition: Timing.cc:124
static double getCPU()
Definition: Timing.cc:167
double curr_job_cpu_
Definition: Timing.cc:112
std::atomic< unsigned long > begin_lumi_count_
Definition: Timing.cc:128
unsigned int nThreads_
Definition: Timing.cc:131
unsigned int nStreams_
Definition: Timing.cc:130
std::atomic< double > last_run_time_
Definition: Timing.cc:115
double accumulatedTimeForLock_
Definition: Timing.cc:136
static double jobStartTime()
static std::string ui2str(unsigned int i)
Definition: Timing.cc:153
std::atomic< unsigned long > begin_run_count_
Definition: Timing.cc:129
std::atomic< unsigned long > total_event_count_
Definition: Timing.cc:127
static std::string d2str(double d)
double accumulatedTimeForGet_
Definition: Timing.cc:139
static double getTime()
Definition: Timing.cc:160
std::atomic< double > extra_job_cpu_
Definition: Timing.cc:113
std::vector< double > min_events_time_
Definition: Timing.cc:125
void edm::service::Timing::postEvent ( StreamContext const &  iStream)
private

Definition at line 460 of file Timing.cc.

References curr_events_time_, edm::StreamContext::eventID(), edm::service::getTime(), max_events_time_, min_events_time_, edm::StreamContext::streamID(), sum_events_time_, total_event_count_, and edm::StreamID::value().

460  {
461  auto index = iStream.streamID().value();
462 
463  double curr_event_time = getTime() - curr_events_time_[index];
464  sum_events_time_[index] +=curr_event_time;
465 
466  if(not summary_only_) {
467  auto const & eventID = iStream.eventID();
468  LogPrint("TimeEvent")
469  << "TimeEvent> "
470  << eventID.event() << " "
471  << eventID.run() << " "
472  << curr_event_time ;
473  }
474  if(curr_event_time > max_events_time_[index]) max_events_time_[index] = curr_event_time;
475  if(curr_event_time < min_events_time_[index]) min_events_time_[index] = curr_event_time;
477  }
std::vector< double > sum_events_time_
Definition: Timing.cc:126
std::vector< double > max_events_time_
Definition: Timing.cc:124
std::vector< double > curr_events_time_
Definition: Timing.cc:117
std::atomic< unsigned long > total_event_count_
Definition: Timing.cc:127
static double getTime()
Definition: Timing.cc:160
std::vector< double > min_events_time_
Definition: Timing.cc:125
void edm::service::Timing::postEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

Definition at line 595 of file Timing.cc.

References accumulatedTimeForGet_, accumulateTimeEnd(), and countAndTimeForGet_.

597  {
598 
600  }
std::atomic< CountAndTime * > countAndTimeForGet_
Definition: Timing.cc:138
void accumulateTimeEnd(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:625
double accumulatedTimeForGet_
Definition: Timing.cc:139
void edm::service::Timing::postGlobalBeginLumi ( GlobalContext const &  )
private

Definition at line 551 of file Timing.cc.

References begin_lumi_count_.

551  {
553  }
std::atomic< unsigned long > begin_lumi_count_
Definition: Timing.cc:128
void edm::service::Timing::postGlobalBeginRun ( GlobalContext const &  )
private

Definition at line 546 of file Timing.cc.

References begin_run_count_.

546  {
548  }
std::atomic< unsigned long > begin_run_count_
Definition: Timing.cc:129
void edm::service::Timing::postLockEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

Definition at line 586 of file Timing.cc.

References accumulatedTimeForGet_, accumulatedTimeForLock_, accumulateTimeBegin(), accumulateTimeEnd(), countAndTimeForGet_, and countAndTimeForLock_.

588  {
589 
592  }
void accumulateTimeBegin(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:603
std::atomic< CountAndTime * > countAndTimeForGet_
Definition: Timing.cc:138
void accumulateTimeEnd(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:625
std::atomic< CountAndTime * > countAndTimeForLock_
Definition: Timing.cc:135
double accumulatedTimeForLock_
Definition: Timing.cc:136
double accumulatedTimeForGet_
Definition: Timing.cc:139
void edm::service::Timing::postModule ( ModuleDescription const &  md)
private

Definition at line 531 of file Timing.cc.

References postCommon().

531  {
532  postCommon();
533  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postModuleEvent ( StreamContext const &  iStream,
ModuleCallingContext const &  iModule 
)
private

Definition at line 479 of file Timing.cc.

References edm::StreamContext::eventID(), edm::ModuleCallingContext::moduleDescription(), postCommon(), and lumiQTWidget::t.

479  {
480  auto const & eventID = iStream.eventID();
481  auto const & desc = *(iModule.moduleDescription());
482  double t = postCommon();
483  if ( not summary_only_) {
484  LogPrint("TimeModule") << "TimeModule> "
485  << eventID.event() << " "
486  << eventID.run() << " "
487  << desc.moduleLabel() << " "
488  << desc.moduleName() << " "
489  << t;
490  }
491  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postModuleGlobal ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)
private

Definition at line 541 of file Timing.cc.

References postCommon().

541  {
542  postCommon();
543  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postModuleStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)
private

Definition at line 561 of file Timing.cc.

References postCommon().

561  {
562  postCommon();
563  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postOpenFile ( std::string const &  lfn,
bool  b 
)
private

Definition at line 521 of file Timing.cc.

References postCommon().

521  {
522  postCommon();
523  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postSourceEvent ( StreamID  sid)
private

Definition at line 497 of file Timing.cc.

References postCommon().

497  {
498  postCommon();
499  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postSourceLumi ( LuminosityBlockIndex  index)
private

Definition at line 505 of file Timing.cc.

References postCommon().

505  {
506  postCommon();
507  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::postSourceRun ( RunIndex  index)
private

Definition at line 513 of file Timing.cc.

References postCommon().

513  {
514  postCommon();
515  }
double postCommon() const
Definition: Timing.cc:566
void edm::service::Timing::preEvent ( StreamContext const &  iStream)
private

Definition at line 455 of file Timing.cc.

References curr_events_time_, edm::service::getTime(), edm::StreamContext::streamID(), and edm::StreamID::value().

455  {
456  auto index = iStream.streamID().value();
458  }
std::vector< double > curr_events_time_
Definition: Timing.cc:117
static double getTime()
Definition: Timing.cc:160
void edm::service::Timing::preLockEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

Definition at line 578 of file Timing.cc.

References accumulatedTimeForLock_, accumulateTimeBegin(), and countAndTimeForLock_.

580  {
581 
583  }
void accumulateTimeBegin(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:603
std::atomic< CountAndTime * > countAndTimeForLock_
Definition: Timing.cc:135
double accumulatedTimeForLock_
Definition: Timing.cc:136
void edm::service::Timing::preModule ( ModuleDescription const &  md)
private

Definition at line 526 of file Timing.cc.

References edm::service::pushStack().

526  {
527  pushStack();
528  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preModuleGlobal ( GlobalContext const &  ,
ModuleCallingContext const &   
)
private

Definition at line 536 of file Timing.cc.

References edm::service::pushStack().

536  {
537  pushStack();
538  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preModuleStream ( StreamContext const &  ,
ModuleCallingContext const &   
)
private

Definition at line 556 of file Timing.cc.

References edm::service::pushStack().

556  {
557  pushStack();
558  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preOpenFile ( std::string const &  lfn,
bool  b 
)
private

Definition at line 517 of file Timing.cc.

References edm::service::pushStack().

517  {
518  pushStack();
519  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preSourceEvent ( StreamID  sid)
private

Definition at line 493 of file Timing.cc.

References edm::service::pushStack().

493  {
494  pushStack();
495  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preSourceLumi ( LuminosityBlockIndex  index)
private

Definition at line 501 of file Timing.cc.

References edm::service::pushStack().

501  {
502  pushStack();
503  }
static void pushStack()
Definition: Timing.cc:205
void edm::service::Timing::preSourceRun ( RunIndex  index)
private

Definition at line 509 of file Timing.cc.

References edm::service::pushStack().

509  {
510  pushStack();
511  }
static void pushStack()
Definition: Timing.cc:205

Member Data Documentation

double edm::service::Timing::accumulatedTimeForGet_
private

Definition at line 139 of file Timing.cc.

Referenced by postEndJob(), postEventSetupGet(), and postLockEventSetupGet().

double edm::service::Timing::accumulatedTimeForLock_
private

Definition at line 136 of file Timing.cc.

Referenced by postEndJob(), postLockEventSetupGet(), and preLockEventSetupGet().

std::atomic<unsigned long> edm::service::Timing::begin_lumi_count_
private

Definition at line 128 of file Timing.cc.

Referenced by postEndJob(), and postGlobalBeginLumi().

std::atomic<unsigned long> edm::service::Timing::begin_run_count_
private

Definition at line 129 of file Timing.cc.

Referenced by postEndJob(), and postGlobalBeginRun().

std::atomic<CountAndTime*> edm::service::Timing::countAndTimeForGet_
private

Definition at line 138 of file Timing.cc.

Referenced by postEventSetupGet(), and postLockEventSetupGet().

std::atomic<CountAndTime*> edm::service::Timing::countAndTimeForLock_
private

Definition at line 135 of file Timing.cc.

Referenced by postLockEventSetupGet(), and preLockEventSetupGet().

CountAndTime edm::service::Timing::countAndTimeZero_
private

Definition at line 133 of file Timing.cc.

Referenced by accumulateTimeBegin(), and accumulateTimeEnd().

std::vector<double> edm::service::Timing::curr_events_time_
private

Definition at line 117 of file Timing.cc.

Referenced by postEvent(), and preEvent().

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

Definition at line 112 of file Timing.cc.

Referenced by postBeginJob(), and postEndJob().

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

Definition at line 111 of file Timing.cc.

Referenced by postBeginJob(), and postEndJob().

std::atomic<double> edm::service::Timing::extra_job_cpu_
private

Definition at line 113 of file Timing.cc.

Referenced by addToCPUTime(), and postEndJob().

std::atomic<double> edm::service::Timing::last_run_cpu_
private

Definition at line 116 of file Timing.cc.

Referenced by postEndJob().

std::atomic<double> edm::service::Timing::last_run_time_
private

Definition at line 115 of file Timing.cc.

Referenced by postEndJob().

std::vector<double> edm::service::Timing::max_events_time_
private

Definition at line 124 of file Timing.cc.

Referenced by postEndJob(), and postEvent().

std::vector<double> edm::service::Timing::min_events_time_
private

Definition at line 125 of file Timing.cc.

Referenced by postEndJob(), and postEvent().

unsigned int edm::service::Timing::nStreams_
private

Definition at line 130 of file Timing.cc.

Referenced by postEndJob().

unsigned int edm::service::Timing::nThreads_
private

Definition at line 131 of file Timing.cc.

Referenced by postEndJob().

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

Definition at line 119 of file Timing.cc.

Referenced by postEndJob().

std::vector<double> edm::service::Timing::sum_events_time_
private

Definition at line 126 of file Timing.cc.

Referenced by postEndJob(), and postEvent().

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

Definition at line 118 of file Timing.cc.

double edm::service::Timing::threshold_
private

Definition at line 120 of file Timing.cc.

Referenced by postCommon().

std::atomic<unsigned long> edm::service::Timing::total_event_count_
private

Definition at line 127 of file Timing.cc.

Referenced by postEndJob(), and postEvent().