CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastTimerService.cc
Go to the documentation of this file.
1 // FIXME
2 // we are by-passing the ME's when filling the plots, so we might need to call the ME's update() by hand
3 
4 
5 // C++ headers
6 #include <cmath>
7 #include <limits>
8 #include <iostream>
9 #include <iomanip>
10 #include <mutex>
11 #include <string>
12 #include <sstream>
13 #include <unordered_set>
14 #include <unordered_map>
15 
16 // boost headers
17 #include <boost/format.hpp>
18 
19 // tbb headers
20 #include <tbb/concurrent_vector.h>
21 
22 // CMSSW headers
39 
40 
42  // configuration
43  // FIXME - reimplement support for cpu time vs. real time
44  m_use_realtime( config.getUntrackedParameter<bool>( "useRealTimeClock" ) ),
45  m_enable_timing_paths( config.getUntrackedParameter<bool>( "enableTimingPaths" ) ),
46  m_enable_timing_modules( config.getUntrackedParameter<bool>( "enableTimingModules" ) ),
47  m_enable_timing_exclusive( config.getUntrackedParameter<bool>( "enableTimingExclusive" ) ),
48  m_enable_timing_summary( config.getUntrackedParameter<bool>( "enableTimingSummary" ) ),
49  m_skip_first_path( config.getUntrackedParameter<bool>( "skipFirstPath" ) ),
50  // dqm configuration
51  m_enable_dqm( config.getUntrackedParameter<bool>( "enableDQM" ) ),
52  m_enable_dqm_bypath_active( config.getUntrackedParameter<bool>( "enableDQMbyPathActive" ) ),
53  m_enable_dqm_bypath_total( config.getUntrackedParameter<bool>( "enableDQMbyPathTotal" ) ),
54  m_enable_dqm_bypath_overhead( config.getUntrackedParameter<bool>( "enableDQMbyPathOverhead" ) ),
55  m_enable_dqm_bypath_details( config.getUntrackedParameter<bool>( "enableDQMbyPathDetails" ) ),
56  m_enable_dqm_bypath_counters( config.getUntrackedParameter<bool>( "enableDQMbyPathCounters" ) ),
57  m_enable_dqm_bypath_exclusive( config.getUntrackedParameter<bool>( "enableDQMbyPathExclusive" ) ),
58  m_enable_dqm_bymodule( config.getUntrackedParameter<bool>( "enableDQMbyModule" ) ),
59  m_enable_dqm_bymoduletype( config.getUntrackedParameter<bool>( "enableDQMbyModuleType" ) ),
60  m_enable_dqm_summary( config.getUntrackedParameter<bool>( "enableDQMSummary" ) ),
61  m_enable_dqm_byls( config.getUntrackedParameter<bool>( "enableDQMbyLumiSection" ) ),
62  m_enable_dqm_bynproc( config.getUntrackedParameter<bool>( "enableDQMbyProcesses" ) ),
63  // job configuration
64  m_concurrent_runs( 0 ),
65  m_concurrent_streams( 0 ),
66  m_concurrent_threads( 0 ),
67  m_module_id( edm::ModuleDescription::invalidID() ),
68  m_dqm_eventtime_range( config.getUntrackedParameter<double>( "dqmTimeRange" ) ), // ms
69  m_dqm_eventtime_resolution( config.getUntrackedParameter<double>( "dqmTimeResolution" ) ), // ms
70  m_dqm_pathtime_range( config.getUntrackedParameter<double>( "dqmPathTimeRange" ) ), // ms
71  m_dqm_pathtime_resolution( config.getUntrackedParameter<double>( "dqmPathTimeResolution" ) ), // ms
72  m_dqm_moduletime_range( config.getUntrackedParameter<double>( "dqmModuleTimeRange" ) ), // ms
73  m_dqm_moduletime_resolution( config.getUntrackedParameter<double>( "dqmModuleTimeResolution" ) ), // ms
74  m_dqm_path( config.getUntrackedParameter<std::string>("dqmPath" ) ),
75  // description of the process(es)
76  m_process(),
77  // description of the luminosity axes
78  m_dqm_luminosity(),
79  // DQM - these are initialized at preStreamBeginRun(), to make sure the DQM service has been loaded
80  m_stream(),
81  // summary data
82  m_run_summary(),
83  m_job_summary(),
84  m_run_summary_perprocess(),
85  m_job_summary_perprocess()
86 {
87  // enable timers if required by DQM plots
95 
104 
107 
108 
117  registry.watchPostEndJob( this, & FastTimerService::postEndJob );
121  registry.watchPreEvent( this, & FastTimerService::preEvent );
122  registry.watchPostEvent( this, & FastTimerService::postEvent );
123  // watch per-path events
126  // watch per-module events if enabled
132  }
133 
134  // if requested, reserve plots for timing vs. lumisection
135  // there is no need to store the id, as it wil always be 0
136  if (m_enable_dqm_byls)
137  reserveLuminosityPlots("ls", "lumisection", "lumisection", config.getUntrackedParameter<uint32_t>("dqmLumiSectionsRange"), 1.);
138 
139 }
140 
142 {
143 }
144 
145 // reserve plots for timing vs. luminosity
146 unsigned int FastTimerService::reserveLuminosityPlots(std::string const & name, std::string const & title, std::string const & label, double range, double resolution)
147 {
148  // FIXME check that this is only called before any preStreamBeginRun
149  // FIXME check that this is not called with the same "name" twice
150  m_dqm_luminosity.push_back(LuminosityDescription(name, title, label, range, resolution));
151 
152  // resize the luminosity per event buffer
153  for (auto & stream: m_stream)
154  stream.luminosity.resize(m_dqm_luminosity.size(), 0);
155 
156  return m_dqm_luminosity.size() - 1;
157 }
158 
160 {
161  // FIXME check that this is only called before any preStreamBeginRun
162  // FIXME check that this is not called with the same "name" twice
163  m_dqm_luminosity.push_back(LuminosityDescription(name, title, label, range, resolution));
164 
165  // resize the luminosity per event buffer
166  for (auto & stream: m_stream)
167  stream.luminosity.resize(m_dqm_luminosity.size(), 0);
168 
169  return m_dqm_luminosity.size() - 1;
170 }
171 
172 // set the event luminosity
173 void FastTimerService::setLuminosity(unsigned int stream_id, unsigned int luminosity_id, double value)
174 {
175  // FIXME check that the luminosity id is valid ?
176  m_stream[stream_id].luminosity[luminosity_id] = value;
177 }
178 
180 {
181  unsigned int pid = processID(gc.processContext());
182  unsigned int rid = gc.runIndex();
183 
185 
186  uint32_t size_p = tns.getTrigPaths().size();
187  uint32_t size_e = tns.getEndPaths().size();
188  uint32_t size = size_p + size_e;
189  // resize the path maps
190  for (auto & stream: m_stream)
191  if (stream.paths.size() <= pid)
192  stream.paths.resize(pid+1);
193  for (uint32_t i = 0; i < size_p; ++i) {
194  std::string const & label = tns.getTrigPath(i);
195  for (auto & stream: m_stream)
196  stream.paths[pid][label].index = i;
197  }
198  for (uint32_t i = 0; i < size_e; ++i) {
199  std::string const & label = tns.getEndPath(i);
200  for (auto & stream: m_stream)
201  stream.paths[pid][label].index = size_p + i;
202  }
203  for (auto & stream: m_stream) {
204  // resize the stream buffers to account the number of subprocesses
205  if (stream.timing_perprocess.size() <= pid)
206  stream.timing_perprocess.resize(pid+1);
207  stream.timing_perprocess[pid].paths_interpaths.assign(size + 1, 0.);
208  // resize the stream plots to account the number of subprocesses
209  if (stream.dqm_perprocess.size() <= pid)
210  stream.dqm_perprocess.resize(pid+1);
211  if (stream.dqm_perprocess_byluminosity.size() <= pid)
212  stream.dqm_perprocess_byluminosity.resize(pid+1);
213  if (stream.dqm_paths.size() <= pid)
214  stream.dqm_paths.resize(pid+1);
215  }
216  for (auto & summary: m_run_summary_perprocess) {
217  if (summary.size() <= pid)
218  summary.resize(pid+1);
219  summary[pid].paths_interpaths.assign(size + 1, 0);
220  }
221  if (m_job_summary_perprocess.size() <= pid)
222  m_job_summary_perprocess.resize(pid+1);
223  m_job_summary_perprocess[pid].paths_interpaths.assign(size + 1, 0.);
224 
225  // reset the run summaries
226  if (pid == 0)
227  m_run_summary[rid].reset();
228  m_run_summary_perprocess[rid][pid].reset();
229 
230  // associate to each path all the modules it contains
231  for (uint32_t i = 0; i < tns.getTrigPaths().size(); ++i)
232  fillPathMap( pid, tns.getTrigPath(i), tns.getTrigPathModules(i) );
233  for (uint32_t i = 0; i < tns.getEndPaths().size(); ++i)
234  fillPathMap( pid, tns.getEndPath(i), tns.getEndPathModules(i) );
235 
236  // cache the names of the process, and of first and last non-empty path and endpath
237  if (m_process.size() <= pid)
238  m_process.resize(pid+1);
239  m_process[pid].name = gc.processContext()->processName();
240  std::tie(m_process[pid].first_path, m_process[pid].last_path) = findFirstLast(pid, tns.getTrigPaths(), m_skip_first_path and pid == 0);
241  std::tie(m_process[pid].first_endpath, m_process[pid].last_endpath) = findFirstLast(pid, tns.getEndPaths());
242 }
243 
245 {
247  unsigned int pid = processID(sc.processContext());
248  unsigned int sid = sc.streamID().value();
249  auto & stream = m_stream[sid];
250 
251  if (not m_enable_dqm)
252  return;
253 
254  if (not edm::Service<DQMStore>().isAvailable()) {
255  // the DQMStore is not available, disable all DQM plots
256  m_enable_dqm = false;
257  return;
258  }
259 
261  uint32_t size_p = tns.getTrigPaths().size();
262  uint32_t size_e = tns.getEndPaths().size();
263  uint32_t size = size_p + size_e;
264 
265  int eventbins = (int) std::ceil(m_dqm_eventtime_range / m_dqm_eventtime_resolution);
266  int pathbins = (int) std::ceil(m_dqm_pathtime_range / m_dqm_pathtime_resolution);
267  int modulebins = (int) std::ceil(m_dqm_moduletime_range / m_dqm_moduletime_resolution);
268 
269  // define a callback that can book the histograms
270  auto bookTransactionCallback = [&, this] (DQMStore::IBooker & booker) {
271 
272  // event summary plots
273  if (m_enable_dqm_summary) {
274  // whole event
275  if (pid == 0) {
276  booker.setCurrentFolder(m_dqm_path);
277  stream.dqm.presource = booker.book1D("presource", "Pre-Source processing time", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
278  stream.dqm.presource ->StatOverflows(true);
279  stream.dqm.presource ->SetXTitle("processing time [ms]");
280  stream.dqm.source = booker.book1D("source", "Source processing time", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
281  stream.dqm.source ->StatOverflows(true);
282  stream.dqm.source ->SetXTitle("processing time [ms]");
283  stream.dqm.preevent = booker.book1D("preevent", "Pre-Event processing time", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
284  stream.dqm.preevent ->StatOverflows(true);
285  stream.dqm.preevent ->SetXTitle("processing time [ms]");
286  stream.dqm.event = booker.book1D("event", "Event processing time", eventbins, 0., m_dqm_eventtime_range)->getTH1F();
287  stream.dqm.event ->StatOverflows(true);
288  stream.dqm.event ->SetXTitle("processing time [ms]");
289  }
290 
291  // per subprocess
292  booker.setCurrentFolder(m_dqm_path + "/process " + process_name);
293  stream.dqm_perprocess[pid].preevent = booker.book1D("preevent", "Pre-Event processing time", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
294  stream.dqm_perprocess[pid].preevent ->StatOverflows(true);
295  stream.dqm_perprocess[pid].preevent ->SetXTitle("processing time [ms]");
296  stream.dqm_perprocess[pid].event = booker.book1D("event", "Event processing time", eventbins, 0., m_dqm_eventtime_range)->getTH1F();
297  stream.dqm_perprocess[pid].event ->StatOverflows(true);
298  stream.dqm_perprocess[pid].event ->SetXTitle("processing time [ms]");
299  stream.dqm_perprocess[pid].all_paths = booker.book1D("all_paths", "Paths processing time", eventbins, 0., m_dqm_eventtime_range)->getTH1F();
300  stream.dqm_perprocess[pid].all_paths ->StatOverflows(true);
301  stream.dqm_perprocess[pid].all_paths ->SetXTitle("processing time [ms]");
302  stream.dqm_perprocess[pid].all_endpaths = booker.book1D("all_endpaths", "EndPaths processing time", pathbins, 0., m_dqm_pathtime_range)->getTH1F();
303  stream.dqm_perprocess[pid].all_endpaths ->StatOverflows(true);
304  stream.dqm_perprocess[pid].all_endpaths ->SetXTitle("processing time [ms]");
305  stream.dqm_perprocess[pid].interpaths = booker.book1D("interpaths", "Time spent between paths", pathbins, 0., m_dqm_eventtime_range)->getTH1F();
306  stream.dqm_perprocess[pid].interpaths ->StatOverflows(true);
307  stream.dqm_perprocess[pid].interpaths ->SetXTitle("processing time [ms]");
308  }
309 
310  // plots by path
311  if (m_enable_timing_paths) {
312  booker.setCurrentFolder(m_dqm_path + "/process " + process_name);
313  stream.dqm_paths[pid].active_time = booker.bookProfile("paths_active_time", "Additional time spent in each path", size, -0.5, size-0.5, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
314  stream.dqm_paths[pid].active_time ->StatOverflows(true);
315  stream.dqm_paths[pid].active_time ->SetYTitle("processing time [ms]");
316  stream.dqm_paths[pid].total_time = booker.bookProfile("paths_total_time", "Total time spent in each path", size, -0.5, size-0.5, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
317  stream.dqm_paths[pid].total_time ->StatOverflows(true);
318  stream.dqm_paths[pid].total_time ->SetYTitle("processing time [ms]");
319  stream.dqm_paths[pid].exclusive_time = booker.bookProfile("paths_exclusive_time", "Exclusive time spent in each path", size, -0.5, size-0.5, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
320  stream.dqm_paths[pid].exclusive_time ->StatOverflows(true);
321  stream.dqm_paths[pid].exclusive_time ->SetYTitle("processing time [ms]");
322  stream.dqm_paths[pid].interpaths = booker.bookProfile("paths_interpaths", "Time spent between each path", size+1, -0.5, size+0.5, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
323  stream.dqm_paths[pid].interpaths ->StatOverflows(true);
324  stream.dqm_paths[pid].interpaths ->SetYTitle("processing time [ms]");
325 
326  for (uint32_t i = 0; i < size_p; ++i) {
327  std::string const & label = tns.getTrigPath(i);
328  stream.dqm_paths[pid].active_time ->GetXaxis()->SetBinLabel(i + 1, label.c_str());
329  stream.dqm_paths[pid].total_time ->GetXaxis()->SetBinLabel(i + 1, label.c_str());
330  stream.dqm_paths[pid].exclusive_time ->GetXaxis()->SetBinLabel(i + 1, label.c_str());
331  stream.dqm_paths[pid].interpaths ->GetXaxis()->SetBinLabel(i + 1, label.c_str());
332  }
333  for (uint32_t i = 0; i < size_e; ++i) {
334  std::string const & label = tns.getEndPath(i);
335  stream.dqm_paths[pid].active_time ->GetXaxis()->SetBinLabel(i + size_p + 1, label.c_str());
336  stream.dqm_paths[pid].total_time ->GetXaxis()->SetBinLabel(i + size_p + 1, label.c_str());
337  stream.dqm_paths[pid].exclusive_time ->GetXaxis()->SetBinLabel(i + size_p + 1, label.c_str());
338  stream.dqm_paths[pid].interpaths ->GetXaxis()->SetBinLabel(i + size_p + 1, label.c_str());
339  }
340  stream.dqm_paths[pid].interpaths ->GetXaxis()->SetBinLabel(size+1, "");
341  }
342 
343  // plots vs. instantaneous luminosity
344  if (not m_dqm_luminosity.empty()) {
345  if (pid == 0) {
346  // resize the plots vs. luminosity
347  stream.dqm_byluminosity.resize(m_dqm_luminosity.size());
348 
349  // whole event
350  booker.setCurrentFolder(m_dqm_path);
351  for (unsigned int i = 0; i < m_dqm_luminosity.size(); ++i) {
352  auto & plots = stream.dqm_byluminosity[i];
353  int lumibins = (int) std::ceil(m_dqm_luminosity[i].range / m_dqm_luminosity[i].resolution);
354  plots.presource = booker.bookProfile("presource_by" + m_dqm_luminosity[i].name, "Pre-Source processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
355  plots.presource ->StatOverflows(true);
356  plots.presource ->SetXTitle(m_dqm_luminosity[i].label.c_str());
357  plots.presource ->SetYTitle("processing time [ms]");
358  plots.source = booker.bookProfile("source_by" + m_dqm_luminosity[i].name, "Source processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
359  plots.source ->StatOverflows(true);
360  plots.source ->SetXTitle(m_dqm_luminosity[i].label.c_str());
361  plots.source ->SetYTitle("processing time [ms]");
362  plots.preevent = booker.bookProfile("preevent_by" + m_dqm_luminosity[i].name, "Pre-Event processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
363  plots.preevent ->StatOverflows(true);
364  plots.preevent ->SetXTitle(m_dqm_luminosity[i].label.c_str());
365  plots.preevent ->SetYTitle("processing time [ms]");
366  plots.event = booker.bookProfile("event_by" + m_dqm_luminosity[i].name, "Event processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, eventbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
367  plots.event ->StatOverflows(true);
368  plots.event ->SetXTitle(m_dqm_luminosity[i].label.c_str());
369  plots.event ->SetYTitle("processing time [ms]");
370  }
371  }
372 
373  // resize the plots vs. luminosity
374  stream.dqm_perprocess_byluminosity[pid].resize(m_dqm_luminosity.size());
375 
376  // per subprocess
377  booker.setCurrentFolder(m_dqm_path + "/process " + process_name);
378  for (unsigned int i = 0; i < m_dqm_luminosity.size(); ++i) {
379  auto & plots = stream.dqm_perprocess_byluminosity[pid][i];
380  int lumibins = (int) std::ceil(m_dqm_luminosity[i].range / m_dqm_luminosity[i].resolution);
381  plots.preevent = booker.bookProfile("preevent_by" + m_dqm_luminosity[i].name, "Pre-Event processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
382  plots.preevent ->StatOverflows(true);
383  plots.preevent ->SetXTitle(m_dqm_luminosity[i].label.c_str());
384  plots.preevent ->SetYTitle("processing time [ms]");
385  plots.event = booker.bookProfile("event_by" + m_dqm_luminosity[i].name, "Event processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, eventbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
386  plots.event ->StatOverflows(true);
387  plots.event ->SetXTitle(m_dqm_luminosity[i].label.c_str());
388  plots.event ->SetYTitle("processing time [ms]");
389  plots.all_paths = booker.bookProfile("all_paths_by" + m_dqm_luminosity[i].name, "Paths processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, eventbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
390  plots.all_paths ->StatOverflows(true);
391  plots.all_paths ->SetXTitle(m_dqm_luminosity[i].label.c_str());
392  plots.all_paths ->SetYTitle("processing time [ms]");
393  plots.all_endpaths = booker.bookProfile("all_endpaths_by" + m_dqm_luminosity[i].name, "EndPaths processing time vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
394  plots.all_endpaths ->StatOverflows(true);
395  plots.all_endpaths ->SetXTitle(m_dqm_luminosity[i].label.c_str());
396  plots.all_endpaths ->SetYTitle("processing time [ms]");
397  plots.interpaths = booker.bookProfile("interpaths_by" + m_dqm_luminosity[i].name, "Time spent between paths vs. " + m_dqm_luminosity[i].title, lumibins, 0., m_dqm_luminosity[i].range, pathbins, 0., std::numeric_limits<double>::infinity(), " ")->getTProfile();
398  plots.interpaths ->StatOverflows(true);
399  plots.interpaths ->SetXTitle(m_dqm_luminosity[i].label.c_str());
400  plots.interpaths ->SetYTitle("processing time [ms]");
401  }
402  }
403 
404  // per-path and per-module accounting
405  if (m_enable_timing_paths) {
406  booker.setCurrentFolder(m_dqm_path + "/process " + process_name + "/Paths");
407  for (auto & keyval: stream.paths[pid]) {
408  std::string const & pathname = keyval.first;
409  PathInfo & pathinfo = keyval.second;
410 
412  pathinfo.dqm_active = booker.book1D(pathname + "_active", pathname + " active time", pathbins, 0., m_dqm_pathtime_range)->getTH1F();
413  pathinfo.dqm_active ->StatOverflows(true);
414  pathinfo.dqm_active ->SetXTitle("processing time [ms]");
415  }
416 
418  pathinfo.dqm_total = booker.book1D(pathname + "_total", pathname + " total time", pathbins, 0., m_dqm_pathtime_range)->getTH1F();
419  pathinfo.dqm_total ->StatOverflows(true);
420  pathinfo.dqm_total ->SetXTitle("processing time [ms]");
421  }
422 
424  pathinfo.dqm_premodules = booker.book1D(pathname + "_premodules", pathname + " pre-modules overhead", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
425  pathinfo.dqm_premodules ->StatOverflows(true);
426  pathinfo.dqm_premodules ->SetXTitle("processing time [ms]");
427  pathinfo.dqm_intermodules = booker.book1D(pathname + "_intermodules", pathname + " inter-modules overhead", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
428  pathinfo.dqm_intermodules ->StatOverflows(true);
429  pathinfo.dqm_intermodules ->SetXTitle("processing time [ms]");
430  pathinfo.dqm_postmodules = booker.book1D(pathname + "_postmodules", pathname + " post-modules overhead", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
431  pathinfo.dqm_postmodules ->StatOverflows(true);
432  pathinfo.dqm_postmodules ->SetXTitle("processing time [ms]");
433  pathinfo.dqm_overhead = booker.book1D(pathname + "_overhead", pathname + " overhead time", modulebins, 0., m_dqm_moduletime_range)->getTH1F();
434  pathinfo.dqm_overhead ->StatOverflows(true);
435  pathinfo.dqm_overhead ->SetXTitle("processing time [ms]");
436  }
437 
439  // book histograms for modules-in-paths statistics
440 
441  // find histograms X-axis labels
442  uint32_t id;
443  std::vector<std::string> const & modules = ((id = tns.findTrigPath(pathname)) != tns.getTrigPaths().size()) ? tns.getTrigPathModules(id) :
444  ((id = tns.findEndPath(pathname)) != tns.getEndPaths().size()) ? tns.getEndPathModules(id) :
445  std::vector<std::string>();
446 
447  // use a mutex to prevent two threads from assigning to the same element at the same time
448  static std::mutex dup_mutex;
449  // use a tbb::concurrent_vector because growing does not invalidate existing iterators and pointers
450  static tbb::concurrent_vector<std::string> dup;
451  // lock, and fill the first 32 elements
452  if (dup.empty()) {
453  std::lock_guard<std::mutex> lock(dup_mutex);
454  if (dup.empty()) {
455  dup.resize(32);
456  for (unsigned int i = 0; i < 32; ++i)
457  dup[i] = (boost::format("(dup.) (%d)") % i).str();
458  }
459  }
460  // lock, and fill as many elements as needed
461  if (modules.size() > dup.size()) {
462  std::lock_guard<std::mutex> lock(dup_mutex);
463  unsigned int old_size = dup.size();
464  unsigned int new_size = modules.size();
465  if (new_size > old_size) {
466  dup.resize(new_size);
467  for (unsigned int i = old_size; i < new_size; ++i)
468  dup[i] = (boost::format("(dup.) (%d)") % i).str();
469  }
470  }
471 
472  std::vector<const char *> labels(modules.size(), nullptr);
473  for (uint32_t i = 0; i < modules.size(); ++i)
474  labels[i] = (pathinfo.modules[i]) ? modules[i].c_str() : dup[i].c_str();
475 
476  // book counter histograms
477  if (m_enable_dqm_bypath_counters) {
478  pathinfo.dqm_module_counter = booker.book1D(pathname + "_module_counter", pathname + " module counter", modules.size() + 1, -0.5, modules.size() + 0.5)->getTH1F();
479  // find module labels
480  for (uint32_t i = 0; i < modules.size(); ++i)
481  pathinfo.dqm_module_counter->GetXaxis()->SetBinLabel( i+1, labels[i] );
482  pathinfo.dqm_module_counter->GetXaxis()->SetBinLabel( modules.size() + 1, "" );
483  }
484  // book detailed timing histograms
486  pathinfo.dqm_module_active = booker.book1D(pathname + "_module_active", pathname + " module active", modules.size(), -0.5, modules.size() - 0.5)->getTH1F();
487  pathinfo.dqm_module_active ->SetYTitle("cumulative processing time [ms]");
488  pathinfo.dqm_module_total = booker.book1D(pathname + "_module_total", pathname + " module total", modules.size(), -0.5, modules.size() - 0.5)->getTH1F();
489  pathinfo.dqm_module_total ->SetYTitle("cumulative processing time [ms]");
490  // find module labels
491  for (uint32_t i = 0; i < modules.size(); ++i) {
492  pathinfo.dqm_module_active ->GetXaxis()->SetBinLabel( i+1, labels[i] );
493  pathinfo.dqm_module_total ->GetXaxis()->SetBinLabel( i+1, labels[i] );
494  }
495  }
496  }
497 
498  // book exclusive path time histograms
500  pathinfo.dqm_exclusive = booker.book1D(pathname + "_exclusive", pathname + " exclusive time", pathbins, 0., m_dqm_pathtime_range)->getTH1F();
501  pathinfo.dqm_exclusive ->StatOverflows(true);
502  pathinfo.dqm_exclusive ->SetXTitle("processing time [ms]");
503  }
504 
505  }
506  }
507 
508  if (m_enable_dqm_bymodule) {
509  booker.setCurrentFolder(m_dqm_path + "/Modules");
510  for (auto & keyval: stream.modules) {
511  std::string const & label = keyval.first;
512  ModuleInfo & module = keyval.second;
513  module.dqm_active = booker.book1D(label, label, modulebins, 0., m_dqm_moduletime_range)->getTH1F();
514  module.dqm_active->StatOverflows(true);
515  module.dqm_active->SetXTitle("processing time [ms]");
516  }
517  }
518 
520  booker.setCurrentFolder(m_dqm_path + "/ModuleTypes");
521  for (auto & keyval: stream.moduletypes) {
522  std::string const & label = keyval.first;
523  ModuleInfo & module = keyval.second;
524  module.dqm_active = booker.book1D(label, label, modulebins, 0., m_dqm_moduletime_range)->getTH1F();
525  module.dqm_active->StatOverflows(true);
526  module.dqm_active->SetXTitle("processing time [ms]");
527  }
528  }
529 
530  };
531 
532  // book MonitorElement's for this stream
533  edm::Service<DQMStore>()->bookTransaction(bookTransactionCallback, sc.eventID().run(), sid, m_module_id);
534 }
535 
536 
537 void
539 {
543 
545  m_dqm_path += (boost::format("/Running %d processes") % m_concurrent_threads).str();
546 
550 
551  // assign a pseudo module id to the FastTimerService
553  for (auto & stream: m_stream) {
554  stream.fast_modules.resize( m_module_id, nullptr);
555  stream.fast_moduletypes.resize(m_module_id, nullptr);
556  }
557 
558  // resize the luminosity per event buffer
559  for (auto & stream: m_stream)
560  stream.luminosity.resize(m_dqm_luminosity.size(), 0);
561 }
562 
563 
564 void
566  unsigned int sid = sc.streamID().value();
567  auto & stream = m_stream[sid];
568  stream.timer_last_transition = FastTimer::Clock::now();
569 }
570 
571 void
573 {
574  unsigned int sid = sc.streamID().value();
575  auto & stream = m_stream[sid];
576 
577  if (m_enable_dqm) {
578  DQMStore * store = edm::Service<DQMStore>().operator->();
579  assert(store);
581  }
582 
583  stream.reset();
584  stream.timer_last_transition = FastTimer::Clock::now();
585 }
586 
587 void
589  unsigned int sid = sc.streamID().value();
590  auto & stream = m_stream[sid];
591  stream.timer_last_transition = FastTimer::Clock::now();
592 }
593 
594 void
596  unsigned int sid = sc.streamID().value();
597  auto & stream = m_stream[sid];
598 
599  if (m_enable_dqm) {
600  DQMStore * store = edm::Service<DQMStore>().operator->();
601  assert(store);
603  }
604 
605  stream.timer_last_transition = FastTimer::Clock::now();
606 }
607 
608 void
610 {
612  unsigned int pid = processID(gc.processContext());
613  unsigned int rid = gc.runIndex();
614  unsigned int run = gc.luminosityBlockID().run();
615  const std::string label = (boost::format("run %d") % run).str();
616 
618 
619  if (pid+1 == m_process.size())
620  printSummary(m_run_summary[rid], label);
621  }
622 }
623 
624 void
626 {
628  const std::string label = "the whole job";
629  for (unsigned int pid = 0; pid < m_process.size(); ++pid)
631 
632  printSummary(m_job_summary, label);
633  }
634 }
635 
636 void
638 {
639  // print a timing summary for the run or job, for each subprocess
640  std::ostringstream out;
641  out << std::fixed << std::setprecision(6);
642  out << "FastReport for " << label << ", process " << process << '\n';
643  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << '\n';
644  out << "FastReport " << std::right << std::setw(10) << summary.preevent / (double) total.count << " Pre-Event" << '\n';
645  out << "FastReport " << std::right << std::setw(10) << summary.event / (double) total.count << " Event" << '\n';
646  out << "FastReport " << std::right << std::setw(10) << summary.all_paths / (double) total.count << " all Paths" << '\n';
647  out << "FastReport " << std::right << std::setw(10) << summary.all_endpaths / (double) total.count << " all EndPaths" << '\n';
648  out << "FastReport " << std::right << std::setw(10) << summary.interpaths / (double) total.count << " between paths" << '\n';
649  edm::LogVerbatim("FastReport") << out.str();
650 }
651 
652 void
654 {
655  // print a timing summary for the run or job
656  //edm::service::TriggerNamesService & tns = * edm::Service<edm::service::TriggerNamesService>();
657 
658  std::ostringstream out;
659  out << std::fixed << std::setprecision(6);
660  out << "FastReport for " << label << ", over all subprocesses" << '\n';
661  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << '\n';
662  out << "FastReport " << std::right << std::setw(10) << summary.presource / (double) summary.count << " Pre-Source" << '\n';
663  out << "FastReport " << std::right << std::setw(10) << summary.source / (double) summary.count << " Source" << '\n';
664  out << "FastReport " << std::right << std::setw(10) << summary.preevent / (double) summary.count << " Pre-Event" << '\n';
665  out << "FastReport " << std::right << std::setw(10) << summary.event / (double) summary.count << " Event" << '\n';
666  edm::LogVerbatim("FastReport") << out.str();
667 }
668 
669 /*
670  if (m_enable_timing_modules) {
671  double modules_total = 0.;
672  for (auto & keyval: m_stream.modules)
673  modules_total += keyval.second.summary_active;
674  out << "FastReport " << std::right << std::setw(10) << modules_total / (double) summary.count << " all Modules" << '\n';
675  }
676  out << '\n';
677  if (m_enable_timing_paths and not m_enable_timing_modules) {
678  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Path" << '\n';
679  for (auto const & name: tns.getTrigPaths())
680  out << "FastReport "
681  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_active / (double) summary.count << " "
682  << name << '\n';
683  out << '\n';
684  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active EndPath" << '\n';
685  for (auto const & name: tns.getEndPaths())
686  out << "FastReport "
687  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_active / (double) summary.count << " "
688  << name << '\n';
689  } else if (m_enable_timing_paths and m_enable_timing_modules) {
690  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Pre- Inter- Post-mods Overhead Total Path" << '\n';
691  for (auto const & name: tns.getTrigPaths()) {
692  out << "FastReport "
693  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_active / (double) summary.count << " "
694  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_premodules / (double) summary.count << " "
695  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_intermodules / (double) summary.count << " "
696  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_postmodules / (double) summary.count << " "
697  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_overhead / (double) summary.count << " "
698  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_total / (double) summary.count << " "
699  << name << '\n';
700  }
701  out << '\n';
702  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Pre- Inter- Post-mods Overhead Total EndPath" << '\n';
703  for (auto const & name: tns.getEndPaths()) {
704  out << "FastReport "
705  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_active / (double) summary.count << " "
706  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_premodules / (double) summary.count << " "
707  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_intermodules / (double) summary.count << " "
708  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_postmodules / (double) summary.count << " "
709  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_overhead / (double) summary.count << " "
710  << std::right << std::setw(10) << m_stream.paths[pid][name].summary_total / (double) summary.count << " "
711  << name << '\n';
712  }
713  }
714  out << '\n';
715  if (m_enable_timing_modules) {
716  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Module" << '\n';
717  for (auto & keyval: m_stream.modules) {
718  std::string const & label = keyval.first;
719  ModuleInfo const & module = keyval.second;
720  out << "FastReport " << std::right << std::setw(10) << module.summary_active / (double) summary.count << " " << label << '\n';
721  }
722  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Module" << '\n';
723  out << '\n';
724  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Module" << '\n';
725  for (auto & keyval: m_stream.moduletypes) {
726  std::string const & label = keyval.first;
727  ModuleInfo const & module = keyval.second;
728  out << "FastReport " << std::right << std::setw(10) << module.summary_active / (double) summary.count << " " << label << '\n';
729  }
730  //out << "FastReport " << (m_use_realtime ? "(real time) " : "(CPU time) ") << " Active Module" << '\n';
731  }
732 */
733 
735  // allocate a counter for each module and module type
736  for (auto & stream: m_stream) {
737  if (module.id() >= stream.fast_modules.size())
738  stream.fast_modules.resize(module.id() + 1, nullptr);
739  if (module.id() >= stream.fast_moduletypes.size())
740  stream.fast_moduletypes.resize(module.id() + 1, nullptr);
741 
742  stream.fast_modules[module.id()] = & stream.modules[module.moduleLabel()];;
743  stream.fast_moduletypes[module.id()] = & stream.moduletypes[module.moduleName()];
744  }
745 }
746 
748  unsigned int pid = processID(sc.processContext());
749  unsigned int sid = sc.streamID().value();
750  auto & stream = m_stream[sid];
751 
752  // new event, reset the per-event counter
753  stream.timer_event.start();
754 
755  // account the time spent between the last transition and the beginning of the event
756  stream.timing_perprocess[pid].preevent = delta(stream.timer_last_transition, stream.timer_event.getStartTime());
757 
758  // clear the event counters
759  stream.timing_perprocess[pid].event = 0;
760  stream.timing_perprocess[pid].all_paths = 0;
761  stream.timing_perprocess[pid].all_endpaths = 0;
762  stream.timing_perprocess[pid].interpaths = 0;
763  stream.timing_perprocess[pid].paths_interpaths.assign(stream.paths[pid].size() + 1, 0);
764  for (auto & keyval : stream.paths[pid]) {
765  keyval.second.timer.reset();
766  keyval.second.time_active = 0.;
767  keyval.second.time_exclusive = 0.;
768  keyval.second.time_premodules = 0.;
769  keyval.second.time_intermodules = 0.;
770  keyval.second.time_postmodules = 0.;
771  keyval.second.time_total = 0.;
772  }
773 
774  // copy the start event timestamp as the end of the previous path
775  // used by the inter-path overhead measurement
776  stream.timer_last_path = stream.timer_event.getStartTime();
777 
778  // if requested, set the lumisection for timing vs. lumisection plots
779  if (m_enable_dqm_byls and pid == 0)
780  setLuminosity(sid, 0, sc.eventID().luminosityBlock());
781 }
782 
784  unsigned int pid = processID(sc.processContext());
785  unsigned int sid = sc.streamID();
786  unsigned int rid = sc.runIndex();
787  auto & stream = m_stream[sid];
788 
789  // stop the per-event timer, and account event time
790  stream.timer_event.stop();
791  stream.timer_last_transition = stream.timer_event.getStopTime();
792  stream.timing_perprocess[pid].event = stream.timer_event.seconds();
793 
794  // the last part of inter-path overhead is the time between the end of the last (end)path and the end of the event processing
795  double interpaths = delta(stream.timer_last_path, stream.timer_event.getStopTime());
796  stream.timing_perprocess[pid].interpaths += interpaths;
797  stream.timing_perprocess[pid].paths_interpaths.back() = interpaths;
798 
799  {
800  // prevent different threads from updating the summary information at the same time
801  std::lock_guard<std::mutex> lock_summary(m_summary_mutex);
802 
803  // keep track of the total number of events and add this event's time to the per-run and per-job summary
804  m_run_summary_perprocess[rid][pid] += stream.timing_perprocess[pid];
805  m_job_summary_perprocess[pid] += stream.timing_perprocess[pid];
806 
807  // account the whole event timing details
808  if (pid+1 == m_process.size()) {
809  stream.timing.count = 1;
810  stream.timing.preevent = stream.timing_perprocess[0].preevent;
811  stream.timing.event = stream.timing_perprocess[0].event;
812  for (unsigned int i = 1; i < m_process.size(); ++i) {
813  stream.timing.event += stream.timing_perprocess[i].preevent;
814  stream.timing.event += stream.timing_perprocess[i].event;
815  }
816  m_run_summary[rid] += stream.timing;
817  m_job_summary += stream.timing;
818  }
819  }
820 
821  // elaborate "exclusive" modules
823  for (auto & keyval: stream.paths[pid]) {
824  PathInfo & pathinfo = keyval.second;
825  pathinfo.time_exclusive = pathinfo.time_overhead;
826 
827  for (uint32_t i = 0; i < pathinfo.last_run; ++i) {
828  ModuleInfo * module = pathinfo.modules[i];
829  if (module == 0)
830  // this is a module occurring more than once in the same path, skip it after the first occurrence
831  continue;
832  if ((module->run_in_path == & pathinfo) and (module->counter == 1))
833  pathinfo.time_exclusive += module->time_active;
834  }
835  }
836  }
837 
838  // fill the information per module type
839  // note: this is done here because during event processing two theads could try to update the same module type at the same time
840  // note: this is done only for the last subprocess, to avoid double conuting the modules' contributions
841  if ((m_enable_timing_modules) and (pid+1 == m_process.size())) {
842  for (unsigned int i = 0; i < stream.fast_modules.size(); ++i)
843  // check for null pointers - there is no guarantee that all module ids are valid and used
844  if (stream.fast_modules[i]) {
845  double active = stream.fast_modules[i]->time_active;
846  ModuleInfo & moduletype = * stream.fast_moduletypes[i];
847  moduletype.time_active += active;
848  moduletype.summary_active += active;
849  }
850  }
851 
852  // fill the DQM plots from the internal buffers
853  if (not m_enable_dqm)
854  return;
855 
856  // fill plots for per-event time by path
857  if (m_enable_timing_paths) {
858 
859  for (auto & keyval: stream.paths[pid]) {
860  PathInfo & pathinfo = keyval.second;
861 
862  stream.dqm_paths[pid].active_time->Fill(pathinfo.index, pathinfo.time_active * 1000.);
864  pathinfo.dqm_active->Fill(pathinfo.time_active * 1000.);
865 
866  stream.dqm_paths[pid].exclusive_time->Fill(pathinfo.index, pathinfo.time_exclusive * 1000.);
868  pathinfo.dqm_exclusive->Fill(pathinfo.time_exclusive * 1000.);
869 
870  stream.dqm_paths[pid].total_time->Fill(pathinfo.index, pathinfo.time_total * 1000.);
872  pathinfo.dqm_total->Fill(pathinfo.time_total * 1000.);
873 
874  // fill path overhead histograms
876  pathinfo.dqm_premodules ->Fill(pathinfo.time_premodules * 1000.);
877  pathinfo.dqm_intermodules->Fill(pathinfo.time_intermodules * 1000.);
878  pathinfo.dqm_postmodules ->Fill(pathinfo.time_postmodules * 1000.);
879  pathinfo.dqm_overhead ->Fill(pathinfo.time_overhead * 1000.);
880  }
881 
882  // fill detailed timing histograms
884  for (uint32_t i = 0; i < pathinfo.last_run; ++i) {
885  ModuleInfo * module = pathinfo.modules[i];
886  // skip duplicate modules
887  if (module == nullptr)
888  continue;
889  // fill the total time for all non-duplicate modules
890  pathinfo.dqm_module_total->Fill(i, module->time_active * 1000.);
891  // fill the active time only for module that have actually run in this path
892  if (module->run_in_path == & pathinfo)
893  pathinfo.dqm_module_active->Fill(i, module->time_active * 1000.);
894  }
895  }
896 
897  // fill path counter histograms
898  // - also for duplicate modules, to properly extract rejection information
899  // - fill the N+1th bin for paths accepting the event, so the FastTimerServiceClient can properly measure the last filter efficiency
901  for (uint32_t i = 0; i < pathinfo.last_run; ++i)
902  pathinfo.dqm_module_counter->Fill(i);
903  if (pathinfo.accept)
904  pathinfo.dqm_module_counter->Fill(pathinfo.modules.size());
905  }
906 
907  }
908  }
909 
910  // fill plots for per-event time by module
911  // note: this is done only for the last subprocess, to avoid filling the same plots multiple times
912  if ((m_enable_dqm_bymodule) and (pid+1 == m_process.size())) {
913  for (auto & keyval : stream.modules) {
914  ModuleInfo & module = keyval.second;
915  module.dqm_active->Fill(module.time_active * 1000.);
916  }
917  }
918 
919  // fill plots for per-event time by module type
920  // note: this is done only for the last subprocess, to avoid filling the same plots multiple times
921  if ((m_enable_dqm_bymoduletype) and (pid+1 == m_process.size())) {
922  for (auto & keyval : stream.moduletypes) {
923  ModuleInfo & module = keyval.second;
924  module.dqm_active->Fill(module.time_active * 1000.);
925  }
926  }
927 
928  // fill the interpath overhead plot
930  for (unsigned int i = 0; i <= stream.paths[pid].size(); ++i)
931  stream.dqm_paths[pid].interpaths->Fill(i, stream.timing_perprocess[pid].paths_interpaths[i] * 1000.);
932 
933  if (m_enable_dqm_summary) {
934  if (pid+1 == m_process.size())
935  stream.dqm.fill(stream.timing);
936  stream.dqm_perprocess[pid].fill(stream.timing_perprocess[pid]);
937  }
938 
939  if (not m_dqm_luminosity.empty()) {
940  if (pid+1 == m_process.size())
941  for (unsigned int i = 0; i < m_dqm_luminosity.size(); ++i)
942  stream.dqm_byluminosity[i].fill(stream.luminosity[i], stream.timing);
943  for (unsigned int i = 0; i < m_dqm_luminosity.size(); ++i)
944  stream.dqm_perprocess_byluminosity[pid][i].fill(stream.luminosity[i], stream.timing_perprocess[pid]);
945  }
946 
947 }
948 
950  auto & stream = m_stream[sid];
951 
952  // clear the event counters
953  stream.timing.reset();
954  stream.timer_source.start();
955 
956  // clear the event counters
957  // note: this is done here and not in preEvent to avoid clearing the counter before each subprocess
958  for (auto & keyval : stream.modules) {
959  keyval.second.timer.reset();
960  keyval.second.time_active = 0.;
961  keyval.second.run_in_path = nullptr;
962  keyval.second.counter = 0;
963  }
964  for (auto & keyval : stream.moduletypes) {
965  keyval.second.timer.reset();
966  keyval.second.time_active = 0.;
967  keyval.second.run_in_path = nullptr;
968  keyval.second.counter = 0;
969  }
970 
971  // account the time spent before the source
972  stream.timing.presource = delta(stream.timer_last_transition, stream.timer_source.getStartTime());
973 }
974 
976  auto & stream = m_stream[sid];
977  stream.timer_source.stop();
978  stream.timer_last_transition = stream.timer_source.getStopTime();
979 
980  // account the time spent in the source
981  stream.timing.source = stream.timer_source.seconds();
982 }
983 
984 
986  std::string const & path = pc.pathName();
987  unsigned int pid = processID(sc.processContext());
988  unsigned int sid = sc.streamID();
989  auto & stream = m_stream[sid];
990 
991  auto keyval = stream.paths[pid].find(path);
992  if (keyval != stream.paths[pid].end()) {
993  stream.current_path = & keyval->second;
994  } else {
995  // should never get here
996  stream.current_path = nullptr;
997  edm::LogError("FastTimerService") << "FastTimerService::prePathEvent: unexpected path " << path;
998  return;
999  }
1000 
1001  // prepare to measure the time spent between the beginning of the path and the execution of the first module
1002  stream.current_path->first_module = nullptr;
1003 
1004  // time each (end)path
1005  stream.current_path->timer.start();
1006 
1007  if (path == m_process[pid].first_path) {
1008  // this is the first path, start the "all paths" counter
1009  stream.timer_paths.setStartTime(stream.current_path->timer.getStartTime());
1010  } else if (path == m_process[pid].first_endpath) {
1011  // this is the first endpath, start the "all paths" counter
1012  stream.timer_endpaths.setStartTime(stream.current_path->timer.getStartTime());
1013  }
1014 
1015  // measure the inter-path overhead as the time elapsed since the end of preiovus path
1016  // (or the beginning of the event, if this is the first path - see preEvent)
1017  double interpaths = delta(stream.timer_last_path, stream.current_path->timer.getStartTime());
1018  stream.timing_perprocess[pid].interpaths += interpaths;
1019  stream.timing_perprocess[pid].paths_interpaths[stream.current_path->index] = interpaths;
1020 }
1021 
1022 
1024  std::string const & path = pc.pathName();
1025  unsigned int pid = processID(sc.processContext());
1026  unsigned int sid = sc.streamID().value();
1027  auto & stream = m_stream[sid];
1028 
1029  if (stream.current_path == nullptr) {
1030  edm::LogError("FastTimerService") << "FastTimerService::postPathEvent: unexpected path " << path;
1031  return;
1032  }
1033 
1034  // time each (end)path
1035  stream.current_path->timer.stop();
1036  stream.current_path->time_active = stream.current_path->timer.seconds();
1037  stream.timer_last_path = stream.current_path->timer.getStopTime();
1038 
1039  double active = stream.current_path->time_active;
1040 
1041  // if enabled, account each (end)path
1042  if (m_enable_timing_paths) {
1043 
1044  PathInfo & pathinfo = * stream.current_path;
1045  pathinfo.summary_active += active;
1046 
1047  // measure the time spent between the execution of the last module and the end of the path
1049  double pre = 0.; // time spent before the first active module
1050  double inter = 0.; // time spent between active modules
1051  double post = 0.; // time spent after the last active module
1052  double overhead = 0.; // time spent before, between, or after modules
1053  double current = 0.; // time spent in modules active in the current path
1054  double total = active; // total per-path time, including modules already run as part of other paths
1055 
1056  // implementation note:
1057  // "active" has already measured all the time spent in this path
1058  // "current" will be the sum of the time spent inside each module while running this path, so that
1059  // "overhead" will be active - current
1060  // "total" will be active + the sum of the time spent in non-active modules
1061 
1062  uint32_t last_run = 0; // index of the last module run in this path, plus one
1063  if (status.wasrun() and not pathinfo.modules.empty())
1064  last_run = status.index() + 1; // index of the last module run in this path, plus one
1065  for (uint32_t i = 0; i < last_run; ++i) {
1066  ModuleInfo * module = pathinfo.modules[i];
1067 
1068  if (module == 0)
1069  // this is a module occurring more than once in the same path, skip it after the first occurrence
1070  continue;
1071 
1072  ++module->counter;
1073  if (module->run_in_path == & pathinfo) {
1074  current += module->time_active;
1075  } else {
1076  total += module->time_active;
1077  }
1078 
1079  }
1080 
1081  if (stream.current_path->first_module == nullptr) {
1082  // no modules were active during this path, account all the time as overhead
1083  pre = 0.;
1084  inter = 0.;
1085  post = active;
1086  overhead = active;
1087  } else {
1088  // extract overhead information
1089  pre = delta(stream.current_path->timer.getStartTime(), stream.current_path->first_module->timer.getStartTime());
1090  post = delta(stream.current_module->timer.getStopTime(), stream.current_path->timer.getStopTime());
1091  inter = active - pre - current - post;
1092  // take care of numeric precision and rounding errors - the timer is less precise than nanosecond resolution
1093  if (std::abs(inter) < 1e-9)
1094  inter = 0.;
1095  overhead = active - current;
1096  // take care of numeric precision and rounding errors - the timer is less precise than nanosecond resolution
1097  if (std::abs(overhead) < 1e-9)
1098  overhead = 0.;
1099  }
1100 
1101  pathinfo.time_premodules = pre;
1102  pathinfo.time_intermodules = inter;
1103  pathinfo.time_postmodules = post;
1104  pathinfo.time_overhead = overhead;
1105  pathinfo.time_total = total;
1106  pathinfo.summary_premodules += pre;
1107  pathinfo.summary_intermodules += inter;
1108  pathinfo.summary_postmodules += post;
1109  pathinfo.summary_overhead += overhead;
1110  pathinfo.summary_total += total;
1111  pathinfo.last_run = last_run;
1112  pathinfo.accept = status.accept();
1113  }
1114  }
1115 
1116  if (path == m_process[pid].last_path) {
1117  // this is the last path, stop and account the "all paths" counter
1118  stream.timer_paths.setStopTime(stream.current_path->timer.getStopTime());
1119  stream.timing_perprocess[pid].all_paths = stream.timer_paths.seconds();
1120  } else if (path == m_process[pid].last_endpath) {
1121  // this is the last endpath, stop and account the "all endpaths" counter
1122  stream.timer_endpaths.setStopTime(stream.current_path->timer.getStopTime());
1123  stream.timing_perprocess[pid].all_endpaths = stream.timer_endpaths.seconds();
1124  }
1125 
1126 }
1127 
1129  // this is ever called only if m_enable_timing_modules = true
1131 
1132  if (mcc.moduleDescription() == nullptr) {
1133  edm::LogError("FastTimerService") << "FastTimerService::postModuleEventDelayedGet: invalid module";
1134  return;
1135  }
1136 
1137  edm::ModuleDescription const & md = * mcc.moduleDescription();
1138  unsigned int sid = sc.streamID().value();
1139  auto & stream = m_stream[sid];
1140 
1141  // time each module
1142  if (md.id() < stream.fast_modules.size()) {
1143  ModuleInfo & module = * stream.fast_modules[md.id()];
1144  module.run_in_path = stream.current_path;
1145  module.timer.start();
1146  stream.current_module = & module;
1147  // used to measure the time spent between the beginning of the path and the execution of the first module
1148  if (stream.current_path->first_module == nullptr)
1149  stream.current_path->first_module = & module;
1150  } else {
1151  // should never get here
1152  edm::LogError("FastTimerService") << "FastTimerService::preModuleEvent: unexpected module " << md.moduleLabel();
1153  }
1154 }
1155 
1157  // this is ever called only if m_enable_timing_modules = true
1159 
1160  if (mcc.moduleDescription() == nullptr) {
1161  edm::LogError("FastTimerService") << "FastTimerService::postModuleEventDelayedGet: invalid module";
1162  return;
1163  }
1164 
1165  edm::ModuleDescription const & md = * mcc.moduleDescription();
1166  unsigned int sid = sc.streamID().value();
1167  auto & stream = m_stream[sid];
1168 
1169  double active = 0.;
1170 
1171  // time and account each module
1172  if (md.id() < stream.fast_modules.size()) {
1173  ModuleInfo & module = * stream.fast_modules[md.id()];
1174  module.timer.stop();
1175  active = module.timer.seconds();
1176  module.time_active = active;
1177  module.summary_active += active;
1178  // plots are filled post event processing
1179  } else {
1180  // should never get here
1181  edm::LogError("FastTimerService") << "FastTimerService::postModuleEvent: unexpected module " << md.moduleLabel();
1182  }
1183 }
1184 
1186  // this is ever called only if m_enable_timing_modules = true
1188 
1189  if (mcc.moduleDescription() == nullptr) {
1190  edm::LogError("FastTimerService") << "FastTimerService::postModuleEventDelayedGet: invalid module";
1191  return;
1192  }
1193 
1194  edm::ModuleDescription const & md = * mcc.moduleDescription();
1195  unsigned int sid = sc.streamID().value();
1196  auto & stream = m_stream[sid];
1197 
1198  // if the ModuleCallingContext state is "Pefetching", the module is not running,
1199  // and is asking for its dependencies due to a "consumes" declaration.
1200  // we can ignore this signal.
1201 
1202  // if the ModuleCallingContext state is "Running", the module was running:
1203  // it declared its dependencies as "mayConsume", and is now calling getByToken/getByLabel.
1204  // we pause the timer for this module, and resume it later in the postModuleEventDelayedGet signal.
1205 
1206  // if the ModuleCallingContext state is "Invalid", we ignore the signal.
1207 
1209  if (md.id() < stream.fast_modules.size()) {
1210  ModuleInfo & module = * stream.fast_modules[md.id()];
1211  module.timer.pause();
1212  } else {
1213  // should never get here
1214  edm::LogError("FastTimerService") << "FastTimerService::preModuleEventDelayedGet: unexpected module " << md.moduleLabel();
1215  }
1216  }
1217 
1218 }
1219 
1221  // this is ever called only if m_enable_timing_modules = true
1223 
1224  if (mcc.moduleDescription() == nullptr) {
1225  edm::LogError("FastTimerService") << "FastTimerService::postModuleEventDelayedGet: invalid module";
1226  return;
1227  }
1228 
1229  edm::ModuleDescription const & md = * mcc.moduleDescription();
1230  unsigned int sid = sc.streamID().value();
1231  auto & stream = m_stream[sid];
1232 
1233  // see the description of the possible ModuleCallingContext states in preModuleEventDelayedGet, above.
1235  if (md.id() < stream.fast_modules.size()) {
1236  ModuleInfo & module = * stream.fast_modules[md.id()];
1237  module.timer.resume();
1238  } else {
1239  // should never get here
1240  edm::LogError("FastTimerService") << "FastTimerService::postModuleEventDelayedGet: unexpected module " << md.moduleLabel();
1241  }
1242  }
1243 
1244 }
1245 
1246 // associate to a path all the modules it contains
1247 void FastTimerService::fillPathMap(unsigned int pid, std::string const & name, std::vector<std::string> const & modules) {
1248  for (auto & stream: m_stream) {
1249 
1250  std::vector<ModuleInfo *> & pathmap = stream.paths[pid][name].modules;
1251  pathmap.clear();
1252  pathmap.reserve( modules.size() );
1253  std::unordered_set<ModuleInfo const *> pool; // keep track of inserted modules
1254  for (auto const & module: modules) {
1255  // fix the name of negated or ignored modules
1256  std::string const & label = (module[0] == '!' or module[0] == '-') ? module.substr(1) : module;
1257 
1258  auto const & it = stream.modules.find(label);
1259  if (it == stream.modules.end()) {
1260  // no matching module was found
1261  pathmap.push_back( 0 );
1262  } else if (pool.insert(& it->second).second) {
1263  // new module
1264  pathmap.push_back(& it->second);
1265  } else {
1266  // duplicate module
1267  pathmap.push_back( 0 );
1268  }
1269  }
1270 
1271  }
1272 }
1273 
1274 // find the first and last non-empty paths, optionally skipping the first one
1275 std::pair<std::string,std::string> FastTimerService::findFirstLast(unsigned int pid, std::vector<std::string> const & paths, bool skip) {
1276  std::vector<std::string const *> p(paths.size(), nullptr);
1277 
1278  // mark the empty paths
1279  auto address_if_non_empty = [&](std::string const & name){
1280  return m_stream.front().paths[pid][name].modules.empty() ? nullptr : & name;
1281  };
1282  std::transform(paths.begin(), paths.end(), p.begin(), address_if_non_empty);
1283 
1284  // optionally, skip the first path
1285  if (skip and not p.empty())
1286  p.erase(p.begin());
1287 
1288  // remove the empty paths
1289  p.erase(std::remove(p.begin(), p.end(), nullptr), p.end());
1290 
1291  // return the first and last non-empty paths, if there are any
1292  if (not p.empty())
1293  return std::make_pair(* p.front(), * p.back());
1294  else
1295  return std::make_pair(std::string(), std::string());
1296 }
1297 
1298 // query the current module/path/event
1299 // Note: these functions incur in a "per-call timer overhead" (see above), currently of the order of 340ns
1300 
1301 // return the time spent since the last preModuleEvent() event
1303  return m_stream[sid].current_module->timer.secondsUntilNow();
1304 }
1305 
1306 // return the time spent since the last prePathEvent() event
1308  return m_stream[sid].current_path->timer.secondsUntilNow();
1309 }
1310 
1311 // return the time spent since the last preEvent() event
1313  return m_stream[sid].timer_event.secondsUntilNow();
1314 }
1315 
1316 // query the time spent in a module (available after the module has run)
1318  if (module.id() < m_stream[sid].fast_modules.size()) {
1319  return m_stream[sid].fast_modules[module.id()]->time_active;
1320  } else {
1321  edm::LogError("FastTimerService") << "FastTimerService::queryModuleTime: unexpected module " << module.moduleLabel();
1322  return 0.;
1323  }
1324 }
1325 
1326 // query the time spent in a module (available after the module has run)
1327 double FastTimerService::queryModuleTime(edm::StreamID sid, unsigned int id) const {
1328  if (id < m_stream[sid].fast_modules.size()) {
1329  return m_stream[sid].fast_modules[id]->time_active;
1330  } else {
1331  edm::LogError("FastTimerService") << "FastTimerService::queryModuleTime: unexpected module id " << id;
1332  return 0.;
1333  }
1334 }
1335 
1336 // query the time spent in a module (available after the module has run)
1338  auto const & keyval = m_stream[sid].modules.find(label);
1339  if (keyval != m_stream[sid].modules.end()) {
1340  return keyval->second.time_active;
1341  } else {
1342  // module not found
1343  edm::LogError("FastTimerService") << "FastTimerService::queryModuleTimeByLabel: unexpected module " << label;
1344  return 0.;
1345  }
1346 }
1347 
1348 // query the time spent in a type of module (available after the module has run)
1350  auto const & keyval = m_stream[sid].moduletypes.find(type);
1351  if (keyval != m_stream[sid].moduletypes.end()) {
1352  return keyval->second.time_active;
1353  } else {
1354  // module not found
1355  edm::LogError("FastTimerService") << "FastTimerService::queryModuleTimeByType: unexpected module type " << type;
1356  return 0.;
1357  }
1358 }
1359 
1360 /* FIXME re-implement taking into account subprocesses
1361 // query the time spent in a path (available after the path has run)
1362 double FastTimerService::queryPathActiveTime(edm::StreamID sid, const std::string & path) const {
1363  PathMap<PathInfo>::const_iterator keyval = m_stream[sid].paths.find(path);
1364  if (keyval != m_stream[sid].paths.end()) {
1365  return keyval->second.time_active;
1366  } else {
1367  edm::LogError("FastTimerService") << "FastTimerService::queryPathActiveTime: unexpected path " << path;
1368  return 0.;
1369  }
1370 }
1371 
1372 // query the time spent in a path (available after the path has run)
1373 double FastTimerService::queryPathExclusiveTime(edm::StreamID sid, const std::string & path) const {
1374  PathMap<PathInfo>::const_iterator keyval = m_stream[sid].paths.find(path);
1375  if (keyval != m_stream[sid].paths.end()) {
1376  return keyval->second.time_exclusive;
1377  } else {
1378  edm::LogError("FastTimerService") << "FastTimerService::queryPathExclusiveTime: unexpected path " << path;
1379  return 0.;
1380  }
1381 }
1382 
1383 // query the total time spent in a path (available after the path has run)
1384 double FastTimerService::queryPathTotalTime(edm::StreamID sid, const std::string & path) const {
1385  PathMap<PathInfo>::const_iterator keyval = m_stream[sid].paths.find(path);
1386  if (keyval != m_stream[sid].paths.end()) {
1387  return keyval->second.time_total;
1388  } else {
1389  edm::LogError("FastTimerService") << "FastTimerService::queryPathTotalTime: unexpected path " << path;
1390  return 0.;
1391  }
1392 }
1393 */
1394 
1395 // query the time spent in the current event's source (available during event processing)
1397  return m_stream[sid].timing.source;
1398 }
1399 
1400 // query the time spent processing the current event (available after the event has been processed)
1402  return m_stream[sid].timing.event;
1403 }
1404 
1405 /* FIXME re-implement taking into account subprocesses
1406 // query the time spent in the current event's paths (available during endpaths)
1407 double FastTimerService::queryPathsTime(edm::StreamID sid) const {
1408  return m_stream[sid].timing.all_paths;
1409 }
1410 
1411 // query the time spent in the current event's endpaths (available after all endpaths have run)
1412 double FastTimerService::queryEndPathsTime(edm::StreamID sid) const {
1413  return m_stream[sid].timing.all_endpaths;
1414 }
1415 */
1416 
1417 // describe the module's configuration
1420  desc.addUntracked<bool>( "useRealTimeClock", true);
1421  desc.addUntracked<bool>( "enableTimingPaths", true);
1422  desc.addUntracked<bool>( "enableTimingModules", true);
1423  desc.addUntracked<bool>( "enableTimingExclusive", false);
1424  desc.addUntracked<bool>( "enableTimingSummary", false);
1425  desc.addUntracked<bool>( "skipFirstPath", false),
1426  desc.addUntracked<bool>( "enableDQM", true);
1427  desc.addUntracked<bool>( "enableDQMbyPathActive", false);
1428  desc.addUntracked<bool>( "enableDQMbyPathTotal", true);
1429  desc.addUntracked<bool>( "enableDQMbyPathOverhead", false);
1430  desc.addUntracked<bool>( "enableDQMbyPathDetails", false);
1431  desc.addUntracked<bool>( "enableDQMbyPathCounters", true);
1432  desc.addUntracked<bool>( "enableDQMbyPathExclusive", false);
1433  desc.addUntracked<bool>( "enableDQMbyModule", false);
1434  desc.addUntracked<bool>( "enableDQMbyModuleType", false);
1435  desc.addUntracked<bool>( "enableDQMSummary", false);
1436  desc.addUntracked<bool>( "enableDQMbyLumiSection", false);
1437  desc.addUntracked<bool>( "enableDQMbyProcesses", false);
1438  desc.addUntracked<double>( "dqmTimeRange", 1000. ); // ms
1439  desc.addUntracked<double>( "dqmTimeResolution", 5. ); // ms
1440  desc.addUntracked<double>( "dqmPathTimeRange", 100. ); // ms
1441  desc.addUntracked<double>( "dqmPathTimeResolution", 0.5); // ms
1442  desc.addUntracked<double>( "dqmModuleTimeRange", 40. ); // ms
1443  desc.addUntracked<double>( "dqmModuleTimeResolution", 0.2); // ms
1444  desc.addUntracked<uint32_t>( "dqmLumiSectionsRange", 2500 ); // ~ 16 hours
1445  desc.addUntracked<std::string>( "dqmPath", "HLT/TimerService");
1446  descriptions.add("FastTimerService", desc);
1447 }
1448 
1449 // assign a "process id" to a process, given its ProcessContext
1451 {
1452  unsigned int pid = 0;
1453 
1454  // iterate through the chain of ProcessContext until we reach the topmost process
1455  while (context->isSubProcess()) {
1456  context = & context->parentProcessContext();
1457  ++pid;
1458  }
1459  return pid;
1460 }
RunNumber_t run() const
Definition: EventID.h:39
void preGlobalBeginRun(edm::GlobalContext const &)
void preModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &)
std::string const & pathName() const
Definition: PathContext.h:37
type
Definition: HCALResponse.h:21
unsigned int maxNumberOfThreads() const
Definition: SystemBounds.h:46
T getUntrackedParameter(std::string const &, T const &) const
void postStreamBeginRun(edm::StreamContext const &)
void watchPreEvent(PreEvent::slot_type const &iSlot)
double queryEventTime(edm::StreamID) const
int i
Definition: DBlmapReader.cc:9
const double m_dqm_eventtime_resolution
Strings const & getTrigPathModules(std::string const &name) const
void postStreamEndLumi(edm::StreamContext const &)
std::string const & processName() const
std::string const & getTrigPath(size_type const i) const
void watchPrePathEvent(PrePathEvent::slot_type const &iSlot)
void watchPreallocate(Preallocate::slot_type const &iSlot)
static double delta(FastTimer::Clock::time_point const &first, FastTimer::Clock::time_point const &second)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
Strings const & getEndPaths() const
void resume()
Definition: FastTimer.cc:51
unsigned int m_concurrent_streams
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
bool wasrun() const
was this path run?
Definition: HLTPathStatus.h:60
static boost::mutex mutex
Definition: LHEProxy.cc:11
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
tuple rid
Histograms Source for live online DQM in P5
const bool m_enable_dqm_bypath_counters
const bool m_skip_first_path
void watchPostEvent(PostEvent::slot_type const &iSlot)
assert(m_qm.get())
const bool m_enable_dqm_bypath_exclusive
LuminosityBlockID const & luminosityBlockID() const
Definition: GlobalContext.h:52
void printSummary(Timing const &summary, std::string const &label) const
std::vector< ProcessDescription > m_process
void watchPostStreamEndLumi(PostStreamEndLumi::slot_type const &iSlot)
const double m_dqm_pathtime_range
std::string const & moduleName() const
void watchPostPathEvent(PostPathEvent::slot_type const &iSlot)
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
double currentPathTime(edm::StreamID) const
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
std::vector< TimingPerProcess > m_job_summary_perprocess
RunIndex const & runIndex() const
Definition: StreamContext.h:60
string format
Some error handling for the usage.
void postPathEvent(edm::StreamContext const &, edm::PathContext const &, edm::HLTPathStatus const &)
unsigned int m_concurrent_threads
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
std::string const & moduleLabel() const
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription&#39;s constructor&#39;s modI...
std::string m_dqm_path
ProcessContext const & parentProcessContext() const
unsigned int m_concurrent_runs
void postStreamBeginLumi(edm::StreamContext const &)
RunIndex const & runIndex() const
Definition: GlobalContext.h:53
unsigned int maxNumberOfStreams() const
Definition: SystemBounds.h:43
void preModuleBeginJob(edm::ModuleDescription const &)
const bool m_enable_dqm_bynproc
Strings const & getEndPathModules(std::string const &name) const
size_type findTrigPath(std::string const &name) const
std::vector< LuminosityDescription > m_dqm_luminosity
unsigned int m_module_id
void prePathEvent(edm::StreamContext const &, edm::PathContext const &)
void stop()
Definition: FastTimer.cc:29
const bool m_enable_dqm_byls
void watchPostStreamBeginLumi(PostStreamBeginLumi::slot_type const &iSlot)
const double m_dqm_moduletime_resolution
std::mutex m_summary_mutex
void pause()
Definition: FastTimer.cc:40
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
FastTimerService(const edm::ParameterSet &, edm::ActivityRegistry &)
double queryModuleTimeByLabel(edm::StreamID, const std::string &) const
double currentEventTime(edm::StreamID) const
void watchPreModuleEventDelayedGet(PreModuleEventDelayedGet::slot_type const &iSlot)
void postEvent(edm::StreamContext const &)
void postGlobalEndRun(edm::GlobalContext const &)
void setLuminosity(unsigned int stream_id, unsigned int luminosity_id, double value)
ModuleDescription const * moduleDescription() const
std::vector< std::vector< TimingPerProcess > > m_run_summary_perprocess
const double infinity
void postStreamEndRun(edm::StreamContext const &)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
RunNumber_t run() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double seconds() const
Definition: FastTimer.cc:75
const bool m_enable_dqm_bypath_details
std::vector< Timing > m_run_summary
void fillPathMap(unsigned int pid, std::string const &name, std::vector< std::string > const &modules)
ProcessContext const * processContext() const
Definition: StreamContext.h:63
const bool m_enable_dqm_bypath_overhead
size_type findEndPath(std::string const &name) const
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void watchPostStreamEndRun(PostStreamEndRun::slot_type const &iSlot)
void mergeAndResetMEsRunSummaryCache(uint32_t run, uint32_t streamId, uint32_t moduleId)
Definition: DQMStore.cc:359
StreamID const & streamID() const
Definition: StreamContext.h:57
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
const bool m_enable_dqm_bymodule
void postModuleEventDelayedGet(edm::StreamContext const &, edm::ModuleCallingContext const &)
const double m_dqm_moduletime_range
unsigned int value() const
Definition: StreamID.h:46
void watchPostModuleEventDelayedGet(PostModuleEventDelayedGet::slot_type const &iSlot)
double querySourceTime(edm::StreamID) const
int inter
tuple pid
Definition: sysUtil.py:22
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
void preSourceEvent(edm::StreamID)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void preEvent(edm::StreamContext const &)
const bool m_enable_timing_summary
bool accept() const
has this path accepted the event?
Definition: HLTPathStatus.h:62
ProcessContext const * processContext() const
Definition: GlobalContext.h:56
void postSourceEvent(edm::StreamID)
const bool m_enable_dqm_bymoduletype
const bool m_enable_dqm_summary
void watchPostStreamBeginRun(PostStreamBeginRun::slot_type const &iSlot)
double queryModuleTimeByType(edm::StreamID, const std::string &) const
std::string const & getEndPath(size_type const i) const
const bool m_enable_dqm_bypath_total
void watchPreStreamBeginRun(PreStreamBeginRun::slot_type const &iSlot)
Strings const & getTrigPaths() const
double queryModuleTime(edm::StreamID, const edm::ModuleDescription &) const
const bool m_enable_dqm_bypath_active
unsigned int maxNumberOfConcurrentRuns() const
Definition: SystemBounds.h:44
std::vector< ModuleInfo * > modules
EventID const & eventID() const
Definition: StreamContext.h:59
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
static Interceptor::Registry registry("Interceptor")
tuple process
Definition: LaserDQM_cfg.py:3
static unsigned int processID(edm::ProcessContext const *)
double currentModuleTime(edm::StreamID) const
void mergeAndResetMEsLuminositySummaryCache(uint32_t run, uint32_t lumi, uint32_t streamId, uint32_t moduleId)
Definition: DQMStore.cc:430
void preStreamBeginRun(edm::StreamContext const &)
std::vector< StreamData > m_stream
bool isSubProcess() const
Definition: vlib.h:208
tuple size
Write out results.
unsigned int reserveLuminosityPlots(std::string const &name, std::string const &title, std::string const &label, double range, double resolution)
void printProcessSummary(Timing const &total, TimingPerProcess const &summary, std::string const &label, std::string const &process) const
void preallocate(edm::service::SystemBounds const &)
unsigned int id() const
std::pair< std::string, std::string > findFirstLast(unsigned int pid, std::vector< std::string > const &paths, bool skip=false)
tuple status
Definition: mps_update.py:57
const double m_dqm_eventtime_range
const double m_dqm_pathtime_resolution
unsigned int index() const
Definition: HLTPathStatus.h:55
void start()
Definition: FastTimer.cc:17