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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 19 of file IgProfModule.cc.

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

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

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

49  {
50  nevent_ = e.id().event();
51  if (prescale_ > 0 && (++nrecord_ % prescale_) == 1)
53  }
EventNumber_t event() const
Definition: EventID.h:40
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
edm::EventNumber_t nevent_
edm::EventID id() const
Definition: EventBase.h:59
std::string atEvent_
void IgProfModule::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file IgProfModule.cc.

References atBeginJob_, and makeDump().

void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
std::string atBeginJob_
void IgProfModule::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverride

Definition at line 62 of file IgProfModule.cc.

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

62  {
63  nlumi_ = l.luminosityBlock();
65  }
edm::LuminosityBlockNumber_t nlumi_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
LuminosityBlockNumber_t luminosityBlock() const
std::string atBeginLumi_
void IgProfModule::beginRun ( const edm::Run r,
const edm::EventSetup  
)
inlineoverride

Definition at line 55 of file IgProfModule.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file IgProfModule.cc.

References atEndJob_, and makeDump().

47 { makeDump(atEndJob_); }
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
std::string atEndJob_
void IgProfModule::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverride

Definition at line 67 of file IgProfModule.cc.

References atEndLumi_, and makeDump().

67 { makeDump(atEndLumi_); }
std::string atEndLumi_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
void IgProfModule::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverride

Definition at line 60 of file IgProfModule.cc.

References atEndRun_, and makeDump().

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

Definition at line 75 of file IgProfModule.cc.

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

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

75  {
76  if (!dump_ || format.empty())
77  return;
78 
79  std::string final(format);
80  final = replace(final, "%I", nrecord_);
81  final = replaceU64(final, "%E", nevent_);
82  final = replaceU64(final, "%R", nrun_);
83  final = replaceU64(final, "%L", nlumi_);
84  final = replace(final, "%F", nfile_);
85  dump_(final.c_str());
86  }
edm::LuminosityBlockNumber_t nlumi_
static std::string replace(const std::string &s, const char *pat, int val)
Definition: IgProfModule.cc:88
edm::EventNumber_t nevent_
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 88 of file IgProfModule.cc.

References dqmiodumpmetadata::n, mps_fire::result, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeDump().

88  {
89  size_t pos = 0;
90  size_t patlen = strlen(pat);
92  while ((pos = result.find(pat, pos)) != std::string::npos) {
93  char buf[64];
94  int n = sprintf(buf, "%d", val);
95  result.replace(pos, patlen, buf);
96  pos = pos - patlen + n;
97  }
98 
99  return result;
100  }
Definition: HeavyIon.h:7
static std::string IgProfModule::replaceU64 ( const std::string &  s,
const char *  pat,
unsigned long long  val 
)
inlinestaticprivate

Definition at line 102 of file IgProfModule.cc.

References dqmiodumpmetadata::n, mps_fire::result, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeDump().

102  {
103  size_t pos = 0;
104  size_t patlen = strlen(pat);
105  std::string result = s;
106  while ((pos = result.find(pat, pos)) != std::string::npos) {
107  char buf[64];
108  int n = sprintf(buf, "%llu", val);
109  result.replace(pos, patlen, buf);
110  pos = pos - patlen + n;
111  }
112 
113  return result;
114  }
Definition: HeavyIon.h:7
void IgProfModule::respondToOpenInputFile ( const edm::FileBlock )
inlineoverride

Definition at line 69 of file IgProfModule.cc.

References atInputFile_, makeDump(), and nfile_.

69  {
70  ++nfile_;
72  }
std::string atInputFile_
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75

Member Data Documentation

std::string IgProfModule::atBeginJob_
private

Definition at line 117 of file IgProfModule.cc.

Referenced by beginJob(), and IgProfModule().

std::string IgProfModule::atBeginLumi_
private

Definition at line 121 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atBeginRun_
private

Definition at line 119 of file IgProfModule.cc.

Referenced by beginRun().

std::string IgProfModule::atEndJob_
private

Definition at line 118 of file IgProfModule.cc.

Referenced by endJob(), and IgProfModule().

std::string IgProfModule::atEndLumi_
private

Definition at line 122 of file IgProfModule.cc.

Referenced by endLuminosityBlock(), and IgProfModule().

std::string IgProfModule::atEndRun_
private

Definition at line 120 of file IgProfModule.cc.

Referenced by endRun().

std::string IgProfModule::atEvent_
private

Definition at line 124 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().

std::string IgProfModule::atInputFile_
private

Definition at line 123 of file IgProfModule.cc.

Referenced by IgProfModule(), and respondToOpenInputFile().

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

Definition at line 116 of file IgProfModule.cc.

Referenced by IgProfModule(), and makeDump().

edm::EventNumber_t IgProfModule::nevent_
private

Definition at line 127 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

int IgProfModule::nfile_
private

Definition at line 130 of file IgProfModule.cc.

Referenced by makeDump(), and respondToOpenInputFile().

edm::LuminosityBlockNumber_t IgProfModule::nlumi_
private

Definition at line 129 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and makeDump().

int IgProfModule::nrecord_
private

Definition at line 126 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

edm::RunNumber_t IgProfModule::nrun_
private

Definition at line 128 of file IgProfModule.cc.

Referenced by beginRun(), and makeDump().

int IgProfModule::prescale_
private

Definition at line 125 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().