00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <iostream>
00016
00017
00018 #include "FWCore/Services/src/Tracer.h"
00019
00020 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00021 #include "DataFormats/Provenance/interface/EventID.h"
00022 #include "DataFormats/Provenance/interface/Timestamp.h"
00023 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
00024 #include "DataFormats/Provenance/interface/RunID.h"
00025
00026 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00028
00029 using namespace edm::service;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 Tracer::Tracer(ParameterSet const& iPS, ActivityRegistry&iRegistry) :
00042 indention_(iPS.getUntrackedParameter<std::string>("indention")),
00043 depth_(0)
00044 {
00045 iRegistry.watchPostBeginJob(this, &Tracer::postBeginJob);
00046 iRegistry.watchPostEndJob(this, &Tracer::postEndJob);
00047
00048 iRegistry.watchPreModule(this, &Tracer::preModuleEvent);
00049 iRegistry.watchPostModule(this, &Tracer::postModuleEvent);
00050
00051 iRegistry.watchPreSourceConstruction(this, &Tracer::preSourceConstruction);
00052 iRegistry.watchPostSourceConstruction(this, &Tracer::postSourceConstruction);
00053
00054 iRegistry.watchPreModuleConstruction(this, &Tracer::preModuleConstruction);
00055 iRegistry.watchPostModuleConstruction(this, &Tracer::postModuleConstruction);
00056
00057 iRegistry.watchPreModuleBeginJob(this, &Tracer::preModuleBeginJob);
00058 iRegistry.watchPostModuleBeginJob(this, &Tracer::postModuleBeginJob);
00059
00060 iRegistry.watchPreModuleEndJob(this, &Tracer::preModuleEndJob);
00061 iRegistry.watchPostModuleEndJob(this, &Tracer::postModuleEndJob);
00062
00063 iRegistry.watchPreModuleBeginRun(this, &Tracer::preModuleBeginRun);
00064 iRegistry.watchPostModuleBeginRun(this, &Tracer::postModuleBeginRun);
00065
00066 iRegistry.watchPreModuleEndRun(this, &Tracer::preModuleEndRun);
00067 iRegistry.watchPostModuleEndRun(this, &Tracer::postModuleEndRun);
00068
00069 iRegistry.watchPreModuleBeginLumi(this, &Tracer::preModuleBeginLumi);
00070 iRegistry.watchPostModuleBeginLumi(this, &Tracer::postModuleBeginLumi);
00071
00072 iRegistry.watchPreModuleEndLumi(this, &Tracer::preModuleEndLumi);
00073 iRegistry.watchPostModuleEndLumi(this, &Tracer::postModuleEndLumi);
00074
00075 iRegistry.watchPreProcessPath(this, &Tracer::prePathEvent);
00076 iRegistry.watchPostProcessPath(this, &Tracer::postPathEvent);
00077
00078 iRegistry.watchPrePathBeginRun(this, &Tracer::prePathBeginRun);
00079 iRegistry.watchPostPathBeginRun(this, &Tracer::postPathBeginRun);
00080
00081 iRegistry.watchPrePathEndRun(this, &Tracer::prePathEndRun);
00082 iRegistry.watchPostPathEndRun(this, &Tracer::postPathEndRun);
00083
00084 iRegistry.watchPrePathBeginLumi(this, &Tracer::prePathBeginLumi);
00085 iRegistry.watchPostPathBeginLumi(this, &Tracer::postPathBeginLumi);
00086
00087 iRegistry.watchPrePathEndLumi(this, &Tracer::prePathEndLumi);
00088 iRegistry.watchPostPathEndLumi(this, &Tracer::postPathEndLumi);
00089
00090 iRegistry.watchPreProcessEvent(this, &Tracer::preEvent);
00091 iRegistry.watchPostProcessEvent(this, &Tracer::postEvent);
00092
00093 iRegistry.watchPreBeginRun(this, &Tracer::preBeginRun);
00094 iRegistry.watchPostBeginRun(this, &Tracer::postBeginRun);
00095
00096 iRegistry.watchPreEndRun(this, &Tracer::preEndRun);
00097 iRegistry.watchPostEndRun(this, &Tracer::postEndRun);
00098
00099 iRegistry.watchPreBeginLumi(this, &Tracer::preBeginLumi);
00100 iRegistry.watchPostBeginLumi(this, &Tracer::postBeginLumi);
00101
00102 iRegistry.watchPreEndLumi(this, &Tracer::preEndLumi);
00103 iRegistry.watchPostEndLumi(this, &Tracer::postEndLumi);
00104
00105 iRegistry.watchPreSource(this, &Tracer::preSourceEvent);
00106 iRegistry.watchPostSource(this, &Tracer::postSourceEvent);
00107
00108 iRegistry.watchPreOpenFile(this, &Tracer::preOpenFile);
00109 iRegistry.watchPostOpenFile(this, &Tracer::postOpenFile);
00110
00111 iRegistry.watchPreCloseFile(this, &Tracer::preCloseFile);
00112 iRegistry.watchPostCloseFile(this, &Tracer::postCloseFile);
00113
00114 iRegistry.watchPreSourceRun(this, &Tracer::preSourceRun);
00115 iRegistry.watchPostSourceRun(this, &Tracer::postSourceRun);
00116
00117 iRegistry.watchPreSourceLumi(this, &Tracer::preSourceLumi);
00118 iRegistry.watchPostSourceLumi(this, &Tracer::postSourceLumi);
00119
00120 }
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 void
00132 Tracer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) {
00133
00134 edm::ParameterSetDescription desc;
00135 desc.addUntracked<std::string>("indention", "++")->setComment("Prefix characters for output. The characters are repeated to form the indentation.");
00136 descriptions.add("Tracer", desc);
00137 descriptions.setComment("This service prints each phase the framework is processing, e.g. constructing a module,running a module, etc.");
00138 }
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 void
00156 Tracer::postBeginJob() {
00157 std::cout <<indention_<<" Job started"<<std::endl;
00158 }
00159 void
00160 Tracer::postEndJob() {
00161 std::cout <<indention_<<" Job ended"<<std::endl;
00162 }
00163
00164 void
00165 Tracer::preSourceEvent() {
00166 std::cout <<indention_<<indention_<<"source event"<<std::endl;
00167 }
00168 void
00169 Tracer::postSourceEvent () {
00170 std::cout <<indention_<<indention_<<"finished: source event"<<std::endl;
00171 }
00172
00173 void
00174 Tracer::preSourceLumi() {
00175 std::cout <<indention_<<indention_<<"source lumi"<<std::endl;
00176 }
00177 void
00178 Tracer::postSourceLumi () {
00179 std::cout <<indention_<<indention_<<"finished: source lumi"<<std::endl;
00180 }
00181
00182 void
00183 Tracer::preSourceRun() {
00184 std::cout <<indention_<<indention_<<"source run"<<std::endl;
00185 }
00186 void
00187 Tracer::postSourceRun () {
00188 std::cout <<indention_<<indention_<<"finished: source run"<<std::endl;
00189 }
00190
00191 void
00192 Tracer::preOpenFile() {
00193 std::cout <<indention_<<indention_<<"open input file"<<std::endl;
00194 }
00195 void
00196 Tracer::postOpenFile () {
00197 std::cout <<indention_<<indention_<<"finished: open input file"<<std::endl;
00198 }
00199
00200 void
00201 Tracer::preCloseFile() {
00202 std::cout <<indention_<<indention_<<"close input file"<<std::endl;
00203 }
00204 void
00205 Tracer::postCloseFile () {
00206 std::cout <<indention_<<indention_<<"finished: close input file"<<std::endl;
00207 }
00208
00209 void
00210 Tracer::preEvent(EventID const& iID, Timestamp const& iTime) {
00211 depth_=0;
00212 std::cout <<indention_<<indention_<<" processing event:"<< iID<<" time:"<<iTime.value()<< std::endl;
00213 }
00214 void
00215 Tracer::postEvent(Event const&, EventSetup const&) {
00216 std::cout <<indention_<<indention_<<" finished event:"<<std::endl;
00217 }
00218
00219 void
00220 Tracer::prePathEvent(std::string const& iName) {
00221 std::cout <<indention_<<indention_<<indention_<<" processing path for event:"<<iName<<std::endl;
00222 }
00223 void
00224 Tracer::postPathEvent(std::string const& iName, HLTPathStatus const&) {
00225 std::cout <<indention_<<indention_<<indention_<<" finished path for event:"<<std::endl;
00226 }
00227
00228 void
00229 Tracer::preModuleEvent(ModuleDescription const& iDescription) {
00230 ++depth_;
00231 std::cout <<indention_<<indention_<<indention_;
00232 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00233 std::cout<<indention_;
00234 }
00235 std::cout<<" module for event:" <<iDescription.moduleLabel()<<std::endl;
00236 }
00237 void
00238 Tracer::postModuleEvent(ModuleDescription const& iDescription) {
00239 --depth_;
00240 std::cout <<indention_<<indention_<<indention_<<indention_;
00241 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00242 std::cout<<indention_;
00243 }
00244
00245 std::cout<<" finished for event:"<<iDescription.moduleLabel()<<std::endl;
00246 }
00247
00248 void
00249 Tracer::preBeginRun(RunID const& iID, Timestamp const& iTime) {
00250 depth_=0;
00251 std::cout <<indention_<<indention_<<" processing begin run:"<< iID<<" time:"<<iTime.value()<< std::endl;
00252 }
00253 void
00254 Tracer::postBeginRun(Run const&, EventSetup const&) {
00255 std::cout <<indention_<<indention_<<" finished begin run:"<<std::endl;
00256 }
00257
00258 void
00259 Tracer::prePathBeginRun(std::string const& iName) {
00260 std::cout <<indention_<<indention_<<indention_<<" processing path for begin run:"<<iName<<std::endl;
00261 }
00262 void
00263 Tracer::postPathBeginRun(std::string const& iName, HLTPathStatus const&) {
00264 std::cout <<indention_<<indention_<<indention_<<" finished path for begin run:"<<std::endl;
00265 }
00266
00267 void
00268 Tracer::preModuleBeginRun(ModuleDescription const& iDescription) {
00269 ++depth_;
00270 std::cout <<indention_<<indention_<<indention_;
00271 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00272 std::cout<<indention_;
00273 }
00274 std::cout<<" module for begin run:" <<iDescription.moduleLabel()<<std::endl;
00275 }
00276 void
00277 Tracer::postModuleBeginRun(ModuleDescription const& iDescription) {
00278 --depth_;
00279 std::cout <<indention_<<indention_<<indention_<<indention_;
00280 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00281 std::cout<<indention_;
00282 }
00283
00284 std::cout<<" finished for begin run:"<<iDescription.moduleLabel()<<std::endl;
00285 }
00286
00287 void
00288 Tracer::preEndRun(RunID const& iID, Timestamp const& iTime) {
00289 depth_=0;
00290 std::cout <<indention_<<indention_<<" processing end run:"<< iID<<" time:"<<iTime.value()<< std::endl;
00291 }
00292 void
00293 Tracer::postEndRun(Run const&, EventSetup const&) {
00294 std::cout <<indention_<<indention_<<" finished end run:"<<std::endl;
00295 }
00296
00297 void
00298 Tracer::prePathEndRun(std::string const& iName) {
00299 std::cout <<indention_<<indention_<<indention_<<" processing path for end run:"<<iName<<std::endl;
00300 }
00301 void
00302 Tracer::postPathEndRun(std::string const& iName, HLTPathStatus const&) {
00303 std::cout <<indention_<<indention_<<indention_<<" finished path for end run:"<<std::endl;
00304 }
00305
00306 void
00307 Tracer::preModuleEndRun(ModuleDescription const& iDescription) {
00308 ++depth_;
00309 std::cout <<indention_<<indention_<<indention_;
00310 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00311 std::cout<<indention_;
00312 }
00313 std::cout<<" module for end run:" <<iDescription.moduleLabel()<<std::endl;
00314 }
00315 void
00316 Tracer::postModuleEndRun(ModuleDescription const& iDescription) {
00317 --depth_;
00318 std::cout <<indention_<<indention_<<indention_<<indention_;
00319 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00320 std::cout<<indention_;
00321 }
00322
00323 std::cout<<" finished for end run:"<<iDescription.moduleLabel()<<std::endl;
00324 }
00325
00326 void
00327 Tracer::preBeginLumi(LuminosityBlockID const& iID, Timestamp const& iTime) {
00328 depth_=0;
00329 std::cout <<indention_<<indention_<<" processing begin lumi:"<< iID<<" time:"<<iTime.value()<< std::endl;
00330 }
00331 void
00332 Tracer::postBeginLumi(LuminosityBlock const&, EventSetup const&) {
00333 std::cout <<indention_<<indention_<<" finished begin lumi:"<<std::endl;
00334 }
00335
00336 void
00337 Tracer::prePathBeginLumi(std::string const& iName) {
00338 std::cout <<indention_<<indention_<<indention_<<" processing path for begin lumi:"<<iName<<std::endl;
00339 }
00340 void
00341 Tracer::postPathBeginLumi(std::string const& iName, HLTPathStatus const&) {
00342 std::cout <<indention_<<indention_<<indention_<<" finished path for begin lumi:"<<std::endl;
00343 }
00344
00345 void
00346 Tracer::preModuleBeginLumi(ModuleDescription const& iDescription) {
00347 ++depth_;
00348 std::cout <<indention_<<indention_<<indention_;
00349 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00350 std::cout<<indention_;
00351 }
00352 std::cout<<" module for begin lumi:" <<iDescription.moduleLabel()<<std::endl;
00353 }
00354 void
00355 Tracer::postModuleBeginLumi(ModuleDescription const& iDescription) {
00356 --depth_;
00357 std::cout <<indention_<<indention_<<indention_<<indention_;
00358 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00359 std::cout<<indention_;
00360 }
00361
00362 std::cout<<" finished for begin lumi:"<<iDescription.moduleLabel()<<std::endl;
00363 }
00364
00365 void
00366 Tracer::preEndLumi(LuminosityBlockID const& iID, Timestamp const& iTime) {
00367 depth_=0;
00368 std::cout <<indention_<<indention_<<" processing end lumi:"<< iID<<" time:"<<iTime.value()<< std::endl;
00369 }
00370 void
00371 Tracer::postEndLumi(LuminosityBlock const&, EventSetup const&) {
00372 std::cout <<indention_<<indention_<<" finished end lumi:"<<std::endl;
00373 }
00374
00375 void
00376 Tracer::prePathEndLumi(std::string const& iName) {
00377 std::cout <<indention_<<indention_<<indention_<<" processing path for end lumi:"<<iName<<std::endl;
00378 }
00379
00380 void
00381 Tracer::postPathEndLumi(std::string const& iName, HLTPathStatus const&) {
00382 std::cout <<indention_<<indention_<<indention_<<" finished path for end lumi:"<<std::endl;
00383 }
00384
00385 void
00386 Tracer::preModuleEndLumi(ModuleDescription const& iDescription) {
00387 ++depth_;
00388 std::cout <<indention_<<indention_<<indention_;
00389 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00390 std::cout<<indention_;
00391 }
00392 std::cout<<" module for end lumi:" <<iDescription.moduleLabel()<<std::endl;
00393 }
00394
00395 void
00396 Tracer::postModuleEndLumi(ModuleDescription const& iDescription) {
00397 --depth_;
00398 std::cout <<indention_<<indention_<<indention_<<indention_;
00399 for(unsigned int depth = 0; depth !=depth_; ++depth) {
00400 std::cout<<indention_;
00401 }
00402
00403 std::cout<<" finished for end lumi:"<<iDescription.moduleLabel()<<std::endl;
00404 }
00405
00406 void
00407 Tracer::preSourceConstruction(ModuleDescription const& iDescription) {
00408 std::cout <<indention_;
00409 std::cout<<" constructing source:" <<iDescription.moduleName()<<std::endl;
00410 }
00411
00412 void
00413 Tracer::postSourceConstruction(ModuleDescription const& iDescription) {
00414 std::cout <<indention_;
00415 std::cout<<" construction finished:"<<iDescription.moduleName()<<std::endl;
00416 }
00417
00418 void
00419 Tracer::preModuleConstruction(ModuleDescription const& iDescription) {
00420 std::cout <<indention_;
00421 std::cout<<" constructing module:" <<iDescription.moduleLabel()<<std::endl;
00422 }
00423
00424 void
00425 Tracer::postModuleConstruction(ModuleDescription const& iDescription) {
00426 std::cout <<indention_;
00427 std::cout<<" construction finished:"<<iDescription.moduleLabel()<<std::endl;
00428 }
00429
00430 void
00431 Tracer::preModuleBeginJob(ModuleDescription const& iDescription) {
00432 std::cout <<indention_;
00433 std::cout<<" beginJob module:" <<iDescription.moduleLabel()<<std::endl;
00434 }
00435
00436 void
00437 Tracer::postModuleBeginJob(ModuleDescription const& iDescription) {
00438 std::cout <<indention_;
00439 std::cout<<" beginJob finished:"<<iDescription.moduleLabel()<<std::endl;
00440 }
00441
00442 void
00443 Tracer::preModuleEndJob(ModuleDescription const& iDescription) {
00444 std::cout <<indention_;
00445 std::cout<<" endJob module:" <<iDescription.moduleLabel()<<std::endl;
00446 }
00447
00448 void
00449 Tracer::postModuleEndJob(ModuleDescription const& iDescription) {
00450 std::cout <<indention_;
00451 std::cout<<" endJob finished:"<<iDescription.moduleLabel()<<std::endl;
00452 }
00453
00454
00455
00456
00457
00458
00459
00460
00461