CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimerService.cc
Go to the documentation of this file.
2 #include <iostream>
3 
5 
8 {
9  // whether to use CPU-time (default) or wall-clock time
10  useCPUtime = ps.getUntrackedParameter<bool>("useCPUtime", true);
11 
14 
15  if(!cpu_timer)
16  cpu_timer = new edm::CPUTimer();
17 
18 }
19 
21 {
22  if(cpu_timer){
23  using namespace std;
24 
25  string longLine("==========================================================");
26  cout << longLine << endl;
27  cout << " TimerService Info:\n";
28 
29  if(useCPUtime)
30  cout << " Used CPU-time ";
31  else
32  cout << " Used wall-clock-time ";
33  cout << "for timing information " << endl;
34  cout << longLine << endl;
35 
36  delete cpu_timer; cpu_timer = 0;
37  }
38 }
39 
40 // fwk calls this method before a module is processed
42 {
43  cpu_timer->reset();
44  cpu_timer->start();
45 }
46 
47 // fwk calls this method after a module has been processed
49 {
50  cpu_timer->stop();
51 
52  double time = -999; // in secs
53  if(useCPUtime)
54  time = cpu_timer->cpuTime();
55  else
56  time = cpu_timer->realTime();
57 
58  newMeasurementSignal(iMod, time);
59 }
void postModule(const edm::ModuleDescription &iMod)
Definition: TimerService.cc:48
T getUntrackedParameter(std::string const &, T const &) const
void preModule(const edm::ModuleDescription &iMod)
Definition: TimerService.cc:41
void start()
Definition: CPUTimer.cc:74
void watchPostModule(PostModule::slot_type const &iSlot)
void reset()
Definition: CPUTimer.cc:107
void watchPreModule(PreModule::slot_type const &iSlot)
TimerService(const edm::ParameterSet &, edm::ActivityRegistry &iAR)
Definition: TimerService.cc:6
Times stop()
Definition: CPUTimer.cc:94
double cpuTime() const
Definition: CPUTimer.cc:157
static edm::CPUTimer * cpu_timer
Definition: TimerService.h:39
sigc::signal< void, const edm::ModuleDescription &, double > newMeasurementSignal
Definition: TimerService.h:30
tuple cout
Definition: gather_cfg.py:41
double realTime() const
Definition: CPUTimer.cc:149