CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
IgProfModule Class Reference
Inheritance diagram for IgProfModule:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &) override
 
virtual void beginRun (const edm::Run &r, const edm::EventSetup &) override
 
virtual void endJob (void) override
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &) override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
 IgProfModule (const edm::ParameterSet &ps)
 
virtual void respondToOpenInputFile (const edm::FileBlock &) override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void makeDump (const std::string &format)
 

Static Private Member Functions

static std::string replace (const std::string &s, const char *pat, int val)
 

Private Attributes

std::string atBeginJob_
 
std::string atBeginLumi_
 
std::string atBeginRun_
 
std::string atEndJob_
 
std::string atEndLumi_
 
std::string atEndRun_
 
std::string atEvent_
 
std::string atInputFile_
 
void(* dump_ )(const char *)
 
int nevent_
 
int nfile_
 
int nlumi_
 
int nrecord_
 
int nrun_
 
int prescale_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file IgProfModule.cc.

Constructor & Destructor Documentation

IgProfModule::IgProfModule ( const edm::ParameterSet ps)
inline

Definition at line 19 of file IgProfModule.cc.

References atBeginJob_, atBeginLumi_, atEndJob_, atEndLumi_, atEvent_, atInputFile_, dump_, edm::ParameterSet::getUntrackedParameter(), prescale_, and AlCaHLTBitMon_QueryRunRegistry::string.

20  : dump_(0),
21  prescale_(0),
22  nrecord_(0),
23  nevent_(0),
24  nrun_(0),
25  nlumi_(0),
26  nfile_(0)
27  {
28  // Removing the __extension__ gives a warning which
29  // is acknowledged as a language problem in the C++ Standard Core
30  // Language Defect Report
31  //
32  // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195
33  //
34  // since the suggested decision seems to be that the syntax should
35  // actually be "Conditionally-Supported Behavior" in some
36  // future C++ standard I simply silence the warning.
37  if (void *sym = dlsym(0, "igprof_dump_now"))
38  dump_ = __extension__ (void(*)(const char *)) sym;
39  else
40  edm::LogWarning("IgProfModule")
41  << "IgProfModule requested but application is not"
42  << " currently being profiled with igprof\n";
43 
44  prescale_ = ps.getUntrackedParameter<int>("reportEventInterval", prescale_);
45  atBeginJob_ = ps.getUntrackedParameter<std::string>("reportToFileAtBeginJob", atBeginJob_);
46  atEndJob_ = ps.getUntrackedParameter<std::string>("reportToFileAtEndJob", atEndJob_);
47  atBeginLumi_ = ps.getUntrackedParameter<std::string>("reportToFileAtBeginLumi", atBeginLumi_);
48  atEndLumi_ = ps.getUntrackedParameter<std::string>("reportToFileAtEndLumi", atEndLumi_);
49  atInputFile_ = ps.getUntrackedParameter<std::string>("reportToFileAtInputFile", atInputFile_);
50  atEvent_ = ps.getUntrackedParameter<std::string>("reportToFileAtEvent", atEvent_);
51  }
std::string atInputFile_
std::string atEndLumi_
void(* dump_)(const char *)
std::string atEndJob_
std::string atEvent_
std::string atBeginJob_
std::string atBeginLumi_

Member Function Documentation

virtual void IgProfModule::analyze ( const edm::Event e,
const edm::EventSetup  
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 59 of file IgProfModule.cc.

References atEvent_, edm::EventID::event(), edm::EventBase::id(), makeDump(), nevent_, nrecord_, and prescale_.

60  {
61  nevent_ = e.id().event();
62  if (prescale_ > 0 && (++nrecord_ % prescale_) == 1)
64  }
EventNumber_t event() const
Definition: EventID.h:44
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
edm::EventID id() const
Definition: EventBase.h:56
std::string atEvent_
virtual void IgProfModule::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file IgProfModule.cc.

References atBeginJob_, and makeDump().

54  { makeDump(atBeginJob_); }
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
std::string atBeginJob_
virtual void IgProfModule::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file IgProfModule.cc.

References atBeginLumi_, edm::LuminosityBlockBase::luminosityBlock(), makeDump(), and nlumi_.

void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
LuminosityBlockNumber_t luminosityBlock() const
std::string atBeginLumi_
virtual void IgProfModule::beginRun ( const edm::Run r,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file IgProfModule.cc.

References atBeginRun_, makeDump(), nrun_, and edm::RunBase::run().

67  { nrun_ = r.run(); makeDump(atBeginRun_); }
RunNumber_t run() const
Definition: RunBase.h:42
std::string atBeginRun_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
virtual void IgProfModule::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file IgProfModule.cc.

References atEndJob_, and makeDump().

57  { makeDump(atEndJob_); }
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
std::string atEndJob_
virtual void IgProfModule::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file IgProfModule.cc.

References atEndLumi_, and makeDump().

76  { makeDump(atEndLumi_); }
std::string atEndLumi_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
virtual void IgProfModule::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file IgProfModule.cc.

References atEndRun_, and makeDump().

70  { makeDump(atEndRun_); }
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82
std::string atEndRun_
void IgProfModule::makeDump ( const std::string &  format)
inlineprivate

Definition at line 82 of file IgProfModule.cc.

References dump_, cmsPerfStripChart::format, nevent_, nfile_, nlumi_, nrecord_, nrun_, replace(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze(), beginJob(), beginLuminosityBlock(), beginRun(), endJob(), endLuminosityBlock(), endRun(), and respondToOpenInputFile().

83  {
84  if (! dump_ || format.empty())
85  return;
86 
87  std::string final(format);
88  final = replace(final, "%I", nrecord_);
89  final = replace(final, "%E", nevent_);
90  final = replace(final, "%R", nrun_);
91  final = replace(final, "%L", nlumi_);
92  final = replace(final, "%F", nfile_);
93  dump_(final.c_str());
94  }
string format
Some error handling for the usage.
void(* dump_)(const char *)
static std::string replace(const std::string &s, const char *pat, int val)
Definition: IgProfModule.cc:96
static std::string IgProfModule::replace ( const std::string &  s,
const char *  pat,
int  val 
)
inlinestaticprivate

Definition at line 96 of file IgProfModule.cc.

References n, query::result, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeDump().

97  {
98  size_t pos = 0;
99  size_t patlen = strlen(pat);
100  std::string result = s;
101  while ((pos = result.find(pat, pos)) != std::string::npos)
102  {
103  char buf[64];
104  int n = sprintf(buf, "%d", val);
105  result.replace(pos, patlen, buf);
106  pos = pos - patlen + n;
107  }
108 
109  return result;
110  }
tuple result
Definition: query.py:137
virtual void IgProfModule::respondToOpenInputFile ( const edm::FileBlock )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file IgProfModule.cc.

References atInputFile_, makeDump(), and nfile_.

std::string atInputFile_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:82

Member Data Documentation

std::string IgProfModule::atBeginJob_
private

Definition at line 113 of file IgProfModule.cc.

Referenced by beginJob(), and IgProfModule().

std::string IgProfModule::atBeginLumi_
private

Definition at line 117 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atBeginRun_
private

Definition at line 115 of file IgProfModule.cc.

Referenced by beginRun().

std::string IgProfModule::atEndJob_
private

Definition at line 114 of file IgProfModule.cc.

Referenced by endJob(), and IgProfModule().

std::string IgProfModule::atEndLumi_
private

Definition at line 118 of file IgProfModule.cc.

Referenced by endLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atEndRun_
private

Definition at line 116 of file IgProfModule.cc.

Referenced by endRun().

std::string IgProfModule::atEvent_
private

Definition at line 120 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().

std::string IgProfModule::atInputFile_
private

Definition at line 119 of file IgProfModule.cc.

Referenced by IgProfModule(), and respondToOpenInputFile().

void(* IgProfModule::dump_)(const char *)
private

Definition at line 112 of file IgProfModule.cc.

Referenced by IgProfModule(), and makeDump().

int IgProfModule::nevent_
private

Definition at line 123 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

int IgProfModule::nfile_
private

Definition at line 126 of file IgProfModule.cc.

Referenced by makeDump(), and respondToOpenInputFile().

int IgProfModule::nlumi_
private

Definition at line 125 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and makeDump().

int IgProfModule::nrecord_
private

Definition at line 122 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

int IgProfModule::nrun_
private

Definition at line 124 of file IgProfModule.cc.

Referenced by beginRun(), and makeDump().

int IgProfModule::prescale_
private

Definition at line 121 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().