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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file IgProfModule.cc.

Constructor & Destructor Documentation

◆ IgProfModule()

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

Definition at line 19 of file IgProfModule.cc.

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  }

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

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 49 of file IgProfModule.cc.

49  {
50  nevent_ = e.id().event();
51  if (prescale_ > 0 && (++nrecord_ % prescale_) == 1)
53  }

References atEvent_, MillePedeFileConverter_cfg::e, makeDump(), nevent_, nrecord_, and prescale_.

◆ beginJob()

void IgProfModule::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file IgProfModule.cc.

References atBeginJob_, and makeDump().

◆ beginLuminosityBlock()

void IgProfModule::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file IgProfModule.cc.

62  {
63  nlumi_ = l.luminosityBlock();
65  }

References atBeginLumi_, cmsLHEtoEOSManager::l, makeDump(), and nlumi_.

◆ beginRun()

void IgProfModule::beginRun ( const edm::Run r,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file IgProfModule.cc.

55  {
56  nrun_ = r.run();
58  }

References atBeginRun_, makeDump(), nrun_, and alignCSCRings::r.

◆ endJob()

void IgProfModule::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file IgProfModule.cc.

47 { makeDump(atEndJob_); }

References atEndJob_, and makeDump().

◆ endLuminosityBlock()

void IgProfModule::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file IgProfModule.cc.

67 { makeDump(atEndLumi_); }

References atEndLumi_, and makeDump().

◆ endRun()

void IgProfModule::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file IgProfModule.cc.

60 { makeDump(atEndRun_); }

References atEndRun_, and makeDump().

◆ makeDump()

void IgProfModule::makeDump ( const std::string &  format)
inlineprivate

Definition at line 75 of file IgProfModule.cc.

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  }

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

◆ replace()

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

Definition at line 88 of file IgProfModule.cc.

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  }

References visDQMUpload::buf, dqmiodumpmetadata::n, mps_fire::result, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

Referenced by makeDump().

◆ replaceU64()

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.

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  }

References visDQMUpload::buf, dqmiodumpmetadata::n, mps_fire::result, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

Referenced by makeDump().

◆ respondToOpenInputFile()

void IgProfModule::respondToOpenInputFile ( const edm::FileBlock )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file IgProfModule.cc.

69  {
70  ++nfile_;
72  }

References atInputFile_, makeDump(), and nfile_.

Member Data Documentation

◆ atBeginJob_

std::string IgProfModule::atBeginJob_
private

Definition at line 117 of file IgProfModule.cc.

Referenced by beginJob(), and IgProfModule().

◆ atBeginLumi_

std::string IgProfModule::atBeginLumi_
private

Definition at line 121 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and IgProfModule().

◆ atBeginRun_

std::string IgProfModule::atBeginRun_
private

Definition at line 119 of file IgProfModule.cc.

Referenced by beginRun().

◆ atEndJob_

std::string IgProfModule::atEndJob_
private

Definition at line 118 of file IgProfModule.cc.

Referenced by endJob(), and IgProfModule().

◆ atEndLumi_

std::string IgProfModule::atEndLumi_
private

Definition at line 122 of file IgProfModule.cc.

Referenced by endLuminosityBlock(), and IgProfModule().

◆ atEndRun_

std::string IgProfModule::atEndRun_
private

Definition at line 120 of file IgProfModule.cc.

Referenced by endRun().

◆ atEvent_

std::string IgProfModule::atEvent_
private

Definition at line 124 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().

◆ atInputFile_

std::string IgProfModule::atInputFile_
private

Definition at line 123 of file IgProfModule.cc.

Referenced by IgProfModule(), and respondToOpenInputFile().

◆ dump_

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

Definition at line 116 of file IgProfModule.cc.

Referenced by IgProfModule(), and makeDump().

◆ nevent_

edm::EventNumber_t IgProfModule::nevent_
private

Definition at line 127 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

◆ nfile_

int IgProfModule::nfile_
private

Definition at line 130 of file IgProfModule.cc.

Referenced by makeDump(), and respondToOpenInputFile().

◆ nlumi_

edm::LuminosityBlockNumber_t IgProfModule::nlumi_
private

Definition at line 129 of file IgProfModule.cc.

Referenced by beginLuminosityBlock(), and makeDump().

◆ nrecord_

int IgProfModule::nrecord_
private

Definition at line 126 of file IgProfModule.cc.

Referenced by analyze(), and makeDump().

◆ nrun_

edm::RunNumber_t IgProfModule::nrun_
private

Definition at line 128 of file IgProfModule.cc.

Referenced by beginRun(), and makeDump().

◆ prescale_

int IgProfModule::prescale_
private

Definition at line 125 of file IgProfModule.cc.

Referenced by analyze(), and IgProfModule().

IgProfModule::atEndRun_
std::string atEndRun_
Definition: IgProfModule.cc:120
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
IgProfModule::nlumi_
edm::LuminosityBlockNumber_t nlumi_
Definition: IgProfModule.cc:129
IgProfModule::makeDump
void makeDump(const std::string &format)
Definition: IgProfModule.cc:75
pos
Definition: PixelAliasList.h:18
IgProfModule::atEvent_
std::string atEvent_
Definition: IgProfModule.cc:124
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
IgProfModule::atInputFile_
std::string atInputFile_
Definition: IgProfModule.cc:123
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
IgProfModule::nrecord_
int nrecord_
Definition: IgProfModule.cc:126
alignCSCRings.s
s
Definition: alignCSCRings.py:92
IgProfModule::dump_
void(* dump_)(const char *)
Definition: IgProfModule.cc:116
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
IgProfModule::atBeginRun_
std::string atBeginRun_
Definition: IgProfModule.cc:119
IgProfModule::nfile_
int nfile_
Definition: IgProfModule.cc:130
IgProfModule::atEndJob_
std::string atEndJob_
Definition: IgProfModule.cc:118
IgProfModule::nrun_
edm::RunNumber_t nrun_
Definition: IgProfModule.cc:128
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
IgProfModule::replace
static std::string replace(const std::string &s, const char *pat, int val)
Definition: IgProfModule.cc:88
IgProfModule::nevent_
edm::EventNumber_t nevent_
Definition: IgProfModule.cc:127
IgProfModule::atEndLumi_
std::string atEndLumi_
Definition: IgProfModule.cc:122
IgProfModule::atBeginLumi_
std::string atBeginLumi_
Definition: IgProfModule.cc:121
pat
Definition: HeavyIon.h:7
IgProfModule::replaceU64
static std::string replaceU64(const std::string &s, const char *pat, unsigned long long val)
Definition: IgProfModule.cc:102
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
alignCSCRings.r
r
Definition: alignCSCRings.py:93
heppy_batch.val
val
Definition: heppy_batch.py:351
IgProfModule::prescale_
int prescale_
Definition: IgProfModule.cc:125
format
IgProfModule::atBeginJob_
std::string atBeginJob_
Definition: IgProfModule.cc:117
mps_fire.result
result
Definition: mps_fire.py:311
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37