CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Tracer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Services
4 // Class : Tracer
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Sep 8 14:17:58 EDT 2005
11 //
12 
13 // user include files
15 
21 
24 
25 // system include files
26 #include <iostream>
27 
28 using namespace edm::service;
29 //
30 // constants, enums and typedefs
31 //
32 
33 //
34 // static data member definitions
35 //
36 
37 //
38 // constructors and destructor
39 //
41  indention_(iPS.getUntrackedParameter<std::string>("indention")),
42  depth_(0) {
43  iRegistry.watchPostBeginJob(this, &Tracer::postBeginJob);
44  iRegistry.watchPostEndJob(this, &Tracer::postEndJob);
45 
46  iRegistry.watchPreModule(this, &Tracer::preModuleEvent);
47  iRegistry.watchPostModule(this, &Tracer::postModuleEvent);
48 
51 
54 
57 
60 
63 
66 
69 
72 
73  iRegistry.watchPreProcessPath(this, &Tracer::prePathEvent);
75 
78 
79  iRegistry.watchPrePathEndRun(this, &Tracer::prePathEndRun);
81 
84 
87 
88  iRegistry.watchPreProcessEvent(this, &Tracer::preEvent);
89  iRegistry.watchPostProcessEvent(this, &Tracer::postEvent);
90 
91  iRegistry.watchPreBeginRun(this, &Tracer::preBeginRun);
92  iRegistry.watchPostBeginRun(this, &Tracer::postBeginRun);
93 
94  iRegistry.watchPreEndRun(this, &Tracer::preEndRun);
95  iRegistry.watchPostEndRun(this, &Tracer::postEndRun);
96 
97  iRegistry.watchPreBeginLumi(this, &Tracer::preBeginLumi);
98  iRegistry.watchPostBeginLumi(this, &Tracer::postBeginLumi);
99 
100  iRegistry.watchPreEndLumi(this, &Tracer::preEndLumi);
101  iRegistry.watchPostEndLumi(this, &Tracer::postEndLumi);
102 
103  iRegistry.watchPreSource(this, &Tracer::preSourceEvent);
104  iRegistry.watchPostSource(this, &Tracer::postSourceEvent);
105 
106  iRegistry.watchPreOpenFile(this, &Tracer::preOpenFile);
107  iRegistry.watchPostOpenFile(this, &Tracer::postOpenFile);
108 
109  iRegistry.watchPreCloseFile(this, &Tracer::preCloseFile);
110  iRegistry.watchPostCloseFile(this, &Tracer::postCloseFile);
111 
112  iRegistry.watchPreSourceRun(this, &Tracer::preSourceRun);
113  iRegistry.watchPostSourceRun(this, &Tracer::postSourceRun);
114 
115  iRegistry.watchPreSourceLumi(this, &Tracer::preSourceLumi);
117 
118 }
119 
120 // Tracer::Tracer(Tracer const& rhs)
121 // {
122 // // do actual copying here;
123 // }
124 
125 //Tracer::~Tracer()
126 //{
127 //}
128 
129 void
131 
133  desc.addUntracked<std::string>("indention", "++")->setComment("Prefix characters for output. The characters are repeated to form the indentation.");
134  descriptions.add("Tracer", desc);
135  descriptions.setComment("This service prints each phase the framework is processing, e.g. constructing a module,running a module, etc.");
136 }
137 
138 //
139 // assignment operators
140 //
141 // Tracer const& Tracer::operator=(Tracer const& rhs)
142 // {
143 // //An exception safe implementation is
144 // Tracer temp(rhs);
145 // swap(rhs);
146 //
147 // return *this;
148 // }
149 
150 //
151 // member functions
152 //
153 void
155  std::cout << indention_ << " Job started" << std::endl;
156 }
157 void
159  std::cout << indention_ << " Job ended" << std::endl;
160 }
161 
162 void
164  std::cout << indention_ << indention_ << "source event" << std::endl;
165 }
166 void
168  std::cout << indention_ << indention_ << "finished: source event" << std::endl;
169 }
170 
171 void
173  std::cout << indention_ << indention_ << "source lumi" << std::endl;
174 }
175 void
177  std::cout << indention_ << indention_ << "finished: source lumi" << std::endl;
178 }
179 
180 void
182  std::cout << indention_ << indention_ << "source run" << std::endl;
183 }
184 void
186  std::cout << indention_ << indention_ << "finished: source run" << std::endl;
187 }
188 
189 void
191  std::cout << indention_ << indention_ << "open input file" << std::endl;
192 }
193 void
195  std::cout << indention_ << indention_ << "finished: open input file" << std::endl;
196 }
197 
198 void
200  std::cout << indention_ << indention_ << "close input file" << std::endl;
201 }
202 void
204  std::cout << indention_ << indention_ << "finished: close input file" << std::endl;
205 }
206 
207 void
208 Tracer::preEvent(EventID const& iID, Timestamp const& iTime) {
209  depth_=0;
210  std::cout << indention_ << indention_ << " processing event:" << iID << " time:" << iTime.value() << std::endl;
211 }
212 void
214  std::cout << indention_ << indention_ << " finished event:" << std::endl;
215 }
216 
217 void
218 Tracer::prePathEvent(std::string const& iName) {
219  std::cout << indention_ << indention_ << indention_ << " processing path for event:" << iName << std::endl;
220 }
221 void
222 Tracer::postPathEvent(std::string const& iName, HLTPathStatus const&) {
223  std::cout << indention_ << indention_ << indention_ << " finished path for event:" << iName << std::endl;
224 }
225 
226 void
228  ++depth_;
230  for(unsigned int depth = 0; depth !=depth_; ++depth) {
232  }
233  std::cout << " module for event:" << iDescription.moduleLabel() << std::endl;
234 }
235 void
237  --depth_;
239  for(unsigned int depth = 0; depth !=depth_; ++depth) {
241  }
242 
243  std::cout << " finished for event:" << iDescription.moduleLabel() << std::endl;
244 }
245 
246 void
247 Tracer::preBeginRun(RunID const& iID, Timestamp const& iTime) {
248  depth_=0;
249  std::cout << indention_ << indention_ << " processing begin run:" << iID << " time:" << iTime.value() << std::endl;
250 }
251 void
253  std::cout << indention_ << indention_ << " finished begin run:" << std::endl;
254 }
255 
256 void
257 Tracer::prePathBeginRun(std::string const& iName) {
258  std::cout << indention_ << indention_ << indention_ << " processing path for begin run:" << iName << std::endl;
259 }
260 void
261 Tracer::postPathBeginRun(std::string const& iName, HLTPathStatus const&) {
262  std::cout << indention_ << indention_ << indention_ << " finished path for begin run:" << iName << std::endl;
263 }
264 
265 void
267  ++depth_;
269  for(unsigned int depth = 0; depth !=depth_; ++depth) {
271  }
272  std::cout << " module for begin run:" << iDescription.moduleLabel() << std::endl;
273 }
274 void
276  --depth_;
278  for(unsigned int depth = 0; depth !=depth_; ++depth) {
280  }
281 
282  std::cout << " finished for begin run:" << iDescription.moduleLabel() << std::endl;
283 }
284 
285 void
286 Tracer::preEndRun(RunID const& iID, Timestamp const& iTime) {
287  depth_=0;
288  std::cout << indention_ << indention_ << " processing end run:" << iID << " time:" << iTime.value() << std::endl;
289 }
290 void
292  std::cout << indention_ << indention_ << " finished end run:" << std::endl;
293 }
294 
295 void
296 Tracer::prePathEndRun(std::string const& iName) {
297  std::cout << indention_ << indention_ << indention_ << " processing path for end run:" << iName << std::endl;
298 }
299 void
300 Tracer::postPathEndRun(std::string const& iName, HLTPathStatus const&) {
301  std::cout << indention_ << indention_ << indention_ << " finished path for end run:" << iName << std::endl;
302 }
303 
304 void
306  ++depth_;
308  for(unsigned int depth = 0; depth !=depth_; ++depth) {
310  }
311  std::cout << " module for end run:" << iDescription.moduleLabel() << std::endl;
312 }
313 void
315  --depth_;
317  for(unsigned int depth = 0; depth !=depth_; ++depth) {
319  }
320 
321  std::cout << " finished for end run:" << iDescription.moduleLabel() << std::endl;
322 }
323 
324 void
326  depth_=0;
327  std::cout << indention_ << indention_ << " processing begin lumi:" << iID << " time:" << iTime.value() << std::endl;
328 }
329 void
331  std::cout << indention_ << indention_ << " finished begin lumi:" << std::endl;
332 }
333 
334 void
335 Tracer::prePathBeginLumi(std::string const& iName) {
336  std::cout << indention_ << indention_ << indention_ << " processing path for begin lumi:" << iName << std::endl;
337 }
338 void
339 Tracer::postPathBeginLumi(std::string const& iName, HLTPathStatus const&) {
340  std::cout << indention_ << indention_ << indention_ << " finished path for begin lumi:" << iName << std::endl;
341 }
342 
343 void
345  ++depth_;
347  for(unsigned int depth = 0; depth !=depth_; ++depth) {
349  }
350  std::cout << " module for begin lumi:" << iDescription.moduleLabel() << std::endl;
351 }
352 void
354  --depth_;
356  for(unsigned int depth = 0; depth !=depth_; ++depth) {
358  }
359 
360  std::cout << " finished for begin lumi:" << iDescription.moduleLabel() << std::endl;
361 }
362 
363 void
364 Tracer::preEndLumi(LuminosityBlockID const& iID, Timestamp const& iTime) {
365  depth_ = 0;
366  std::cout << indention_ << indention_ << " processing end lumi:" << iID << " time:" << iTime.value() << std::endl;
367 }
368 void
370  std::cout << indention_ << indention_ << " finished end lumi:" << std::endl;
371 }
372 
373 void
374 Tracer::prePathEndLumi(std::string const& iName) {
375  std::cout << indention_ << indention_ << indention_ << " processing path for end lumi:" << iName << std::endl;
376 }
377 
378 void
379 Tracer::postPathEndLumi(std::string const& iName, HLTPathStatus const&) {
380  std::cout << indention_ << indention_ << indention_ << " finished path for end lumi:" << iName << std::endl;
381 }
382 
383 void
385  ++depth_;
387  for(unsigned int depth = 0; depth !=depth_; ++depth) {
389  }
390  std::cout << " module for end lumi:" << iDescription.moduleLabel() << std::endl;
391 }
392 
393 void
395  --depth_;
397  for(unsigned int depth = 0; depth !=depth_; ++depth) {
399  }
400 
401  std::cout << " finished for end lumi:" << iDescription.moduleLabel() << std::endl;
402 }
403 
404 void
407  std::cout << " constructing source:" << iDescription.moduleName() << std::endl;
408 }
409 
410 void
413  std::cout << " construction finished:" << iDescription.moduleName() << std::endl;
414 }
415 
416 void
419  std::cout << " constructing module:" << iDescription.moduleLabel() << std::endl;
420 }
421 
422 void
425  std::cout << " construction finished:" << iDescription.moduleLabel() << std::endl;
426 }
427 
428 void
431  std::cout << " beginJob module:" << iDescription.moduleLabel() << std::endl;
432 }
433 
434 void
437  std::cout << " beginJob finished:" << iDescription.moduleLabel() << std::endl;
438 }
439 
440 void
443  std::cout << " endJob module:" << iDescription.moduleLabel() << std::endl;
444 }
445 
446 void
449  std::cout << " endJob finished:" << iDescription.moduleLabel() << std::endl;
450 }
451 
452 //
453 // const member functions
454 //
455 
456 //
457 // static member functions
458 //
459 
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
void watchPrePathEndLumi(PrePathEndLumi::slot_type const &iSlot)
void watchPostModuleConstruction(PostModuleConstruction::slot_type const &iSlot)
void postModuleEndRun(ModuleDescription const &md)
Definition: Tracer.cc:314
void postModuleBeginLumi(ModuleDescription const &md)
Definition: Tracer.cc:353
void postSourceRun()
Definition: Tracer.cc:185
void preModuleEvent(ModuleDescription const &md)
Definition: Tracer.cc:227
void preModuleBeginLumi(ModuleDescription const &md)
Definition: Tracer.cc:344
void postCloseFile()
Definition: Tracer.cc:203
void watchPostModuleBeginLumi(PostModuleBeginLumi::slot_type const &iSlot)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void postModuleConstruction(ModuleDescription const &md)
Definition: Tracer.cc:423
void postBeginRun(Run const &run, EventSetup const &es)
Definition: Tracer.cc:252
void watchPrePathEndRun(PrePathEndRun::slot_type const &iSlot)
void watchPreModuleConstruction(PreModuleConstruction::slot_type const &iSlot)
void postModuleBeginRun(ModuleDescription const &md)
Definition: Tracer.cc:275
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
void watchPreSourceConstruction(PreSourceConstruction::slot_type const &iSlot)
void watchPreEndLumi(PreEndLumi::slot_type const &iSlot)
void watchPostSourceConstruction(PostSourceConstruction::slot_type const &iSlot)
void preSourceEvent()
Definition: Tracer.cc:163
void watchPostPathEndRun(PostPathEndRun::slot_type const &iSlot)
std::string const & moduleName() const
void preModuleEndJob(ModuleDescription const &md)
Definition: Tracer.cc:441
void postPathEvent(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:222
void watchPostEndLumi(PostEndLumi::slot_type const &iSlot)
void preModuleConstruction(ModuleDescription const &md)
Definition: Tracer.cc:417
void prePathEndRun(std::string const &s)
Definition: Tracer.cc:296
void preModuleEndLumi(ModuleDescription const &md)
Definition: Tracer.cc:384
void postSourceEvent()
Definition: Tracer.cc:167
void watchPreModuleEndLumi(PreModuleEndLumi::slot_type const &iSlot)
void postModuleBeginJob(ModuleDescription const &md)
Definition: Tracer.cc:435
void watchPostPathEndLumi(PostPathEndLumi::slot_type const &iSlot)
void postEndLumi(LuminosityBlock const &run, EventSetup const &es)
Definition: Tracer.cc:369
std::string const & moduleLabel() const
void postBeginLumi(LuminosityBlock const &run, EventSetup const &es)
Definition: Tracer.cc:330
void watchPreEndRun(PreEndRun::slot_type const &iSlot)
void prePathBeginRun(std::string const &s)
Definition: Tracer.cc:257
void postEvent(Event const &ev, EventSetup const &es)
Definition: Tracer.cc:213
void watchPreModule(PreModule::slot_type const &iSlot)
void preEndLumi(LuminosityBlockID const &id, Timestamp const &ts)
Definition: Tracer.cc:364
void watchPreOpenFile(PreOpenFile::slot_type const &iSlot)
void prePathEvent(std::string const &s)
Definition: Tracer.cc:218
void preBeginRun(RunID const &id, Timestamp const &ts)
Definition: Tracer.cc:247
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
void watchPostCloseFile(PostCloseFile::slot_type const &iSlot)
void watchPreModuleEndRun(PreModuleEndRun::slot_type const &iSlot)
void postEndRun(Run const &run, EventSetup const &es)
Definition: Tracer.cc:291
void watchPrePathBeginRun(PrePathBeginRun::slot_type const &iSlot)
void watchPostSourceRun(PostSourceRun::slot_type const &iSlot)
void postPathBeginLumi(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:339
void preModuleBeginRun(ModuleDescription const &md)
Definition: Tracer.cc:266
Tracer(const ParameterSet &, ActivityRegistry &)
Definition: Tracer.cc:40
void watchPreSourceLumi(PreSourceLumi::slot_type const &iSlot)
void prePathEndLumi(std::string const &s)
Definition: Tracer.cc:374
void watchPostModuleEndRun(PostModuleEndRun::slot_type const &iSlot)
void preEndRun(RunID const &id, Timestamp const &ts)
Definition: Tracer.cc:286
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Tracer.cc:130
void watchPreSource(PreSource::slot_type const &iSlot)
void watchPreModuleEndJob(PreModuleEndJob::slot_type const &iSlot)
void watchPreSourceRun(PreSourceRun::slot_type const &iSlot)
void watchPostBeginLumi(PostBeginLumi::slot_type const &iSlot)
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void watchPrePathBeginLumi(PrePathBeginLumi::slot_type const &iSlot)
void preBeginLumi(LuminosityBlockID const &id, Timestamp const &ts)
Definition: Tracer.cc:325
void postPathBeginRun(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:261
void watchPostModuleBeginRun(PostModuleBeginRun::slot_type const &iSlot)
void watchPostPathBeginRun(PostPathBeginRun::slot_type const &iSlot)
void setComment(std::string const &value)
TimeValue_t value() const
Definition: Timestamp.cc:72
unsigned int depth_
Definition: Tracer.h:119
void watchPostSourceLumi(PostSourceLumi::slot_type const &iSlot)
void watchPreCloseFile(PreCloseFile::slot_type const &iSlot)
void preSourceLumi()
Definition: Tracer.cc:172
std::string indention_
Definition: Tracer.h:118
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void watchPostOpenFile(PostOpenFile::slot_type const &iSlot)
void postModuleEvent(ModuleDescription const &md)
Definition: Tracer.cc:236
void preSourceConstruction(ModuleDescription const &md)
Definition: Tracer.cc:405
void postPathEndRun(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:300
void preEvent(EventID const &id, Timestamp const &ts)
Definition: Tracer.cc:208
void watchPostSource(PostSource::slot_type const &iSlot)
void postModuleEndLumi(ModuleDescription const &md)
Definition: Tracer.cc:394
void postPathEndLumi(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:379
void watchPostModuleBeginJob(PostModuleBeginJob::slot_type const &iSlot)
void preModuleEndRun(ModuleDescription const &md)
Definition: Tracer.cc:305
void watchPreBeginLumi(PreBeginLumi::slot_type const &iSlot)
void prePathBeginLumi(std::string const &s)
Definition: Tracer.cc:335
void postModuleEndJob(ModuleDescription const &md)
Definition: Tracer.cc:447
tuple cout
Definition: gather_cfg.py:121
void watchPostEndRun(PostEndRun::slot_type const &iSlot)
void watchPreModuleBeginLumi(PreModuleBeginLumi::slot_type const &iSlot)
void preModuleBeginJob(ModuleDescription const &md)
Definition: Tracer.cc:429
void watchPreProcessPath(PreProcessPath::slot_type const &iSlot)
void watchPostModuleEndJob(PostModuleEndJob::slot_type const &iSlot)
void watchPreModuleBeginRun(PreModuleBeginRun::slot_type const &iSlot)
void postSourceLumi()
Definition: Tracer.cc:176
void watchPostModuleEndLumi(PostModuleEndLumi::slot_type const &iSlot)
void watchPostPathBeginLumi(PostPathBeginLumi::slot_type const &iSlot)
void watchPostProcessPath(PostProcessPath::slot_type const &iSlot)
Definition: Run.h:33
void postSourceConstruction(ModuleDescription const &md)
Definition: Tracer.cc:411
void watchPreBeginRun(PreBeginRun::slot_type const &iSlot)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal