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 lastPostEvent (double curr_event_time, unsigned int index, StreamContext const &iStream)
 
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 preBeginJob (PathsAndConsumesOfModulesBase const &, ProcessContext const &)
 
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_
 
bool configuredInTopLevelProcess_
 
std::atomic< CountAndTime * > countAndTimeForGet_
 
std::atomic< CountAndTime * > countAndTimeForLock_
 
CountAndTime countAndTimeZero_
 
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPostEvent_
 
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPreEvent_
 
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 nSubProcesses_
 
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 46 of file Timing.cc.

Constructor & Destructor Documentation

◆ Timing()

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

Definition at line 219 of file Timing.cc.

220  : curr_job_time_(0.),
221  curr_job_cpu_(0.),
222  extra_job_cpu_(0.0),
223  last_run_time_(0.0),
224  last_run_cpu_(0.0),
226  summary_only_(iPS.getUntrackedParameter<bool>("summaryOnly")),
227  report_summary_(iPS.getUntrackedParameter<bool>("useJobReport")),
228  threshold_(iPS.getUntrackedParameter<double>("excessiveTimeThreshold")),
233  begin_run_count_(0),
234  countAndTimeZero_{0, 0.0},
240  nSubProcesses_{0} {
241  iRegistry.watchPreBeginJob(this, &Timing::preBeginJob);
242  iRegistry.watchPostBeginJob(this, &Timing::postBeginJob);
243  iRegistry.watchPostEndJob(this, &Timing::postEndJob);
244 
245  iRegistry.watchPreEvent(this, &Timing::preEvent);
246  iRegistry.watchPostEvent(this, &Timing::postEvent);
247 
248  iRegistry.watchPreLockEventSetupGet(this, &Timing::preLockEventSetupGet);
249  iRegistry.watchPostLockEventSetupGet(this, &Timing::postLockEventSetupGet);
250  iRegistry.watchPostEventSetupGet(this, &Timing::postEventSetupGet);
251 
252  bool checkThreshold = true;
253  if (threshold_ <= 0.0) {
254  //we need to ignore the threshold check
256  checkThreshold = false;
257  }
258 
259  if ((not summary_only_) || (checkThreshold)) {
260  iRegistry.watchPreModuleEvent(this, &Timing::preModuleStream);
261  iRegistry.watchPostModuleEvent(this, &Timing::postModuleEvent);
262  }
263  if (checkThreshold) {
264  iRegistry.watchPreSourceEvent(this, &Timing::preSourceEvent);
265  iRegistry.watchPostSourceEvent(this, &Timing::postSourceEvent);
266 
267  iRegistry.watchPreSourceLumi(this, &Timing::preSourceLumi);
268  iRegistry.watchPostSourceLumi(this, &Timing::postSourceLumi);
269 
270  iRegistry.watchPreSourceRun(this, &Timing::preSourceRun);
271  iRegistry.watchPostSourceRun(this, &Timing::postSourceRun);
272 
273  iRegistry.watchPreOpenFile(this, &Timing::preOpenFile);
274  iRegistry.watchPostOpenFile(this, &Timing::postOpenFile);
275 
276  iRegistry.watchPreEventReadFromSource(this, &Timing::preModuleStream);
277  iRegistry.watchPostEventReadFromSource(this, &Timing::postModuleStream);
278 
279  iRegistry.watchPreModuleConstruction(this, &Timing::preModule);
280  iRegistry.watchPostModuleConstruction(this, &Timing::postModule);
281 
282  iRegistry.watchPreModuleBeginJob(this, &Timing::preModule);
283  iRegistry.watchPostModuleBeginJob(this, &Timing::postModule);
284 
285  iRegistry.watchPreModuleEndJob(this, &Timing::preModule);
286  iRegistry.watchPostModuleEndJob(this, &Timing::postModule);
287 
288  iRegistry.watchPreModuleStreamBeginRun(this, &Timing::preModuleStream);
289  iRegistry.watchPostModuleStreamBeginRun(this, &Timing::postModuleStream);
290  iRegistry.watchPreModuleStreamEndRun(this, &Timing::preModuleStream);
291  iRegistry.watchPostModuleStreamEndRun(this, &Timing::postModuleStream);
292 
293  iRegistry.watchPreModuleStreamBeginLumi(this, &Timing::preModuleStream);
294  iRegistry.watchPostModuleStreamBeginLumi(this, &Timing::postModuleStream);
295  iRegistry.watchPreModuleStreamEndLumi(this, &Timing::preModuleStream);
296  iRegistry.watchPostModuleStreamEndLumi(this, &Timing::postModuleStream);
297 
298  iRegistry.watchPreModuleGlobalBeginRun(this, &Timing::preModuleGlobal);
299  iRegistry.watchPostModuleGlobalBeginRun(this, &Timing::postModuleGlobal);
300  iRegistry.watchPreModuleGlobalEndRun(this, &Timing::preModuleGlobal);
301  iRegistry.watchPostModuleGlobalEndRun(this, &Timing::postModuleGlobal);
302 
303  iRegistry.watchPreModuleGlobalBeginLumi(this, &Timing::preModuleGlobal);
304  iRegistry.watchPostModuleGlobalBeginLumi(this, &Timing::postModuleGlobal);
305  iRegistry.watchPreModuleGlobalEndLumi(this, &Timing::preModuleGlobal);
306  iRegistry.watchPostModuleGlobalEndLumi(this, &Timing::postModuleGlobal);
307 
308  iRegistry.watchPreSourceConstruction(this, &Timing::preModule);
309  iRegistry.watchPostSourceConstruction(this, &Timing::postModule);
310  }
311 
312  iRegistry.watchPostGlobalBeginRun(this, &Timing::postGlobalBeginRun);
313  iRegistry.watchPostGlobalBeginLumi(this, &Timing::postGlobalBeginLumi);
314 
315  iRegistry.preallocateSignal_.connect([this](service::SystemBounds const& iBounds) {
316  nStreams_ = iBounds.maxNumberOfStreams();
317  nThreads_ = iBounds.maxNumberOfThreads();
318  curr_events_time_.resize(nStreams_, 0.);
319  sum_events_time_.resize(nStreams_, 0.);
320  max_events_time_.resize(nStreams_, 0.);
321  min_events_time_.resize(nStreams_, 1.E6);
322  for (unsigned int i = 0; i < nStreams_; ++i) {
323  countSubProcessesPreEvent_.emplace_back(std::make_unique<std::atomic<unsigned int>>(0));
324  countSubProcessesPostEvent_.emplace_back(std::make_unique<std::atomic<unsigned int>>(0));
325  }
326  });
327 
328  iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) {
330  last_run_cpu_ = getCPU();
331  });
332  }

◆ ~Timing()

edm::service::Timing::~Timing ( )
override

Definition at line 334 of file Timing.cc.

334 {}

Member Function Documentation

◆ accumulateTimeBegin()

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

Definition at line 633 of file Timing.cc.

633  {
634  double newTime = getTime();
635  auto newStat = std::make_unique<CountAndTime>(0, newTime);
636 
637  CountAndTime* oldStat = countAndTime.load();
638  while (true) {
639  if (oldStat == nullptr) {
640  oldStat = countAndTime.load();
641  } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) {
642  break;
643  }
644  }
645 
646  newStat->count_ = oldStat->count_ + 1;
647  if (oldStat->count_ != 0) {
648  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
649  }
650  countAndTime.store(newStat.release());
651  if (oldStat != &countAndTimeZero_) {
652  delete oldStat;
653  }
654  }

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

Referenced by postLockEventSetupGet(), and preLockEventSetupGet().

◆ accumulateTimeEnd()

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

Definition at line 656 of file Timing.cc.

656  {
657  double newTime = getTime();
658 
659  CountAndTime* oldStat = countAndTime.load();
660  while (true) {
661  if (oldStat == nullptr) {
662  oldStat = countAndTime.load();
663  } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) {
664  break;
665  }
666  }
667 
668  if (oldStat->count_ == 1) {
669  accumulatedTime += newTime - oldStat->time_;
670  countAndTime.store(&countAndTimeZero_);
671  } else {
672  try {
673  auto newStat = std::make_unique<CountAndTime>(oldStat->count_ - 1, newTime);
674  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
675  countAndTime.store(newStat.release());
676  } catch (std::exception&) {
677  countAndTime.store(oldStat);
678  throw;
679  }
680  }
681  delete oldStat;
682  }

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

Referenced by postEventSetupGet(), and postLockEventSetupGet().

◆ addToCPUTime()

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 336 of file Timing.cc.

336  {
337  //For accounting purposes we effectively can say we started earlier
338  double expected = extra_job_cpu_.load();
339  while (not extra_job_cpu_.compare_exchange_strong(expected, expected + iTime)) {
340  }
341  }

References extra_job_cpu_.

◆ fillDescriptions()

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

Definition at line 345 of file Timing.cc.

345  {
347  desc.addUntracked<bool>("summaryOnly", false)->setComment("If 'true' do not report timing for each event");
348  desc.addUntracked<bool>("useJobReport", true)->setComment("If 'true' write summary information to JobReport");
349  desc.addUntracked<double>("excessiveTimeThreshold", 0.)
350  ->setComment(
351  "Amount of time in seconds before reporting a module or source has taken excessive time. A value of 0.0 "
352  "turns off this reporting.");
353  descriptions.add("Timing", desc);
354  descriptions.setComment("This service reports the time it takes to run each module in a job.");
355  }

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

◆ getTotalCPU()

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 343 of file Timing.cc.

343 { return getCPU(); }

References edm::service::getCPU().

◆ lastPostEvent()

void edm::service::Timing::lastPostEvent ( double  curr_event_time,
unsigned int  index,
StreamContext const &  iStream 
)
private

Definition at line 517 of file Timing.cc.

517  {
518  sum_events_time_[index] += curr_event_time;
519 
520  if (not summary_only_) {
521  auto const& eventID = iStream.eventID();
522  LogPrint("TimeEvent") << "TimeEvent> " << eventID.event() << " " << eventID.run() << " " << curr_event_time;
523  }
524  if (curr_event_time > max_events_time_[index])
525  max_events_time_[index] = curr_event_time;
526  if (curr_event_time < min_events_time_[index])
527  min_events_time_[index] = curr_event_time;
529  }

References edm::StreamContext::eventID(), max_events_time_, min_events_time_, sum_events_time_, summary_only_, and total_event_count_.

Referenced by postEvent().

◆ postBeginJob()

void edm::service::Timing::postBeginJob ( )
private

Definition at line 365 of file Timing.cc.

365  {
367  return;
368  }
370  curr_job_cpu_ = getCPU();
371 
372  if (not summary_only_) {
373  LogImportant("TimeReport") << "TimeReport> Report activated"
374  << "\n"
375  << "TimeReport> Report columns headings for events: "
376  << "eventnum runnum timetaken\n"
377  << "TimeReport> Report columns headings for modules: "
378  << "eventnum runnum modulelabel modulename timetakeni\n"
379  << "TimeReport> JobTime=" << curr_job_time_ << " JobCPU=" << curr_job_cpu_ << "\n";
380  }
381  }

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

◆ postCommon()

double edm::service::Timing::postCommon ( ) const
private

Definition at line 594 of file Timing.cc.

594  {
596  return 0.0;
597  }
598  double t = popStack();
599  if (t > threshold_) {
600  LogError("ExcessiveTime")
601  << "ExcessiveTime: Module used " << t
602  << " seconds of time which exceeds the error threshold configured in the Timing Service of " << threshold_
603  << " seconds.";
604  }
605  return t;
606  }

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

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

◆ postEndJob()

void edm::service::Timing::postEndJob ( )
private

Definition at line 383 of file Timing.cc.

383  {
385  LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it "
386  "is configured in a SubProcess.\n"
387  << "If multiple instances of the TimingService were configured only the one in the "
388  "top level process will function.\n"
389  << "The other instance(s) will simply print this message and do nothing.\n\n";
390  return;
391  }
392 
393  const double job_end_time = getTime();
394  const double job_end_cpu = getCPU();
395  double total_job_time = job_end_time - jobStartTime();
396 
397  double total_job_cpu = job_end_cpu + extra_job_cpu_;
398 
399  const double total_initialization_time = curr_job_time_ - jobStartTime();
400  const double total_initialization_cpu = curr_job_cpu_;
401 
402  if (0.0 == jobStartTime()) {
403  //did not capture beginning time
404  total_job_time = job_end_time - curr_job_time_;
405  total_job_cpu = job_end_cpu + extra_job_cpu_ - curr_job_cpu_;
406  }
407 
408  double min_event_time = *(std::min_element(min_events_time_.begin(), min_events_time_.end()));
409  double max_event_time = *(std::max_element(max_events_time_.begin(), max_events_time_.end()));
410 
411  auto total_loop_time = last_run_time_ - curr_job_time_;
412  auto total_loop_cpu = last_run_cpu_ + extra_job_cpu_ - curr_job_cpu_;
413 
414  if (last_run_time_ == 0.0) {
415  total_loop_time = 0.0;
416  total_loop_cpu = 0.0;
417  }
418 
419  double sum_all_events_time = 0;
420  for (auto t : sum_events_time_) {
421  sum_all_events_time += t;
422  }
423 
424  double average_event_time = 0.0;
425  if (total_event_count_ != 0) {
426  average_event_time = sum_all_events_time / total_event_count_;
427  }
428 
429  double event_throughput = 0.0;
430  if (total_loop_time != 0.0) {
431  event_throughput = total_event_count_ / total_loop_time;
432  }
433 
434  LogImportant("TimeReport") << "TimeReport> Time report complete in " << total_job_time << " seconds"
435  << "\n"
436  << " Time Summary: \n"
437  << " - Min event: " << min_event_time << "\n"
438  << " - Max event: " << max_event_time << "\n"
439  << " - Avg event: " << average_event_time << "\n"
440  << " - Total loop: " << total_loop_time << "\n"
441  << " - Total init: " << total_initialization_time << "\n"
442  << " - Total job: " << total_job_time << "\n"
443  << " - EventSetup Lock: " << accumulatedTimeForLock_ << "\n"
444  << " - EventSetup Get: " << accumulatedTimeForGet_ << "\n"
445  << " Event Throughput: " << event_throughput << " ev/s\n"
446  << " CPU Summary: \n"
447  << " - Total loop: " << total_loop_cpu << "\n"
448  << " - Total init: " << total_initialization_cpu << "\n"
449  << " - Total extra: " << extra_job_cpu_ << "\n"
450  << " - Total job: " << total_job_cpu << "\n"
451  << " Processing Summary: \n"
452  << " - Number of Events: " << total_event_count_ << "\n"
453  << " - Number of Global Begin Lumi Calls: " << begin_lumi_count_ << "\n"
454  << " - Number of Global Begin Run Calls: " << begin_run_count_ << "\n";
455 
456  if (report_summary_) {
457  Service<JobReport> reportSvc;
458  std::map<std::string, std::string> reportData;
459 
460  reportData.insert(std::make_pair("MinEventTime", d2str(min_event_time)));
461  reportData.insert(std::make_pair("MaxEventTime", d2str(max_event_time)));
462  reportData.insert(std::make_pair("AvgEventTime", d2str(average_event_time)));
463  reportData.insert(std::make_pair("EventThroughput", d2str(event_throughput)));
464  reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time)));
465  reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu)));
466  reportData.insert(std::make_pair("TotalLoopTime", d2str(total_loop_time)));
467  reportData.insert(std::make_pair("TotalLoopCPU", d2str(total_loop_cpu)));
468  reportData.insert(std::make_pair("TotalInitTime", d2str(total_initialization_time)));
469  reportData.insert(std::make_pair("TotalInitCPU", d2str(total_initialization_cpu)));
470  reportData.insert(std::make_pair("NumberOfStreams", ui2str(nStreams_)));
471  reportData.insert(std::make_pair("NumberOfThreads", ui2str(nThreads_)));
472  reportData.insert(std::make_pair("EventSetup Lock", d2str(accumulatedTimeForLock_)));
473  reportData.insert(std::make_pair("EventSetup Get", d2str(accumulatedTimeForGet_)));
474  reportSvc->reportPerformanceSummary("Timing", reportData);
475 
476  std::map<std::string, std::string> reportData1;
477  reportData1.insert(std::make_pair("NumberEvents", ui2str(total_event_count_)));
478  reportData1.insert(std::make_pair("NumberBeginLumiCalls", ui2str(begin_lumi_count_)));
479  reportData1.insert(std::make_pair("NumberBeginRunCalls", ui2str(begin_run_count_)));
480  reportSvc->reportPerformanceSummary("ProcessingSummary", reportData1);
481  }
482  }

References accumulatedTimeForGet_, accumulatedTimeForLock_, begin_lumi_count_, begin_run_count_, configuredInTopLevelProcess_, 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_, OrderedSet::t, total_event_count_, and edm::service::ui2str().

◆ postEvent()

void edm::service::Timing::postEvent ( StreamContext const &  iStream)
private

Definition at line 501 of file Timing.cc.

501  {
503  return;
504  }
505  auto index = iStream.streamID().value();
506  if (nSubProcesses_ == 0u) {
508  } else {
509  unsigned int count = ++(*countSubProcessesPostEvent_[index]);
510  if (count == (nSubProcesses_ + 1)) {
513  }
514  }
515  }

References configuredInTopLevelProcess_, KineDebug3::count(), countSubProcessesPostEvent_, curr_events_time_, edm::service::getTime(), lastPostEvent(), nSubProcesses_, edm::StreamContext::streamID(), and edm::StreamID::value().

◆ postEventSetupGet()

void edm::service::Timing::postEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

◆ postGlobalBeginLumi()

void edm::service::Timing::postGlobalBeginLumi ( GlobalContext const &  gc)
private

Definition at line 579 of file Timing.cc.

579  {
581  return;
582  }
583  if (!gc.processContext()->isSubProcess()) {
585  }
586  }

References begin_lumi_count_, configuredInTopLevelProcess_, edm::ProcessContext::isSubProcess(), and edm::GlobalContext::processContext().

◆ postGlobalBeginRun()

void edm::service::Timing::postGlobalBeginRun ( GlobalContext const &  gc)
private

Definition at line 570 of file Timing.cc.

570  {
572  return;
573  }
574  if (!gc.processContext()->isSubProcess()) {
576  }
577  }

References begin_run_count_, configuredInTopLevelProcess_, edm::ProcessContext::isSubProcess(), and edm::GlobalContext::processContext().

◆ postLockEventSetupGet()

void edm::service::Timing::postLockEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

◆ postModule()

void edm::service::Timing::postModule ( ModuleDescription const &  md)
private

Definition at line 562 of file Timing.cc.

562 { postCommon(); }

References postCommon().

◆ postModuleEvent()

void edm::service::Timing::postModuleEvent ( StreamContext const &  iStream,
ModuleCallingContext const &  iModule 
)
private

Definition at line 531 of file Timing.cc.

531  {
533  return;
534  }
535  auto const& eventID = iStream.eventID();
536  auto const& desc = *(iModule.moduleDescription());
537  double t = postCommon();
538  if (not summary_only_) {
539  LogPrint("TimeModule") << "TimeModule> " << eventID.event() << " " << eventID.run() << " " << desc.moduleLabel()
540  << " " << desc.moduleName() << " " << t;
541  }
542  }

References configuredInTopLevelProcess_, edm::StreamContext::eventID(), edm::ModuleCallingContext::moduleDescription(), postCommon(), summary_only_, and OrderedSet::t.

◆ postModuleGlobal()

void edm::service::Timing::postModuleGlobal ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)
private

Definition at line 568 of file Timing.cc.

568 { postCommon(); }

References postCommon().

◆ postModuleStream()

void edm::service::Timing::postModuleStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)
private

Definition at line 592 of file Timing.cc.

592 { postCommon(); }

References postCommon().

◆ postOpenFile()

void edm::service::Timing::postOpenFile ( std::string const &  lfn,
bool  b 
)
private

Definition at line 558 of file Timing.cc.

558 { postCommon(); }

References postCommon().

◆ postSourceEvent()

void edm::service::Timing::postSourceEvent ( StreamID  sid)
private

Definition at line 546 of file Timing.cc.

546 { postCommon(); }

References postCommon().

◆ postSourceLumi()

void edm::service::Timing::postSourceLumi ( LuminosityBlockIndex  index)
private

Definition at line 550 of file Timing.cc.

550 { postCommon(); }

References postCommon().

◆ postSourceRun()

void edm::service::Timing::postSourceRun ( RunIndex  index)
private

Definition at line 554 of file Timing.cc.

554 { postCommon(); }

References postCommon().

◆ preBeginJob()

void edm::service::Timing::preBeginJob ( PathsAndConsumesOfModulesBase const &  pathsAndConsumes,
ProcessContext const &  pc 
)
private

Definition at line 357 of file Timing.cc.

357  {
358  if (pc.isSubProcess()) {
359  ++nSubProcesses_;
360  } else {
362  }
363  }

References configuredInTopLevelProcess_, edm::ProcessContext::isSubProcess(), and nSubProcesses_.

◆ preEvent()

void edm::service::Timing::preEvent ( StreamContext const &  iStream)
private

Definition at line 484 of file Timing.cc.

484  {
486  return;
487  }
488  auto index = iStream.streamID().value();
489  if (nSubProcesses_ == 0u) {
491  } else {
492  unsigned int count = ++(*countSubProcessesPreEvent_[index]);
493  if (count == 1) {
495  } else if (count == (nSubProcesses_ + 1)) {
497  }
498  }
499  }

References configuredInTopLevelProcess_, KineDebug3::count(), countSubProcessesPreEvent_, curr_events_time_, edm::service::getTime(), nSubProcesses_, edm::StreamContext::streamID(), and edm::StreamID::value().

◆ preLockEventSetupGet()

void edm::service::Timing::preLockEventSetupGet ( eventsetup::ComponentDescription const *  ,
eventsetup::EventSetupRecordKey const &  ,
eventsetup::DataKey const &   
)
private

◆ preModule()

void edm::service::Timing::preModule ( ModuleDescription const &  md)
private

◆ preModuleGlobal()

void edm::service::Timing::preModuleGlobal ( GlobalContext const &  ,
ModuleCallingContext const &   
)
private

Definition at line 564 of file Timing.cc.

564  {
566  }

References configuredInTopLevelProcess_, and edm::service::pushStack().

◆ preModuleStream()

void edm::service::Timing::preModuleStream ( StreamContext const &  ,
ModuleCallingContext const &   
)
private

Definition at line 588 of file Timing.cc.

588  {
590  }

References configuredInTopLevelProcess_, and edm::service::pushStack().

◆ preOpenFile()

void edm::service::Timing::preOpenFile ( std::string const &  lfn,
bool  b 
)
private

◆ preSourceEvent()

void edm::service::Timing::preSourceEvent ( StreamID  sid)
private

◆ preSourceLumi()

void edm::service::Timing::preSourceLumi ( LuminosityBlockIndex  index)
private

◆ preSourceRun()

void edm::service::Timing::preSourceRun ( RunIndex  index)
private

Member Data Documentation

◆ accumulatedTimeForGet_

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

Definition at line 143 of file Timing.cc.

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

◆ accumulatedTimeForLock_

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

Definition at line 140 of file Timing.cc.

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

◆ begin_lumi_count_

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

Definition at line 132 of file Timing.cc.

Referenced by postEndJob(), and postGlobalBeginLumi().

◆ begin_run_count_

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

Definition at line 133 of file Timing.cc.

Referenced by postEndJob(), and postGlobalBeginRun().

◆ configuredInTopLevelProcess_

bool edm::service::Timing::configuredInTopLevelProcess_
private

◆ countAndTimeForGet_

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

Definition at line 142 of file Timing.cc.

Referenced by postEventSetupGet(), and postLockEventSetupGet().

◆ countAndTimeForLock_

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

Definition at line 139 of file Timing.cc.

Referenced by postLockEventSetupGet(), and preLockEventSetupGet().

◆ countAndTimeZero_

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

Definition at line 137 of file Timing.cc.

Referenced by accumulateTimeBegin(), and accumulateTimeEnd().

◆ countSubProcessesPostEvent_

std::vector<std::unique_ptr<std::atomic<unsigned int> > > edm::service::Timing::countSubProcessesPostEvent_
private

Definition at line 146 of file Timing.cc.

Referenced by postEvent().

◆ countSubProcessesPreEvent_

std::vector<std::unique_ptr<std::atomic<unsigned int> > > edm::service::Timing::countSubProcessesPreEvent_
private

Definition at line 145 of file Timing.cc.

Referenced by preEvent().

◆ curr_events_time_

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

Definition at line 121 of file Timing.cc.

Referenced by postEvent(), and preEvent().

◆ curr_job_cpu_

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

Definition at line 116 of file Timing.cc.

Referenced by postBeginJob(), and postEndJob().

◆ curr_job_time_

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

Definition at line 115 of file Timing.cc.

Referenced by postBeginJob(), and postEndJob().

◆ extra_job_cpu_

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

Definition at line 117 of file Timing.cc.

Referenced by addToCPUTime(), and postEndJob().

◆ last_run_cpu_

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

Definition at line 120 of file Timing.cc.

Referenced by postEndJob().

◆ last_run_time_

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

Definition at line 119 of file Timing.cc.

Referenced by postEndJob().

◆ max_events_time_

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

Definition at line 128 of file Timing.cc.

Referenced by lastPostEvent(), and postEndJob().

◆ min_events_time_

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

Definition at line 129 of file Timing.cc.

Referenced by lastPostEvent(), and postEndJob().

◆ nStreams_

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

Definition at line 134 of file Timing.cc.

Referenced by postEndJob().

◆ nSubProcesses_

unsigned int edm::service::Timing::nSubProcesses_
private

Definition at line 149 of file Timing.cc.

Referenced by postEvent(), preBeginJob(), and preEvent().

◆ nThreads_

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

Definition at line 135 of file Timing.cc.

Referenced by postEndJob().

◆ report_summary_

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

Definition at line 123 of file Timing.cc.

Referenced by postEndJob().

◆ sum_events_time_

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

Definition at line 130 of file Timing.cc.

Referenced by lastPostEvent(), and postEndJob().

◆ summary_only_

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

Definition at line 122 of file Timing.cc.

Referenced by lastPostEvent(), postBeginJob(), and postModuleEvent().

◆ threshold_

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

Definition at line 124 of file Timing.cc.

Referenced by postCommon().

◆ total_event_count_

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

Definition at line 131 of file Timing.cc.

Referenced by lastPostEvent(), and postEndJob().

edm::service::Timing::countAndTimeForGet_
std::atomic< CountAndTime * > countAndTimeForGet_
Definition: Timing.cc:142
mps_fire.i
i
Definition: mps_fire.py:355
edm::service::Timing::postEvent
void postEvent(StreamContext const &)
Definition: Timing.cc:501
edm::service::Timing::curr_job_cpu_
double curr_job_cpu_
Definition: Timing.cc:116
edm::service::Timing::accumulatedTimeForLock_
double accumulatedTimeForLock_
Definition: Timing.cc:140
edm::service::Timing::begin_lumi_count_
std::atomic< unsigned long > begin_lumi_count_
Definition: Timing.cc:132
edm::service::Timing::preSourceEvent
void preSourceEvent(StreamID)
Definition: Timing.cc:544
edm::service::Timing::preLockEventSetupGet
void preLockEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:608
edm::service::Timing::preOpenFile
void preOpenFile(std::string const &, bool)
Definition: Timing.cc:556
edm::service::Timing::countSubProcessesPreEvent_
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPreEvent_
Definition: Timing.cc:145
edm::service::getTime
static double getTime()
Definition: Timing.cc:169
edm::service::Timing::postEventSetupGet
void postEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:627
edm::TimingServiceBase::jobStartTime
static double jobStartTime()
Definition: TimingServiceBase.h:45
edm::service::Timing::begin_run_count_
std::atomic< unsigned long > begin_run_count_
Definition: Timing.cc:133
edm::service::Timing::postGlobalBeginRun
void postGlobalBeginRun(GlobalContext const &)
Definition: Timing.cc:570
edm::service::Timing::accumulatedTimeForGet_
double accumulatedTimeForGet_
Definition: Timing.cc:143
edm::service::getCPU
static double getCPU()
Definition: Timing.cc:176
edm::service::Timing::summary_only_
bool summary_only_
Definition: Timing.cc:122
edm::service::Timing::curr_events_time_
std::vector< double > curr_events_time_
Definition: Timing.cc:121
edm::service::Timing::postLockEventSetupGet
void postLockEventSetupGet(eventsetup::ComponentDescription const *, eventsetup::EventSetupRecordKey const &, eventsetup::DataKey const &)
Definition: Timing.cc:617
edm::service::Timing::accumulateTimeEnd
void accumulateTimeEnd(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:656
edm::service::Timing::postModuleEvent
void postModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:531
edm::service::Timing::postSourceEvent
void postSourceEvent(StreamID)
Definition: Timing.cc:546
edm::service::ui2str
static std::string ui2str(unsigned int i)
Definition: Timing.cc:163
edm::service::popStack
static double popStack()
Definition: Timing.cc:202
edm::service::Timing::postSourceRun
void postSourceRun(RunIndex)
Definition: Timing.cc:554
edm::service::Timing::preBeginJob
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &)
Definition: Timing.cc:357
edm::service::Timing::postEndJob
void postEndJob()
Definition: Timing.cc:383
edm::service::d2str
static std::string d2str(double d)
Definition: SimpleMemoryCheck.cc:277
edm::service::Timing::countAndTimeZero_
CountAndTime countAndTimeZero_
Definition: Timing.cc:137
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::service::Timing::postOpenFile
void postOpenFile(std::string const &, bool)
Definition: Timing.cc:558
edm::service::Timing::extra_job_cpu_
std::atomic< double > extra_job_cpu_
Definition: Timing.cc:117
edm::service::Timing::countSubProcessesPostEvent_
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPostEvent_
Definition: Timing.cc:146
edm::service::Timing::lastPostEvent
void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const &iStream)
Definition: Timing.cc:517
Service
edm::service::Timing::preSourceLumi
void preSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:548
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::service::Timing::preEvent
void preEvent(StreamContext const &)
Definition: Timing.cc:484
edm::service::Timing::postGlobalBeginLumi
void postGlobalBeginLumi(GlobalContext const &)
Definition: Timing.cc:579
edm::service::Timing::nThreads_
unsigned int nThreads_
Definition: Timing.cc:135
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::service::Timing::max_events_time_
std::vector< double > max_events_time_
Definition: Timing.cc:128
edm::service::pushStack
static void pushStack(bool configuredInTopLevelProcess)
Definition: Timing.cc:211
edm::GlobalContext
Definition: GlobalContext.h:29
edm::service::Timing::total_event_count_
std::atomic< unsigned long > total_event_count_
Definition: Timing.cc:131
edm::service::Timing::min_events_time_
std::vector< double > min_events_time_
Definition: Timing.cc:129
edm::service::Timing::nSubProcesses_
unsigned int nSubProcesses_
Definition: Timing.cc:149
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
edm::service::Timing::configuredInTopLevelProcess_
bool configuredInTopLevelProcess_
Definition: Timing.cc:148
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
edm::service::Timing::sum_events_time_
std::vector< double > sum_events_time_
Definition: Timing.cc:130
edm::service::Timing::postModuleGlobal
void postModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:568
edm::service::Timing::preModule
void preModule(ModuleDescription const &md)
Definition: Timing.cc:560
edm::service::Timing::postCommon
double postCommon() const
Definition: Timing.cc:594
edm::service::Timing::postSourceLumi
void postSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:550
edm::service::Timing::preModuleStream
void preModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:588
edm::service::Timing::nStreams_
unsigned int nStreams_
Definition: Timing.cc:134
edm::service::Timing::postModule
void postModule(ModuleDescription const &md)
Definition: Timing.cc:562
edm::service::Timing::accumulateTimeBegin
void accumulateTimeBegin(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:633
edm::service::Timing::preModuleGlobal
void preModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:564
edm::service::Timing::threshold_
double threshold_
Definition: Timing.cc:124
ParameterSetDescription
edm::service::Timing::last_run_cpu_
std::atomic< double > last_run_cpu_
Definition: Timing.cc:120
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::service::Timing::postBeginJob
void postBeginJob()
Definition: Timing.cc:365
edm::service::Timing::postModuleStream
void postModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:592
edm::service::Timing::curr_job_time_
double curr_job_time_
Definition: Timing.cc:115
edm::service::Timing::report_summary_
bool report_summary_
Definition: Timing.cc:123
edm::service::Timing::preSourceRun
void preSourceRun(RunIndex)
Definition: Timing.cc:552
edm::service::Timing::countAndTimeForLock_
std::atomic< CountAndTime * > countAndTimeForLock_
Definition: Timing.cc:139
edm::service::Timing::last_run_time_
std::atomic< double > last_run_time_
Definition: Timing.cc:119