CMS 3D CMS Logo

Timing.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Services
4 // Class : Timing
5 //
6 // Implementation:
7 //
8 // Original Author: Jim Kowalkowski
9 //
10 
12 
29 
30 #include <iostream>
31 #include <sstream>
32 #include <sys/resource.h>
33 #include <sys/time.h>
34 #include <atomic>
35 #include <exception>
36 
37 namespace edm {
38 
39  namespace eventsetup {
40  struct ComponentDescription;
41  class DataKey;
42  class EventSetupRecordKey;
43  } // namespace eventsetup
44 
45  namespace service {
46  class Timing : public TimingServiceBase {
47  public:
49  ~Timing() override;
50 
51  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
52 
53  void addToCPUTime(double iTime) override;
54  double getTotalCPU() const override;
55 
56  private:
58  void postBeginJob();
59  void postEndJob();
60 
61  void preEvent(StreamContext const&);
62  void postEvent(StreamContext const&);
63  void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream);
64 
66 
69 
72 
73  void preSourceRun(RunIndex);
74  void postSourceRun(RunIndex);
75 
76  void preOpenFile(std::string const&, bool);
77  void postOpenFile(std::string const&, bool);
78 
79  void preModule(ModuleDescription const& md);
80  void postModule(ModuleDescription const& md);
81 
84 
85  void postGlobalBeginRun(GlobalContext const&);
87 
90 
91  double postCommon() const;
92 
93  struct CountAndTime {
94  public:
95  CountAndTime(unsigned int count, double time) : count_(count), time_(time) {}
96  unsigned int count_;
97  double time_;
98  };
99 
100  void accumulateTimeBegin(std::atomic<CountAndTime*>& countAndTime, double& accumulatedTime);
101  void accumulateTimeEnd(std::atomic<CountAndTime*>& countAndTime, double& accumulatedTime);
102 
103  double curr_job_time_; // seconds
104  double curr_job_cpu_; // seconds
105  std::atomic<double> extra_job_cpu_; //seconds
106  //use last run time for determining end of processing
107  std::atomic<double> last_run_time_;
108  std::atomic<double> last_run_cpu_;
109  std::vector<double> curr_events_time_; // seconds
112  double threshold_;
113  //
114  // Min Max and total event times for each Stream.
115  // Used for summary at end of job
116  std::vector<double> max_events_time_; // seconds
117  std::vector<double> min_events_time_; // seconds
118  std::vector<double> sum_events_time_;
119  std::atomic<unsigned long> total_event_count_;
120  std::atomic<unsigned long> begin_lumi_count_;
121  std::atomic<unsigned long> begin_run_count_;
122  unsigned int nStreams_;
123  unsigned int nThreads_;
124 
126 
127  std::atomic<CountAndTime*> countAndTimeForLock_;
129 
130  std::atomic<CountAndTime*> countAndTimeForGet_;
132 
133  std::vector<std::unique_ptr<std::atomic<unsigned int>>> countSubProcessesPreEvent_;
134  std::vector<std::unique_ptr<std::atomic<unsigned int>>> countSubProcessesPostEvent_;
135 
137  unsigned int nSubProcesses_;
138  };
139  } // namespace service
140 } // namespace edm
141 
142 namespace edm {
143  namespace service {
144 
145  static std::string d2str(double d) {
146  std::stringstream t;
147  t << d;
148  return t.str();
149  }
150 
151  static std::string ui2str(unsigned int i) {
152  std::stringstream t;
153  t << i;
154  return t.str();
155  }
156 
157  static double getTime() {
158  struct timeval t;
159  if (gettimeofday(&t, nullptr) < 0)
160  throw cms::Exception("SysCallFailed", "Failed call to gettimeofday");
161  return static_cast<double>(t.tv_sec) + (static_cast<double>(t.tv_usec) * 1E-6);
162  }
163 
164  static double getCPU() {
165  struct rusage usage;
166  getrusage(RUSAGE_SELF, &usage);
167 
168  double totalCPUTime = 0.0;
169  // User code
170  totalCPUTime = (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6);
171  // System functions
172  totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6);
173 
174  // Additionally, add in CPU usage from our child processes.
175  getrusage(RUSAGE_CHILDREN, &usage);
176  totalCPUTime += (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6);
177  totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6);
178 
179  return totalCPUTime;
180  }
181 
182  //NOTE: We use a per thread stack for module times since unscheduled
183  // exectuion or tbb task spawning can cause a module to run on the
184  // same thread as an already running module
185  static std::vector<double>& moduleTimeStack() {
186  static thread_local std::vector<double> s_stack;
187  return s_stack;
188  }
189 
190  static double popStack() {
191  auto& modStack = moduleTimeStack();
192  assert(!modStack.empty());
193  double curr_module_time = modStack.back();
194  modStack.pop_back();
195  double t = getTime() - curr_module_time;
196  return t;
197  }
198 
199  static void pushStack(bool configuredInTopLevelProcess) {
200  if (!configuredInTopLevelProcess) {
201  return;
202  }
203  auto& modStack = moduleTimeStack();
204  modStack.push_back(getTime());
205  }
206 
208  : curr_job_time_(0.),
209  curr_job_cpu_(0.),
210  extra_job_cpu_(0.0),
211  last_run_time_(0.0),
212  last_run_cpu_(0.0),
213  curr_events_time_(),
214  summary_only_(iPS.getUntrackedParameter<bool>("summaryOnly")),
215  report_summary_(iPS.getUntrackedParameter<bool>("useJobReport")),
216  threshold_(iPS.getUntrackedParameter<double>("excessiveTimeThreshold")),
217  max_events_time_(),
218  min_events_time_(),
219  total_event_count_(0),
220  begin_lumi_count_(0),
221  begin_run_count_(0),
222  countAndTimeZero_{0, 0.0},
223  countAndTimeForLock_{&countAndTimeZero_},
224  accumulatedTimeForLock_{0.0},
225  countAndTimeForGet_{&countAndTimeZero_},
226  accumulatedTimeForGet_{0.0},
227  configuredInTopLevelProcess_{false},
228  nSubProcesses_{0} {
229  iRegistry.watchPreBeginJob(this, &Timing::preBeginJob);
230  iRegistry.watchPostBeginJob(this, &Timing::postBeginJob);
231  iRegistry.watchPostEndJob(this, &Timing::postEndJob);
232 
233  iRegistry.watchPreEvent(this, &Timing::preEvent);
234  iRegistry.watchPostEvent(this, &Timing::postEvent);
235 
236  bool checkThreshold = true;
237  if (threshold_ <= 0.0) {
238  //we need to ignore the threshold check
239  threshold_ = std::numeric_limits<double>::max();
240  checkThreshold = false;
241  }
242 
243  if ((not summary_only_) || (checkThreshold)) {
244  iRegistry.watchPreModuleEvent(this, &Timing::preModuleStream);
245  iRegistry.watchPostModuleEvent(this, &Timing::postModuleEvent);
246  }
247  if (checkThreshold) {
248  iRegistry.watchPreSourceEvent(this, &Timing::preSourceEvent);
249  iRegistry.watchPostSourceEvent(this, &Timing::postSourceEvent);
250 
251  iRegistry.watchPreSourceLumi(this, &Timing::preSourceLumi);
252  iRegistry.watchPostSourceLumi(this, &Timing::postSourceLumi);
253 
254  iRegistry.watchPreSourceRun(this, &Timing::preSourceRun);
255  iRegistry.watchPostSourceRun(this, &Timing::postSourceRun);
256 
257  iRegistry.watchPreOpenFile(this, &Timing::preOpenFile);
258  iRegistry.watchPostOpenFile(this, &Timing::postOpenFile);
259 
260  iRegistry.watchPreEventReadFromSource(this, &Timing::preModuleStream);
261  iRegistry.watchPostEventReadFromSource(this, &Timing::postModuleStream);
262 
263  iRegistry.watchPreModuleConstruction(this, &Timing::preModule);
264  iRegistry.watchPostModuleConstruction(this, &Timing::postModule);
265 
266  iRegistry.watchPreModuleBeginJob(this, &Timing::preModule);
267  iRegistry.watchPostModuleBeginJob(this, &Timing::postModule);
268 
269  iRegistry.watchPreModuleEndJob(this, &Timing::preModule);
270  iRegistry.watchPostModuleEndJob(this, &Timing::postModule);
271 
272  iRegistry.watchPreModuleStreamBeginRun(this, &Timing::preModuleStream);
273  iRegistry.watchPostModuleStreamBeginRun(this, &Timing::postModuleStream);
274  iRegistry.watchPreModuleStreamEndRun(this, &Timing::preModuleStream);
275  iRegistry.watchPostModuleStreamEndRun(this, &Timing::postModuleStream);
276 
277  iRegistry.watchPreModuleStreamBeginLumi(this, &Timing::preModuleStream);
278  iRegistry.watchPostModuleStreamBeginLumi(this, &Timing::postModuleStream);
279  iRegistry.watchPreModuleStreamEndLumi(this, &Timing::preModuleStream);
280  iRegistry.watchPostModuleStreamEndLumi(this, &Timing::postModuleStream);
281 
282  iRegistry.watchPreModuleGlobalBeginRun(this, &Timing::preModuleGlobal);
283  iRegistry.watchPostModuleGlobalBeginRun(this, &Timing::postModuleGlobal);
284  iRegistry.watchPreModuleGlobalEndRun(this, &Timing::preModuleGlobal);
285  iRegistry.watchPostModuleGlobalEndRun(this, &Timing::postModuleGlobal);
286 
287  iRegistry.watchPreModuleGlobalBeginLumi(this, &Timing::preModuleGlobal);
288  iRegistry.watchPostModuleGlobalBeginLumi(this, &Timing::postModuleGlobal);
289  iRegistry.watchPreModuleGlobalEndLumi(this, &Timing::preModuleGlobal);
290  iRegistry.watchPostModuleGlobalEndLumi(this, &Timing::postModuleGlobal);
291 
292  iRegistry.watchPreSourceConstruction(this, &Timing::preModule);
293  iRegistry.watchPostSourceConstruction(this, &Timing::postModule);
294  }
295 
296  iRegistry.watchPostGlobalBeginRun(this, &Timing::postGlobalBeginRun);
297  iRegistry.watchPostGlobalBeginLumi(this, &Timing::postGlobalBeginLumi);
298 
299  iRegistry.preallocateSignal_.connect([this](service::SystemBounds const& iBounds) {
300  nStreams_ = iBounds.maxNumberOfStreams();
301  nThreads_ = iBounds.maxNumberOfThreads();
302  curr_events_time_.resize(nStreams_, 0.);
303  sum_events_time_.resize(nStreams_, 0.);
304  max_events_time_.resize(nStreams_, 0.);
305  min_events_time_.resize(nStreams_, 1.E6);
306  for (unsigned int i = 0; i < nStreams_; ++i) {
307  countSubProcessesPreEvent_.emplace_back(std::make_unique<std::atomic<unsigned int>>(0));
308  countSubProcessesPostEvent_.emplace_back(std::make_unique<std::atomic<unsigned int>>(0));
309  }
310  });
311 
312  iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) {
313  last_run_time_ = getTime();
314  last_run_cpu_ = getCPU();
315  });
316  }
317 
319 
320  void Timing::addToCPUTime(double iTime) {
321  //For accounting purposes we effectively can say we started earlier
322  double expected = extra_job_cpu_.load();
323  while (not extra_job_cpu_.compare_exchange_strong(expected, expected + iTime)) {
324  }
325  }
326 
327  double Timing::getTotalCPU() const { return getCPU(); }
328 
331  desc.addUntracked<bool>("summaryOnly", false)->setComment("If 'true' do not report timing for each event");
332  desc.addUntracked<bool>("useJobReport", true)->setComment("If 'true' write summary information to JobReport");
333  desc.addUntracked<double>("excessiveTimeThreshold", 0.)
334  ->setComment(
335  "Amount of time in seconds before reporting a module or source has taken excessive time. A value of 0.0 "
336  "turns off this reporting.");
337  descriptions.add("Timing", desc);
338  descriptions.setComment("This service reports the time it takes to run each module in a job.");
339  }
340 
341  void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) {
342  if (pc.isSubProcess()) {
343  ++nSubProcesses_;
344  } else {
346  }
347  }
348 
351  return;
352  }
354  curr_job_cpu_ = getCPU();
355 
356  if (not summary_only_) {
357  LogImportant("TimeReport") << "TimeReport> Report activated"
358  << "\n"
359  << "TimeReport> Report columns headings for events: "
360  << "eventnum runnum timetaken\n"
361  << "TimeReport> Report columns headings for modules: "
362  << "eventnum runnum modulelabel modulename timetakeni\n"
363  << "TimeReport> JobTime=" << curr_job_time_ << " JobCPU=" << curr_job_cpu_ << "\n";
364  }
365  }
366 
369  LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it "
370  "is configured in a SubProcess.\n"
371  << "If multiple instances of the TimingService were configured only the one in the "
372  "top level process will function.\n"
373  << "The other instance(s) will simply print this message and do nothing.\n\n";
374  return;
375  }
376 
377  const double job_end_time = getTime();
378  const double job_end_cpu = getCPU();
379  double total_job_time = job_end_time - jobStartTime();
380 
381  double total_job_cpu = job_end_cpu + extra_job_cpu_;
382 
383  const double total_initialization_time = curr_job_time_ - jobStartTime();
384  const double total_initialization_cpu = curr_job_cpu_;
385 
386  if (0.0 == jobStartTime()) {
387  //did not capture beginning time
388  total_job_time = job_end_time - curr_job_time_;
389  total_job_cpu = job_end_cpu + extra_job_cpu_ - curr_job_cpu_;
390  }
391 
392  double min_event_time = *(std::min_element(min_events_time_.begin(), min_events_time_.end()));
393  double max_event_time = *(std::max_element(max_events_time_.begin(), max_events_time_.end()));
394 
395  auto total_loop_time = last_run_time_ - curr_job_time_;
396  auto total_loop_cpu = last_run_cpu_ + extra_job_cpu_ - curr_job_cpu_;
397 
398  if (last_run_time_ == 0.0) {
399  total_loop_time = 0.0;
400  total_loop_cpu = 0.0;
401  }
402 
403  double sum_all_events_time = 0;
404  for (auto t : sum_events_time_) {
405  sum_all_events_time += t;
406  }
407 
408  double average_event_time = 0.0;
409  if (total_event_count_ != 0) {
410  average_event_time = sum_all_events_time / total_event_count_;
411  }
412 
413  double event_throughput = 0.0;
414  if (total_loop_time != 0.0) {
415  event_throughput = total_event_count_ / total_loop_time;
416  }
417 
418  LogImportant("TimeReport") << "TimeReport> Time report complete in " << total_job_time << " seconds"
419  << "\n"
420  << " Time Summary: \n"
421  << " - Min event: " << min_event_time << "\n"
422  << " - Max event: " << max_event_time << "\n"
423  << " - Avg event: " << average_event_time << "\n"
424  << " - Total loop: " << total_loop_time << "\n"
425  << " - Total init: " << total_initialization_time << "\n"
426  << " - Total job: " << total_job_time << "\n"
427  << " - EventSetup Lock: " << accumulatedTimeForLock_ << "\n"
428  << " - EventSetup Get: " << accumulatedTimeForGet_ << "\n"
429  << " Event Throughput: " << event_throughput << " ev/s\n"
430  << " CPU Summary: \n"
431  << " - Total loop: " << total_loop_cpu << "\n"
432  << " - Total init: " << total_initialization_cpu << "\n"
433  << " - Total extra: " << extra_job_cpu_ << "\n"
434  << " - Total job: " << total_job_cpu << "\n"
435  << " Processing Summary: \n"
436  << " - Number of Events: " << total_event_count_ << "\n"
437  << " - Number of Global Begin Lumi Calls: " << begin_lumi_count_ << "\n"
438  << " - Number of Global Begin Run Calls: " << begin_run_count_ << "\n";
439 
440  if (report_summary_) {
441  Service<JobReport> reportSvc;
442  std::map<std::string, std::string> reportData;
443 
444  reportData.insert(std::make_pair("MinEventTime", d2str(min_event_time)));
445  reportData.insert(std::make_pair("MaxEventTime", d2str(max_event_time)));
446  reportData.insert(std::make_pair("AvgEventTime", d2str(average_event_time)));
447  reportData.insert(std::make_pair("EventThroughput", d2str(event_throughput)));
448  reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time)));
449  reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu)));
450  reportData.insert(std::make_pair("TotalLoopTime", d2str(total_loop_time)));
451  reportData.insert(std::make_pair("TotalLoopCPU", d2str(total_loop_cpu)));
452  reportData.insert(std::make_pair("TotalInitTime", d2str(total_initialization_time)));
453  reportData.insert(std::make_pair("TotalInitCPU", d2str(total_initialization_cpu)));
454  reportData.insert(std::make_pair("NumberOfStreams", ui2str(nStreams_)));
455  reportData.insert(std::make_pair("NumberOfThreads", ui2str(nThreads_)));
456  reportData.insert(std::make_pair("EventSetup Lock", d2str(accumulatedTimeForLock_)));
457  reportData.insert(std::make_pair("EventSetup Get", d2str(accumulatedTimeForGet_)));
458  reportSvc->reportPerformanceSummary("Timing", reportData);
459 
460  std::map<std::string, std::string> reportData1;
461  reportData1.insert(std::make_pair("NumberEvents", ui2str(total_event_count_)));
462  reportData1.insert(std::make_pair("NumberBeginLumiCalls", ui2str(begin_lumi_count_)));
463  reportData1.insert(std::make_pair("NumberBeginRunCalls", ui2str(begin_run_count_)));
464  reportSvc->reportPerformanceSummary("ProcessingSummary", reportData1);
465  }
466  }
467 
468  void Timing::preEvent(StreamContext const& iStream) {
470  return;
471  }
472  auto index = iStream.streamID().value();
473  if (nSubProcesses_ == 0u) {
475  } else {
476  unsigned int count = ++(*countSubProcessesPreEvent_[index]);
477  if (count == 1) {
479  } else if (count == (nSubProcesses_ + 1)) {
481  }
482  }
483  }
484 
485  void Timing::postEvent(StreamContext const& iStream) {
487  return;
488  }
489  auto index = iStream.streamID().value();
490  if (nSubProcesses_ == 0u) {
492  } else {
493  unsigned int count = ++(*countSubProcessesPostEvent_[index]);
494  if (count == (nSubProcesses_ + 1)) {
497  }
498  }
499  }
500 
501  void Timing::lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream) {
502  sum_events_time_[index] += curr_event_time;
503 
504  if (not summary_only_) {
505  auto const& eventID = iStream.eventID();
506  LogPrint("TimeEvent") << "TimeEvent> " << eventID.event() << " " << eventID.run() << " " << curr_event_time;
507  }
508  if (curr_event_time > max_events_time_[index])
509  max_events_time_[index] = curr_event_time;
510  if (curr_event_time < min_events_time_[index])
511  min_events_time_[index] = curr_event_time;
513  }
514 
515  void Timing::postModuleEvent(StreamContext const& iStream, ModuleCallingContext const& iModule) {
517  return;
518  }
519  auto const& eventID = iStream.eventID();
520  auto const& desc = *(iModule.moduleDescription());
521  double t = postCommon();
522  if (not summary_only_) {
523  LogPrint("TimeModule") << "TimeModule> " << eventID.event() << " " << eventID.run() << " " << desc.moduleLabel()
524  << " " << desc.moduleName() << " " << t;
525  }
526  }
527 
529 
531 
533 
535 
537 
539 
541 
542  void Timing::postOpenFile(std::string const& lfn, bool b) { postCommon(); }
543 
545 
547 
550  }
551 
553 
556  return;
557  }
558  if (!gc.processContext()->isSubProcess()) {
560  }
561  }
562 
565  return;
566  }
567  if (!gc.processContext()->isSubProcess()) {
569  }
570  }
571 
574  }
575 
577 
578  double Timing::postCommon() const {
580  return 0.0;
581  }
582  double t = popStack();
583  if (t > threshold_) {
584  LogError("ExcessiveTime")
585  << "ExcessiveTime: Module used " << t
586  << " seconds of time which exceeds the error threshold configured in the Timing Service of " << threshold_
587  << " seconds.";
588  }
589  return t;
590  }
591 
592  void Timing::accumulateTimeBegin(std::atomic<CountAndTime*>& countAndTime, double& accumulatedTime) {
593  double newTime = getTime();
594  auto newStat = std::make_unique<CountAndTime>(0, newTime);
595 
596  CountAndTime* oldStat = countAndTime.load();
597  while (true) {
598  if (oldStat == nullptr) {
599  oldStat = countAndTime.load();
600  } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) {
601  break;
602  }
603  }
604 
605  newStat->count_ = oldStat->count_ + 1;
606  if (oldStat->count_ != 0) {
607  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
608  }
609  countAndTime.store(newStat.release());
610  if (oldStat != &countAndTimeZero_) {
611  delete oldStat;
612  }
613  }
614 
615  void Timing::accumulateTimeEnd(std::atomic<CountAndTime*>& countAndTime, double& accumulatedTime) {
616  double newTime = getTime();
617 
618  CountAndTime* oldStat = countAndTime.load();
619  while (true) {
620  if (oldStat == nullptr) {
621  oldStat = countAndTime.load();
622  } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) {
623  break;
624  }
625  }
626 
627  if (oldStat->count_ == 1) {
628  accumulatedTime += newTime - oldStat->time_;
629  countAndTime.store(&countAndTimeZero_);
630  } else {
631  try {
632  auto newStat = std::make_unique<CountAndTime>(oldStat->count_ - 1, newTime);
633  accumulatedTime += (newTime - oldStat->time_) * oldStat->count_;
634  countAndTime.store(newStat.release());
635  } catch (std::exception&) {
636  countAndTime.store(oldStat);
637  throw;
638  }
639  }
640  delete oldStat;
641  }
642  } // namespace service
643 } // namespace edm
644 
646 
ConfigurationDescriptions.h
edm::service::Timing
Definition: Timing.cc:46
edm::service::Timing::countAndTimeForGet_
std::atomic< CountAndTime * > countAndTimeForGet_
Definition: Timing.cc:130
edm::StreamID
Definition: StreamID.h:30
edm::service::Timing::getTotalCPU
double getTotalCPU() const override
Definition: Timing.cc:327
service
Definition: service.py:1
ModuleCallingContext.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
edm::service::Timing::postEvent
void postEvent(StreamContext const &)
Definition: Timing.cc:485
edm::service::Timing::curr_job_cpu_
double curr_job_cpu_
Definition: Timing.cc:104
edm::service::Timing::accumulatedTimeForLock_
double accumulatedTimeForLock_
Definition: Timing.cc:128
edm::service::Timing::begin_lumi_count_
std::atomic< unsigned long > begin_lumi_count_
Definition: Timing.cc:120
edm::ProcessContext::isSubProcess
bool isSubProcess() const
Definition: ProcessContext.h:34
edm::service::Timing::preSourceEvent
void preSourceEvent(StreamID)
Definition: Timing.cc:528
edm::service::Timing::preOpenFile
void preOpenFile(std::string const &, bool)
Definition: Timing.cc:540
DataKey
edm::service::Timing::countSubProcessesPreEvent_
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPreEvent_
Definition: Timing.cc:133
edm::service::Timing::~Timing
~Timing() override
Definition: Timing.cc:318
edm::service::getTime
static double getTime()
Definition: Timing.cc:157
edm::service::Timing::CountAndTime::time_
double time_
Definition: Timing.cc:97
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::GlobalContext::processContext
ProcessContext const * processContext() const
Definition: GlobalContext.h:64
edm::ProcessContext
Definition: ProcessContext.h:27
edm::TimingServiceBase::jobStartTime
static double jobStartTime()
Definition: TimingServiceBase.h:47
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::service::Timing::begin_run_count_
std::atomic< unsigned long > begin_run_count_
Definition: Timing.cc:121
edm::service::Timing::postGlobalBeginRun
void postGlobalBeginRun(GlobalContext const &)
Definition: Timing.cc:554
cms::cuda::assert
assert(be >=bs)
EventSetupRecordKey
edm::StreamID::value
unsigned int value() const
Definition: StreamID.h:43
LaserClient_cfi.Timing
Timing
Definition: LaserClient_cfi.py:37
edm::ModuleCallingContext::moduleDescription
ModuleDescription const * moduleDescription() const
Definition: ModuleCallingContext.h:50
edm::service::Timing::accumulatedTimeForGet_
double accumulatedTimeForGet_
Definition: Timing.cc:131
edm::service::getCPU
static double getCPU()
Definition: Timing.cc:164
edm::service::Timing::summary_only_
bool summary_only_
Definition: Timing.cc:110
edm::service::Timing::curr_events_time_
std::vector< double > curr_events_time_
Definition: Timing.cc:109
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::service::Timing::accumulateTimeEnd
void accumulateTimeEnd(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:615
edm::service::Timing::postModuleEvent
void postModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:515
edm::LogImportant
Log< level::Error, true > LogImportant
Definition: MessageLogger.h:133
edm::service::Timing::postSourceEvent
void postSourceEvent(StreamID)
Definition: Timing.cc:530
edm::service::ui2str
static std::string ui2str(unsigned int i)
Definition: Timing.cc:151
ModuleDescription.h
ActivityRegistry.h
edm::service::Timing::CountAndTime::CountAndTime
CountAndTime(unsigned int count, double time)
Definition: Timing.cc:95
edm::service::popStack
static double popStack()
Definition: Timing.cc:190
edm::service::Timing::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Timing.cc:329
edm::service::Timing::postSourceRun
void postSourceRun(RunIndex)
Definition: Timing.cc:538
edm::service::Timing::preBeginJob
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &)
Definition: Timing.cc:341
edm::service::Timing::postEndJob
void postEndJob()
Definition: Timing.cc:367
edm::service::d2str
static std::string d2str(double d)
Definition: SimpleMemoryCheck.cc:277
edm::service::Timing::countAndTimeZero_
CountAndTime countAndTimeZero_
Definition: Timing.cc:125
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::StreamContext
Definition: StreamContext.h:31
edm::service::Timing::postOpenFile
void postOpenFile(std::string const &, bool)
Definition: Timing.cc:542
edm::serviceregistry::AllArgsMaker
Definition: ServiceMaker.h:47
Service.h
edm::service::Timing::extra_job_cpu_
std::atomic< double > extra_job_cpu_
Definition: Timing.cc:105
edm::service::Timing::countSubProcessesPostEvent_
std::vector< std::unique_ptr< std::atomic< unsigned int > > > countSubProcessesPostEvent_
Definition: Timing.cc:134
edm::ActivityRegistry
Definition: ActivityRegistry.h:133
edm::service::Timing::lastPostEvent
void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const &iStream)
Definition: Timing.cc:501
DEFINE_FWK_SERVICE_MAKER
#define DEFINE_FWK_SERVICE_MAKER(concrete, maker)
Definition: ServiceMaker.h:109
edm::service::Timing::preSourceLumi
void preSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:532
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ParameterSetDescription.h
b
double b
Definition: hdecay.h:118
edm::service::Timing::preEvent
void preEvent(StreamContext const &)
Definition: Timing.cc:468
ServiceMaker.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::service::Timing::postGlobalBeginLumi
void postGlobalBeginLumi(GlobalContext const &)
Definition: Timing.cc:563
edm::service::Timing::nThreads_
unsigned int nThreads_
Definition: Timing.cc:123
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::service::Timing::max_events_time_
std::vector< double > max_events_time_
Definition: Timing.cc:116
edm::service::pushStack
static void pushStack(bool configuredInTopLevelProcess)
Definition: Timing.cc:199
edm::GlobalContext
Definition: GlobalContext.h:29
edm::service::Timing::total_event_count_
std::atomic< unsigned long > total_event_count_
Definition: Timing.cc:119
edm::ParameterSet
Definition: ParameterSet.h:47
edm::service::Timing::min_events_time_
std::vector< double > min_events_time_
Definition: Timing.cc:117
edm::service::Timing::nSubProcesses_
unsigned int nSubProcesses_
Definition: Timing.cc:137
GlobalContext.h
edm::service::Timing::addToCPUTime
void addToCPUTime(double iTime) override
Definition: Timing.cc:320
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::StreamContext::streamID
StreamID const & streamID() const
Definition: StreamContext.h:54
edm::service::Timing::configuredInTopLevelProcess_
bool configuredInTopLevelProcess_
Definition: Timing.cc:136
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:118
thread_safety_macros.h
edm::Service
Definition: Service.h:30
edm::service::Timing::postModuleGlobal
void postModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:552
edm::service::Timing::Timing
Timing(ParameterSet const &, ActivityRegistry &)
Definition: Timing.cc:207
edm::service::Timing::preModule
void preModule(ModuleDescription const &md)
Definition: Timing.cc:544
edm::service::Timing::postCommon
double postCommon() const
Definition: Timing.cc:578
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::TimingServiceBase
Definition: TimingServiceBase.h:28
edm::service::Timing::postSourceLumi
void postSourceLumi(LuminosityBlockIndex)
Definition: Timing.cc:534
edm::service::moduleTimeStack
static std::vector< double > & moduleTimeStack()
Definition: Timing.cc:185
edm::service::Timing::preModuleStream
void preModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:572
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::service::Timing::nStreams_
unsigned int nStreams_
Definition: Timing.cc:122
edm::service::Timing::postModule
void postModule(ModuleDescription const &md)
Definition: Timing.cc:546
TimingServiceBase.h
edm::service::Timing::accumulateTimeBegin
void accumulateTimeBegin(std::atomic< CountAndTime * > &countAndTime, double &accumulatedTime)
Definition: Timing.cc:592
edm::service::Timing::CountAndTime::count_
unsigned int count_
Definition: Timing.cc:96
edm::PathsAndConsumesOfModulesBase
Definition: PathsAndConsumesOfModulesBase.h:34
usage
void usage()
Definition: array2xmlEB.cc:14
Exception
Definition: hltDiff.cc:246
edm::service::Timing::preModuleGlobal
void preModuleGlobal(GlobalContext const &, ModuleCallingContext const &)
Definition: Timing.cc:548
edm::service::Timing::threshold_
double threshold_
Definition: Timing.cc:112
edm::service::Timing::last_run_cpu_
std::atomic< double > last_run_cpu_
Definition: Timing.cc:108
edm::RunIndex
Definition: RunIndex.h:32
Exception.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::service::Timing::postBeginJob
void postBeginJob()
Definition: Timing.cc:349
edm::service::Timing::postModuleStream
void postModuleStream(StreamContext const &, ModuleCallingContext const &)
Definition: Timing.cc:576
edm::service::Timing::CountAndTime
Definition: Timing.cc:93
ztail.d
d
Definition: ztail.py:151
edm::service::Timing::curr_job_time_
double curr_job_time_
Definition: Timing.cc:103
JobReport.h
ParameterSet.h
StreamContext.h
edm::service::Timing::report_summary_
bool report_summary_
Definition: Timing.cc:111
TimingMaker
edm::serviceregistry::AllArgsMaker< edm::TimingServiceBase, Timing > TimingMaker
Definition: Timing.cc:647
ntuplemaker.time
time
Definition: ntuplemaker.py:310
ProcessContext.h
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
CMS_THREAD_GUARD
#define CMS_THREAD_GUARD(_var_)
Definition: thread_safety_macros.h:6
SystemBounds.h
edm::StreamContext::eventID
EventID const & eventID() const
Definition: StreamContext.h:59
edm::service::Timing::preSourceRun
void preSourceRun(RunIndex)
Definition: Timing.cc:536
edm::service::Timing::countAndTimeForLock_
std::atomic< CountAndTime * > countAndTimeForLock_
Definition: Timing.cc:127
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::service::Timing::last_run_time_
std::atomic< double > last_run_time_
Definition: Timing.cc:107