CMS 3D CMS Logo

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

void analyze (const edm::Event &e, const edm::EventSetup &) override
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &) override
 
void beginRun (const edm::Run &r, const edm::EventSetup &) override
 
void endJob (void) override
 
void endLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
 IgProfModule (const edm::ParameterSet &ps)
 
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
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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_(nullptr),
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(nullptr, "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_
edm::EventNumber_t nevent_
std::string atEndJob_
edm::RunNumber_t nrun_
void(* dump_)(const char *)
HLT enums.
std::string atEvent_
std::string atBeginJob_
std::string atBeginLumi_

Member Function Documentation

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

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:60
std::string atEvent_
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_
void IgProfModule::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverride

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_
void IgProfModule::beginRun ( const edm::Run r,
const edm::EventSetup  
)
inlineoverride

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_
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_
void IgProfModule::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverride

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
void IgProfModule::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverride

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_
static std::string replace(const std::string &s, const char *pat, int val)
Definition: IgProfModule.cc:97
edm::EventNumber_t nevent_
format
Some error handling for the usage.
edm::RunNumber_t nrun_
static std::string replaceU64(const std::string &s, const char *pat, unsigned long long val)
void(* dump_)(const char *)
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, mps_fire::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  }
Definition: HeavyIon.h:7
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, mps_fire::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  }
Definition: HeavyIon.h:7
void IgProfModule::respondToOpenInputFile ( const edm::FileBlock )
inlineoverride

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().