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
edm::service::IgProfService Class Reference

#include <IgProfService.h>

Public Member Functions

 IgProfService (const ParameterSet &, ActivityRegistry &)
 
bool isProcessWideService (IgProfService const *)
 
void postBeginJob ()
 
void postBeginLumi (LuminosityBlock const &run, EventSetup const &es)
 
void postBeginRun (Run const &run, EventSetup const &es)
 
void postCloseFile (std::string const &, bool)
 
void postEndJob ()
 
void postEndLumi (LuminosityBlock const &run, EventSetup const &es)
 
void postEndRun (Run const &run, EventSetup const &es)
 
void postEvent (Event const &ev, EventSetup const &es)
 
void postOpenFile (std::string const &, bool)
 
void preEvent (EventID const &id, Timestamp const &ts)
 

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 atPostBeginJob_
 
std::string atPostBeginLumi_
 
std::string atPostBeginRun_
 
std::string atPostCloseFile_
 
std::string atPostEndJob_
 
std::string atPostEndLumi_
 
std::string atPostEndRun_
 
std::string atPostEvent_
 
std::string atPostOpenFile_
 
std::string atPreEvent_
 
void(* dump_ )(const char *)
 
int mineventrecord_
 
int nevent_
 
int nfileclosed_
 
int nfileopened_
 
int nlumi_
 
int nrecord_
 
int nrun_
 
int prescale_
 

Detailed Description

Definition at line 16 of file IgProfService.h.

Constructor & Destructor Documentation

IgProfService::IgProfService ( const ParameterSet ps,
ActivityRegistry iRegistry 
)

Definition at line 25 of file IgProfService.cc.

References atPostBeginJob_, atPostBeginLumi_, atPostBeginRun_, atPostCloseFile_, atPostEndJob_, atPostEndLumi_, atPostEndRun_, atPostEvent_, atPostOpenFile_, atPreEvent_, dump_, edm::ParameterSet::getUntrackedParameter(), mineventrecord_, postBeginJob(), postBeginLumi(), postBeginRun(), postCloseFile(), postEndJob(), postEndLumi(), postEndRun(), postEvent(), postOpenFile(), preEvent(), prescale_, AlCaHLTBitMon_QueryRunRegistry::string, edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostBeginLumi(), edm::ActivityRegistry::watchPostBeginRun(), edm::ActivityRegistry::watchPostCloseFile(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostEndLumi(), edm::ActivityRegistry::watchPostEndRun(), edm::ActivityRegistry::watchPostOpenFile(), edm::ActivityRegistry::watchPostProcessEvent(), and edm::ActivityRegistry::watchPreProcessEvent().

27  : dump_(0),
28  mineventrecord_(1),
29  prescale_(1),
30  nrecord_(0),
31  nevent_(0),
32  nrun_(0),
33  nlumi_(0),
34  nfileopened_(0),
35  nfileclosed_(0) {
36 
37 
38  // Removing the __extension__ gives a warning which
39  // is acknowledged as a language problem in the C++ Standard Core
40  // Language Defect Report
41  //
42  // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195
43  //
44  // since the suggested decision seems to be that the syntax should
45  // actually be "Conditionally-Supported Behavior" in some
46  // future C++ standard I simply silence the warning.
47  if (void *sym = dlsym(0, "igprof_dump_now")) {
48  dump_ = __extension__ (void(*)(const char *)) sym;
49  } else
50  edm::LogWarning("IgProfModule")
51  << "IgProfModule requested but application is not"
52  << " currently being profiled with igprof\n";
53 
54  // Get the configuration
55  prescale_
56  = ps.getUntrackedParameter<int>("reportEventInterval", prescale_);
58  = ps.getUntrackedParameter<int>("reportFirstEvent", mineventrecord_);
59 
61  = ps.getUntrackedParameter<std::string>("reportToFileAtPostBeginJob", atPostBeginJob_);
63  = ps.getUntrackedParameter<std::string>("reportToFileAtPostBeginRun", atPostBeginRun_);
65  = ps.getUntrackedParameter<std::string>("reportToFileAtPostBeginLumi", atPostBeginLumi_);
66 
68  = ps.getUntrackedParameter<std::string>("reportToFileAtPreEvent", atPreEvent_);
70  = ps.getUntrackedParameter<std::string>("reportToFileAtPostEvent", atPostEvent_);
71 
73  = ps.getUntrackedParameter<std::string>("reportToFileAtPostEndLumi", atPostEndLumi_);
75  = ps.getUntrackedParameter<std::string>("reportToFileAtPostEndRun", atPostEndRun_);
77  = ps.getUntrackedParameter<std::string>("reportToFileAtPostEndJob", atPostEndJob_);
78 
80  = ps.getUntrackedParameter<std::string>("reportToFileAtPostOpenFile", atPostOpenFile_);
82  = ps.getUntrackedParameter<std::string>("reportToFileAtPostCloseFile", atPostCloseFile_);
83 
84 
85  // Register for the framework signals
86  iRegistry.watchPostBeginJob(this, &IgProfService::postBeginJob);
87  iRegistry.watchPostBeginRun(this, &IgProfService::postBeginRun);
88  iRegistry.watchPostBeginLumi(this, &IgProfService::postBeginLumi);
89 
90  iRegistry.watchPreProcessEvent(this, &IgProfService::preEvent);
91  iRegistry.watchPostProcessEvent(this, &IgProfService::postEvent);
92 
93  iRegistry.watchPostEndLumi(this, &IgProfService::postEndLumi);
94  iRegistry.watchPostEndRun(this, &IgProfService::postEndRun);
95  iRegistry.watchPostEndJob(this, &IgProfService::postEndJob);
96 
97  iRegistry.watchPostOpenFile(this, &IgProfService::postOpenFile);
98  iRegistry.watchPostCloseFile(this, &IgProfService::postCloseFile);
99 
100 }
void postEvent(Event const &ev, EventSetup const &es)
void postCloseFile(std::string const &, bool)
void preEvent(EventID const &id, Timestamp const &ts)
void postBeginRun(Run const &run, EventSetup const &es)
void postBeginLumi(LuminosityBlock const &run, EventSetup const &es)
void postOpenFile(std::string const &, bool)
void postEndRun(Run const &run, EventSetup const &es)
void(* dump_)(const char *)
Definition: IgProfService.h:52
void postEndLumi(LuminosityBlock const &run, EventSetup const &es)

Member Function Documentation

bool edm::service::IgProfService::isProcessWideService ( IgProfService const *  )
inline

Definition at line 42 of file IgProfService.h.

42  {
43  return true;
44  }
void IgProfService::makeDump ( const std::string &  format)
private

Definition at line 154 of file IgProfService.cc.

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

Referenced by postBeginJob(), postBeginLumi(), postBeginRun(), postCloseFile(), postEndJob(), postEndLumi(), postEndRun(), postEvent(), postOpenFile(), and preEvent().

154  {
155  if (! dump_ || format.empty())
156  return;
157 
158  std::string final(format);
159  final = replace(final, "%I", nrecord_);
160  final = replace(final, "%E", nevent_);
161  final = replace(final, "%R", nrun_);
162  final = replace(final, "%L", nlumi_);
163  final = replace(final, "%F", nfileopened_);
164  final = replace(final, "%C", nfileclosed_);
165  dump_(final.c_str());
166 }
string format
Some error handling for the usage.
void(* dump_)(const char *)
Definition: IgProfService.h:52
static std::string replace(const std::string &s, const char *pat, int val)
void IgProfService::postBeginJob ( )

Definition at line 102 of file IgProfService.cc.

References atPostBeginJob_, and makeDump().

Referenced by IgProfService().

102  {
104 }
void makeDump(const std::string &format)
void IgProfService::postBeginLumi ( LuminosityBlock const &  run,
EventSetup const &  es 
)

Definition at line 110 of file IgProfService.cc.

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

Referenced by IgProfService().

111  {
112  nlumi_ = l.luminosityBlock(); makeDump(atPostBeginLumi_);
113 }
void makeDump(const std::string &format)
void IgProfService::postBeginRun ( Run const &  run,
EventSetup const &  es 
)

Definition at line 106 of file IgProfService.cc.

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

Referenced by IgProfService().

106  {
107  nrun_ = r.run(); makeDump(atPostBeginRun_);
108 }
void makeDump(const std::string &format)
void IgProfService::postCloseFile ( std::string const &  ,
bool   
)

Definition at line 149 of file IgProfService.cc.

References atPostCloseFile_, makeDump(), and nfileclosed_.

Referenced by IgProfService().

149  {
150  ++nfileclosed_;
152 }
void makeDump(const std::string &format)
void IgProfService::postEndJob ( )

Definition at line 140 of file IgProfService.cc.

References atPostEndJob_, and makeDump().

Referenced by IgProfService().

140  {
142 }
void makeDump(const std::string &format)
void IgProfService::postEndLumi ( LuminosityBlock const &  run,
EventSetup const &  es 
)

Definition at line 131 of file IgProfService.cc.

References atPostEndLumi_, and makeDump().

Referenced by IgProfService().

132  {
134 }
void makeDump(const std::string &format)
void IgProfService::postEndRun ( Run const &  run,
EventSetup const &  es 
)

Definition at line 136 of file IgProfService.cc.

References atPostEndRun_, and makeDump().

Referenced by IgProfService().

136  {
138 }
void makeDump(const std::string &format)
void IgProfService::postEvent ( Event const &  ev,
EventSetup const &  es 
)
void IgProfService::postOpenFile ( std::string const &  ,
bool   
)

Definition at line 144 of file IgProfService.cc.

References atPostOpenFile_, makeDump(), and nfileopened_.

Referenced by IgProfService().

144  {
145  ++nfileopened_;
147 }
void makeDump(const std::string &format)
void IgProfService::preEvent ( EventID const &  id,
Timestamp const &  ts 
)

Definition at line 115 of file IgProfService.cc.

References atPreEvent_, makeDump(), mineventrecord_, nevent_, nrecord_, and prescale_.

Referenced by IgProfService().

116  {
117  ++nrecord_; // count before events
118  nevent_ = id.event();
119  if ((prescale_ > 0) &&
120  (nrecord_ >= mineventrecord_) &&
122 }
void makeDump(const std::string &format)
std::string IgProfService::replace ( const std::string &  s,
const char *  pat,
int  val 
)
staticprivate

Definition at line 169 of file IgProfService.cc.

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

Referenced by makeDump().

169  {
170  size_t pos = 0;
171  size_t patlen = strlen(pat);
172  std::string result = s;
173  while ((pos = result.find(pat, pos)) != std::string::npos)
174  {
175  char buf[64];
176  int n = sprintf(buf, "%d", val);
177  result.replace(pos, patlen, buf);
178  pos = pos - patlen + n;
179  }
180 
181  return result;
182 }
tuple result
Definition: query.py:137

Member Data Documentation

std::string edm::service::IgProfService::atPostBeginJob_
private

Definition at line 54 of file IgProfService.h.

Referenced by IgProfService(), and postBeginJob().

std::string edm::service::IgProfService::atPostBeginLumi_
private

Definition at line 56 of file IgProfService.h.

Referenced by IgProfService(), and postBeginLumi().

std::string edm::service::IgProfService::atPostBeginRun_
private

Definition at line 55 of file IgProfService.h.

Referenced by IgProfService(), and postBeginRun().

std::string edm::service::IgProfService::atPostCloseFile_
private

Definition at line 66 of file IgProfService.h.

Referenced by IgProfService(), and postCloseFile().

std::string edm::service::IgProfService::atPostEndJob_
private

Definition at line 63 of file IgProfService.h.

Referenced by IgProfService(), and postEndJob().

std::string edm::service::IgProfService::atPostEndLumi_
private

Definition at line 61 of file IgProfService.h.

Referenced by IgProfService(), and postEndLumi().

std::string edm::service::IgProfService::atPostEndRun_
private

Definition at line 62 of file IgProfService.h.

Referenced by IgProfService(), and postEndRun().

std::string edm::service::IgProfService::atPostEvent_
private

Definition at line 59 of file IgProfService.h.

Referenced by IgProfService(), and postEvent().

std::string edm::service::IgProfService::atPostOpenFile_
private

Definition at line 65 of file IgProfService.h.

Referenced by IgProfService(), and postOpenFile().

std::string edm::service::IgProfService::atPreEvent_
private

Definition at line 58 of file IgProfService.h.

Referenced by IgProfService(), and preEvent().

void(* edm::service::IgProfService::dump_)(const char *)
private

Definition at line 52 of file IgProfService.h.

Referenced by IgProfService(), and makeDump().

int edm::service::IgProfService::mineventrecord_
private

Definition at line 68 of file IgProfService.h.

Referenced by IgProfService(), postEvent(), and preEvent().

int edm::service::IgProfService::nevent_
private

Definition at line 71 of file IgProfService.h.

Referenced by makeDump(), postEvent(), and preEvent().

int edm::service::IgProfService::nfileclosed_
private

Definition at line 75 of file IgProfService.h.

Referenced by makeDump(), and postCloseFile().

int edm::service::IgProfService::nfileopened_
private

Definition at line 74 of file IgProfService.h.

Referenced by makeDump(), and postOpenFile().

int edm::service::IgProfService::nlumi_
private

Definition at line 73 of file IgProfService.h.

Referenced by makeDump(), and postBeginLumi().

int edm::service::IgProfService::nrecord_
private

Definition at line 70 of file IgProfService.h.

Referenced by makeDump(), postEvent(), and preEvent().

int edm::service::IgProfService::nrun_
private

Definition at line 72 of file IgProfService.h.

Referenced by makeDump(), and postBeginRun().

int edm::service::IgProfService::prescale_
private

Definition at line 69 of file IgProfService.h.

Referenced by IgProfService(), postEvent(), and preEvent().