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 // $Id: Tracer.cc,v 1.17 2010/01/19 22:37:06 wdd Exp $
12 //
13 
14 // system include files
15 #include <iostream>
16 
17 // user include files
19 
25 
28 
29 using namespace edm::service;
30 //
31 // constants, enums and typedefs
32 //
33 
34 //
35 // static data member definitions
36 //
37 
38 //
39 // constructors and destructor
40 //
42  indention_(iPS.getUntrackedParameter<std::string>("indention")),
43  depth_(0)
44 {
45  iRegistry.watchPostBeginJob(this, &Tracer::postBeginJob);
46  iRegistry.watchPostEndJob(this, &Tracer::postEndJob);
47 
48  iRegistry.watchPreModule(this, &Tracer::preModuleEvent);
49  iRegistry.watchPostModule(this, &Tracer::postModuleEvent);
50 
53 
56 
59 
62 
65 
68 
71 
74 
75  iRegistry.watchPreProcessPath(this, &Tracer::prePathEvent);
77 
80 
81  iRegistry.watchPrePathEndRun(this, &Tracer::prePathEndRun);
83 
86 
89 
90  iRegistry.watchPreProcessEvent(this, &Tracer::preEvent);
91  iRegistry.watchPostProcessEvent(this, &Tracer::postEvent);
92 
93  iRegistry.watchPreBeginRun(this, &Tracer::preBeginRun);
94  iRegistry.watchPostBeginRun(this, &Tracer::postBeginRun);
95 
96  iRegistry.watchPreEndRun(this, &Tracer::preEndRun);
97  iRegistry.watchPostEndRun(this, &Tracer::postEndRun);
98 
99  iRegistry.watchPreBeginLumi(this, &Tracer::preBeginLumi);
100  iRegistry.watchPostBeginLumi(this, &Tracer::postBeginLumi);
101 
102  iRegistry.watchPreEndLumi(this, &Tracer::preEndLumi);
103  iRegistry.watchPostEndLumi(this, &Tracer::postEndLumi);
104 
105  iRegistry.watchPreSource(this, &Tracer::preSourceEvent);
106  iRegistry.watchPostSource(this, &Tracer::postSourceEvent);
107 
108  iRegistry.watchPreOpenFile(this, &Tracer::preOpenFile);
109  iRegistry.watchPostOpenFile(this, &Tracer::postOpenFile);
110 
111  iRegistry.watchPreCloseFile(this, &Tracer::preCloseFile);
112  iRegistry.watchPostCloseFile(this, &Tracer::postCloseFile);
113 
114  iRegistry.watchPreSourceRun(this, &Tracer::preSourceRun);
115  iRegistry.watchPostSourceRun(this, &Tracer::postSourceRun);
116 
117  iRegistry.watchPreSourceLumi(this, &Tracer::preSourceLumi);
119 
120 }
121 
122 // Tracer::Tracer(Tracer const& rhs)
123 // {
124 // // do actual copying here;
125 // }
126 
127 //Tracer::~Tracer()
128 //{
129 //}
130 
131 void
133 
135  desc.addUntracked<std::string>("indention", "++")->setComment("Prefix characters for output. The characters are repeated to form the indentation.");
136  descriptions.add("Tracer", desc);
137  descriptions.setComment("This service prints each phase the framework is processing, e.g. constructing a module,running a module, etc.");
138 }
139 
140 //
141 // assignment operators
142 //
143 // Tracer const& Tracer::operator=(Tracer const& rhs)
144 // {
145 // //An exception safe implementation is
146 // Tracer temp(rhs);
147 // swap(rhs);
148 //
149 // return *this;
150 // }
151 
152 //
153 // member functions
154 //
155 void
157  std::cout <<indention_<<" Job started"<<std::endl;
158 }
159 void
161  std::cout <<indention_<<" Job ended"<<std::endl;
162 }
163 
164 void
166  std::cout <<indention_<<indention_<<"source event"<<std::endl;
167 }
168 void
170  std::cout <<indention_<<indention_<<"finished: source event"<<std::endl;
171 }
172 
173 void
175  std::cout <<indention_<<indention_<<"source lumi"<<std::endl;
176 }
177 void
179  std::cout <<indention_<<indention_<<"finished: source lumi"<<std::endl;
180 }
181 
182 void
184  std::cout <<indention_<<indention_<<"source run"<<std::endl;
185 }
186 void
188  std::cout <<indention_<<indention_<<"finished: source run"<<std::endl;
189 }
190 
191 void
193  std::cout <<indention_<<indention_<<"open input file"<<std::endl;
194 }
195 void
197  std::cout <<indention_<<indention_<<"finished: open input file"<<std::endl;
198 }
199 
200 void
202  std::cout <<indention_<<indention_<<"close input file"<<std::endl;
203 }
204 void
206  std::cout <<indention_<<indention_<<"finished: close input file"<<std::endl;
207 }
208 
209 void
210 Tracer::preEvent(EventID const& iID, Timestamp const& iTime) {
211  depth_=0;
212  std::cout <<indention_<<indention_<<" processing event:"<< iID<<" time:"<<iTime.value()<< std::endl;
213 }
214 void
216  std::cout <<indention_<<indention_<<" finished event:"<<std::endl;
217 }
218 
219 void
220 Tracer::prePathEvent(std::string const& iName) {
221  std::cout <<indention_<<indention_<<indention_<<" processing path for event:"<<iName<<std::endl;
222 }
223 void
224 Tracer::postPathEvent(std::string const& iName, HLTPathStatus const&) {
225  std::cout <<indention_<<indention_<<indention_<<" finished path for event:"<<std::endl;
226 }
227 
228 void
230  ++depth_;
232  for(unsigned int depth = 0; depth !=depth_; ++depth) {
234  }
235  std::cout<<" module for event:" <<iDescription.moduleLabel()<<std::endl;
236 }
237 void
239  --depth_;
241  for(unsigned int depth = 0; depth !=depth_; ++depth) {
243  }
244 
245  std::cout<<" finished for event:"<<iDescription.moduleLabel()<<std::endl;
246 }
247 
248 void
249 Tracer::preBeginRun(RunID const& iID, Timestamp const& iTime) {
250  depth_=0;
251  std::cout <<indention_<<indention_<<" processing begin run:"<< iID<<" time:"<<iTime.value()<< std::endl;
252 }
253 void
255  std::cout <<indention_<<indention_<<" finished begin run:"<<std::endl;
256 }
257 
258 void
259 Tracer::prePathBeginRun(std::string const& iName) {
260  std::cout <<indention_<<indention_<<indention_<<" processing path for begin run:"<<iName<<std::endl;
261 }
262 void
263 Tracer::postPathBeginRun(std::string const& iName, HLTPathStatus const&) {
264  std::cout <<indention_<<indention_<<indention_<<" finished path for begin run:"<<std::endl;
265 }
266 
267 void
269  ++depth_;
271  for(unsigned int depth = 0; depth !=depth_; ++depth) {
273  }
274  std::cout<<" module for begin run:" <<iDescription.moduleLabel()<<std::endl;
275 }
276 void
278  --depth_;
280  for(unsigned int depth = 0; depth !=depth_; ++depth) {
282  }
283 
284  std::cout<<" finished for begin run:"<<iDescription.moduleLabel()<<std::endl;
285 }
286 
287 void
288 Tracer::preEndRun(RunID const& iID, Timestamp const& iTime) {
289  depth_=0;
290  std::cout <<indention_<<indention_<<" processing end run:"<< iID<<" time:"<<iTime.value()<< std::endl;
291 }
292 void
294  std::cout <<indention_<<indention_<<" finished end run:"<<std::endl;
295 }
296 
297 void
298 Tracer::prePathEndRun(std::string const& iName) {
299  std::cout <<indention_<<indention_<<indention_<<" processing path for end run:"<<iName<<std::endl;
300 }
301 void
302 Tracer::postPathEndRun(std::string const& iName, HLTPathStatus const&) {
303  std::cout <<indention_<<indention_<<indention_<<" finished path for end run:"<<std::endl;
304 }
305 
306 void
308  ++depth_;
310  for(unsigned int depth = 0; depth !=depth_; ++depth) {
312  }
313  std::cout<<" module for end run:" <<iDescription.moduleLabel()<<std::endl;
314 }
315 void
317  --depth_;
319  for(unsigned int depth = 0; depth !=depth_; ++depth) {
321  }
322 
323  std::cout<<" finished for end run:"<<iDescription.moduleLabel()<<std::endl;
324 }
325 
326 void
328  depth_=0;
329  std::cout <<indention_<<indention_<<" processing begin lumi:"<< iID<<" time:"<<iTime.value()<< std::endl;
330 }
331 void
333  std::cout <<indention_<<indention_<<" finished begin lumi:"<<std::endl;
334 }
335 
336 void
337 Tracer::prePathBeginLumi(std::string const& iName) {
338  std::cout <<indention_<<indention_<<indention_<<" processing path for begin lumi:"<<iName<<std::endl;
339 }
340 void
341 Tracer::postPathBeginLumi(std::string const& iName, HLTPathStatus const&) {
342  std::cout <<indention_<<indention_<<indention_<<" finished path for begin lumi:"<<std::endl;
343 }
344 
345 void
347  ++depth_;
349  for(unsigned int depth = 0; depth !=depth_; ++depth) {
351  }
352  std::cout<<" module for begin lumi:" <<iDescription.moduleLabel()<<std::endl;
353 }
354 void
356  --depth_;
358  for(unsigned int depth = 0; depth !=depth_; ++depth) {
360  }
361 
362  std::cout<<" finished for begin lumi:"<<iDescription.moduleLabel()<<std::endl;
363 }
364 
365 void
366 Tracer::preEndLumi(LuminosityBlockID const& iID, Timestamp const& iTime) {
367  depth_=0;
368  std::cout <<indention_<<indention_<<" processing end lumi:"<< iID<<" time:"<<iTime.value()<< std::endl;
369 }
370 void
372  std::cout <<indention_<<indention_<<" finished end lumi:"<<std::endl;
373 }
374 
375 void
376 Tracer::prePathEndLumi(std::string const& iName) {
377  std::cout <<indention_<<indention_<<indention_<<" processing path for end lumi:"<<iName<<std::endl;
378 }
379 
380 void
381 Tracer::postPathEndLumi(std::string const& iName, HLTPathStatus const&) {
382  std::cout <<indention_<<indention_<<indention_<<" finished path for end lumi:"<<std::endl;
383 }
384 
385 void
387  ++depth_;
389  for(unsigned int depth = 0; depth !=depth_; ++depth) {
391  }
392  std::cout<<" module for end lumi:" <<iDescription.moduleLabel()<<std::endl;
393 }
394 
395 void
397  --depth_;
399  for(unsigned int depth = 0; depth !=depth_; ++depth) {
401  }
402 
403  std::cout<<" finished for end lumi:"<<iDescription.moduleLabel()<<std::endl;
404 }
405 
406 void
409  std::cout<<" constructing source:" <<iDescription.moduleName()<<std::endl;
410 }
411 
412 void
415  std::cout<<" construction finished:"<<iDescription.moduleName()<<std::endl;
416 }
417 
418 void
421  std::cout<<" constructing module:" <<iDescription.moduleLabel()<<std::endl;
422 }
423 
424 void
427  std::cout<<" construction finished:"<<iDescription.moduleLabel()<<std::endl;
428 }
429 
430 void
433  std::cout<<" beginJob module:" <<iDescription.moduleLabel()<<std::endl;
434 }
435 
436 void
439  std::cout<<" beginJob finished:"<<iDescription.moduleLabel()<<std::endl;
440 }
441 
442 void
445  std::cout<<" endJob module:" <<iDescription.moduleLabel()<<std::endl;
446 }
447 
448 void
451  std::cout<<" endJob finished:"<<iDescription.moduleLabel()<<std::endl;
452 }
453 
454 //
455 // const member functions
456 //
457 
458 //
459 // static member functions
460 //
461 
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:316
void postModuleBeginLumi(ModuleDescription const &md)
Definition: Tracer.cc:355
void postSourceRun()
Definition: Tracer.cc:187
void preModuleEvent(ModuleDescription const &md)
Definition: Tracer.cc:229
void preModuleBeginLumi(ModuleDescription const &md)
Definition: Tracer.cc:346
void postCloseFile()
Definition: Tracer.cc:205
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:425
void postBeginRun(Run const &run, EventSetup const &es)
Definition: Tracer.cc:254
void watchPrePathEndRun(PrePathEndRun::slot_type const &iSlot)
void watchPreModuleConstruction(PreModuleConstruction::slot_type const &iSlot)
void postModuleBeginRun(ModuleDescription const &md)
Definition: Tracer.cc:277
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:165
void watchPostPathEndRun(PostPathEndRun::slot_type const &iSlot)
std::string const & moduleName() const
void preModuleEndJob(ModuleDescription const &md)
Definition: Tracer.cc:443
void postPathEvent(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:224
void watchPostEndLumi(PostEndLumi::slot_type const &iSlot)
void preModuleConstruction(ModuleDescription const &md)
Definition: Tracer.cc:419
void prePathEndRun(std::string const &s)
Definition: Tracer.cc:298
void preModuleEndLumi(ModuleDescription const &md)
Definition: Tracer.cc:386
void postSourceEvent()
Definition: Tracer.cc:169
void watchPreModuleEndLumi(PreModuleEndLumi::slot_type const &iSlot)
void postModuleBeginJob(ModuleDescription const &md)
Definition: Tracer.cc:437
void watchPostPathEndLumi(PostPathEndLumi::slot_type const &iSlot)
void postEndLumi(LuminosityBlock const &run, EventSetup const &es)
Definition: Tracer.cc:371
std::string const & moduleLabel() const
void postBeginLumi(LuminosityBlock const &run, EventSetup const &es)
Definition: Tracer.cc:332
void watchPreEndRun(PreEndRun::slot_type const &iSlot)
void prePathBeginRun(std::string const &s)
Definition: Tracer.cc:259
void postEvent(Event const &ev, EventSetup const &es)
Definition: Tracer.cc:215
void watchPreModule(PreModule::slot_type const &iSlot)
void preEndLumi(LuminosityBlockID const &id, Timestamp const &ts)
Definition: Tracer.cc:366
void watchPreOpenFile(PreOpenFile::slot_type const &iSlot)
void prePathEvent(std::string const &s)
Definition: Tracer.cc:220
void preBeginRun(RunID const &id, Timestamp const &ts)
Definition: Tracer.cc:249
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:293
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:341
void preModuleBeginRun(ModuleDescription const &md)
Definition: Tracer.cc:268
Tracer(const ParameterSet &, ActivityRegistry &)
Definition: Tracer.cc:41
void watchPreSourceLumi(PreSourceLumi::slot_type const &iSlot)
void prePathEndLumi(std::string const &s)
Definition: Tracer.cc:376
void watchPostModuleEndRun(PostModuleEndRun::slot_type const &iSlot)
void preEndRun(RunID const &id, Timestamp const &ts)
Definition: Tracer.cc:288
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Tracer.cc:132
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:327
void postPathBeginRun(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:263
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:174
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:238
void preSourceConstruction(ModuleDescription const &md)
Definition: Tracer.cc:407
void postPathEndRun(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:302
void preEvent(EventID const &id, Timestamp const &ts)
Definition: Tracer.cc:210
void watchPostSource(PostSource::slot_type const &iSlot)
void postModuleEndLumi(ModuleDescription const &md)
Definition: Tracer.cc:396
void postPathEndLumi(std::string const &s, HLTPathStatus const &hlt)
Definition: Tracer.cc:381
void watchPostModuleBeginJob(PostModuleBeginJob::slot_type const &iSlot)
void preModuleEndRun(ModuleDescription const &md)
Definition: Tracer.cc:307
void watchPreBeginLumi(PreBeginLumi::slot_type const &iSlot)
void prePathBeginLumi(std::string const &s)
Definition: Tracer.cc:337
void postModuleEndJob(ModuleDescription const &md)
Definition: Tracer.cc:449
tuple cout
Definition: gather_cfg.py:41
void watchPostEndRun(PostEndRun::slot_type const &iSlot)
void watchPreModuleBeginLumi(PreModuleBeginLumi::slot_type const &iSlot)
void preModuleBeginJob(ModuleDescription const &md)
Definition: Tracer.cc:431
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:178
void watchPostModuleEndLumi(PostModuleEndLumi::slot_type const &iSlot)
void watchPostPathBeginLumi(PostPathBeginLumi::slot_type const &iSlot)
void watchPostProcessPath(PostProcessPath::slot_type const &iSlot)
Definition: Run.h:32
void postSourceConstruction(ModuleDescription const &md)
Definition: Tracer.cc:413
void watchPreBeginRun(PreBeginRun::slot_type const &iSlot)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal