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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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)
 
static std::string replaceU64 (const std::string &s, const char *pat, unsigned long long 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 *)
 
edm::EventNumber_t nevent_
 
int nfile_
 
edm::LuminosityBlockNumber_t nlumi_
 
int nrecord_
 
edm::RunNumber_t nrun_
 
int prescale_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 17 of file IgProfModule.cc.

Constructor & Destructor Documentation

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

Definition at line 20 of file IgProfModule.cc.

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

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

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file IgProfModule.cc.

References atBeginJob_, and makeDump().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file IgProfModule.cc.

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

edm::LuminosityBlockNumber_t nlumi_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:83
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 67 of file IgProfModule.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file IgProfModule.cc.

References atEndJob_, and makeDump().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file IgProfModule.cc.

References atEndLumi_, and makeDump().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file IgProfModule.cc.

References atEndRun_, and makeDump().

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

Definition at line 83 of file IgProfModule.cc.

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

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

84  {
85  if (! dump_ || format.empty())
86  return;
87 
88  std::string final(format);
89  final = replace(final, "%I", nrecord_);
90  final = replaceU64(final, "%E", nevent_);
91  final = replaceU64(final, "%R", nrun_);
92  final = replaceU64(final, "%L", nlumi_);
93  final = replace(final, "%F", nfile_);
94  dump_(final.c_str());
95  }
edm::LuminosityBlockNumber_t nlumi_
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:97
edm::EventNumber_t nevent_
edm::RunNumber_t nrun_
static std::string replaceU64(const std::string &s, const char *pat, unsigned long long val)
static std::string IgProfModule::replace ( const std::string &  s,
const char *  pat,
int  val 
)
inlinestaticprivate

Definition at line 97 of file IgProfModule.cc.

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

Referenced by makeDump().

98  {
99  size_t pos = 0;
100  size_t patlen = strlen(pat);
101  std::string result = s;
102  while ((pos = result.find(pat, pos)) != std::string::npos)
103  {
104  char buf[64];
105  int n = sprintf(buf, "%d", val);
106  result.replace(pos, patlen, buf);
107  pos = pos - patlen + n;
108  }
109 
110  return result;
111  }
tuple result
Definition: query.py:137
static std::string IgProfModule::replaceU64 ( const std::string &  s,
const char *  pat,
unsigned long long  val 
)
inlinestaticprivate

Definition at line 113 of file IgProfModule.cc.

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

Referenced by makeDump().

114  {
115  size_t pos = 0;
116  size_t patlen = strlen(pat);
117  std::string result = s;
118  while ((pos = result.find(pat, pos)) != std::string::npos)
119  {
120  char buf[64];
121  int n = sprintf(buf, "%llu", val);
122  result.replace(pos, patlen, buf);
123  pos = pos - patlen + n;
124  }
125 
126  return result;
127  }
tuple result
Definition: query.py:137
virtual void IgProfModule::respondToOpenInputFile ( const edm::FileBlock )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file IgProfModule.cc.

References atInputFile_, makeDump(), and nfile_.

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

Member Data Documentation

std::string IgProfModule::atBeginJob_
private

Definition at line 130 of file IgProfModule.cc.

Referenced by beginJob(), and IgProfModule().

std::string IgProfModule::atBeginLumi_
private

Definition at line 134 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atBeginRun_
private

Definition at line 132 of file IgProfModule.cc.

Referenced by beginRun().

std::string IgProfModule::atEndJob_
private

Definition at line 131 of file IgProfModule.cc.

Referenced by endJob(), and IgProfModule().

std::string IgProfModule::atEndLumi_
private

Definition at line 135 of file IgProfModule.cc.

Referenced by endLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atEndRun_
private

Definition at line 133 of file IgProfModule.cc.

Referenced by endRun().

std::string IgProfModule::atEvent_
private

Definition at line 137 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().

std::string IgProfModule::atInputFile_
private

Definition at line 136 of file IgProfModule.cc.

Referenced by IgProfModule(), and respondToOpenInputFile().

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

Definition at line 129 of file IgProfModule.cc.

Referenced by IgProfModule(), and makeDump().

edm::EventNumber_t IgProfModule::nevent_
private

Definition at line 140 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

int IgProfModule::nfile_
private

Definition at line 143 of file IgProfModule.cc.

Referenced by makeDump(), and respondToOpenInputFile().

edm::LuminosityBlockNumber_t IgProfModule::nlumi_
private

Definition at line 142 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and makeDump().

int IgProfModule::nrecord_
private

Definition at line 139 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

edm::RunNumber_t IgProfModule::nrun_
private

Definition at line 141 of file IgProfModule.cc.

Referenced by beginRun(), and makeDump().

int IgProfModule::prescale_
private

Definition at line 138 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().