CMS 3D CMS Logo

Classes | Functions | Variables
edm::service Namespace Reference

Classes

class  AbstractMLscribe
 
class  CheckTransitions
 
struct  close_and_delete
 
class  ConcurrentModuleTimer
 
class  CondorStatusService
 
class  CPU
 
class  ELadministrator
 
class  ELdestination
 
class  ELlimitsTable
 
class  ELoutput
 
class  ELstatistics
 
class  IgProfService
 
class  InitRootHandlers
 
class  JobReportService
 
class  LoadAllDictionaries
 
class  MainThreadMLscribe
 
class  MessageLogger
 
struct  MessageLoggerDefaults
 
class  MessageLoggerScribe
 
class  MessageServicePresence
 
class  MessageServicePSetValidation
 
class  PrescaleService
 
struct  ProcInfo
 
class  ProcInfoFetcher
 
class  ProductRegistryDumper
 
class  RandomNumberGeneratorService
 
class  ResourceEnforcer
 
class  SilentMLscribe
 
class  SimpleMemoryCheck
 
class  SingleThreadMSPresence
 
class  SiteLocalConfigService
 
struct  smapsInfo
 
class  StallMonitor
 
class  SystemBounds
 
class  ThreadQueue
 
class  ThreadSafeLogMessageLoggerScribe
 
class  Timing
 
class  Tracer
 
class  TriggerNamesService
 
class  UnixSignalService
 

Functions

int cmssw_stacktrace (void *)
 
static void cmssw_stacktrace_fork ()
 
static std::string d2str (double d)
 
static std::string d2str (double d)
 
static ELstring formatTime (const time_t t)
 
static double getCPU ()
 
static double getTime ()
 
static std::string i2str (int i)
 
bool isProcessWideService (CPU const *)
 
bool isProcessWideService (DependencyGraph const *)
 
bool isProcessWideService (InitRootHandlers const *)
 
bool isProcessWideService (JobReportService const *)
 
bool isProcessWideService (MessageLogger const *)
 
bool isProcessWideService (SiteLocalConfigService const *)
 
bool isProcessWideService (TFileAdaptor const *)
 
bool isProcessWideService (TFileService const *)
 
bool isProcessWideService (void const *)
 
static std::vector< double > & moduleTimeStack ()
 
std::ostream & operator<< (std::ostream &os, SimpleMemoryCheck::SignificantEvent const &se)
 
std::ostream & operator<< (std::ostream &os, SimpleMemoryCheck::SignificantModule const &se)
 
static double popStack ()
 
static void pushStack (bool configuredInTopLevelProcess)
 
static std::string summarizeContext (const std::string &c)
 
static std::string ui2str (unsigned int i)
 

Variables

static char dashC [] = "-c"
 
static const ELstring hereMsg = "available via this destination"
 
static const ELstring noosMsg = "No ostream"
 
static const ELstring notELoutputMsg = "This destination is not an ELoutput"
 
static char pstackName [] = "(CMSSW stack trace helper)"
 

Function Documentation

◆ cmssw_stacktrace()

int edm::service::cmssw_stacktrace ( void *  )

Definition at line 718 of file InitRootHandlers.cc.

718  {
719  set_default_signals();
720 
722  // NOTE: this is NOT async-signal-safe at CERN's lxplus service.
723  // CERN uses LD_PRELOAD to replace execv with a function from libsnoopy which
724  // calls dlsym.
725 #ifdef __linux__
726  syscall(SYS_execve, "/bin/sh", argv, __environ);
727 #else
728  execv("/bin/sh", argv);
729 #endif
730  ::abort();
731  return 1;
732  }

References cmsBatch::argv, and edm::service::InitRootHandlers::getPstackArgv().

Referenced by cmssw_stacktrace_fork().

◆ cmssw_stacktrace_fork()

void edm::service::cmssw_stacktrace_fork ( )
static

Definition at line 687 of file InitRootHandlers.cc.

687  {
688  char child_stack[4 * 1024];
689  char* child_stack_ptr = child_stack + 4 * 1024;
690  // On Linux, we currently use jemalloc. This registers pthread_atfork handlers; these
691  // handlers are *not* async-signal safe. Hence, a deadlock is possible if we invoke
692  // fork() from our signal handlers. Accordingly, we use clone (not POSIX, but AS-safe)
693  // as that is closer to the 'raw metal' syscall and avoids pthread_atfork handlers.
694  int pid =
695 #ifdef __linux__
696  clone(edm::service::cmssw_stacktrace, child_stack_ptr, CLONE_VM | CLONE_FS | SIGCHLD, nullptr);
697 #else
698  fork();
699  if (child_stack_ptr) {
700  } // Suppress 'unused variable' warning on non-Linux
701  if (pid == 0) {
703  }
704 #endif
705  if (pid == -1) {
706  full_cerr_write("(Attempt to perform stack dump failed.)\n");
707  } else {
708  int status;
709  if (waitpid(pid, &status, 0) == -1) {
710  full_cerr_write("(Failed to wait on stack dump output.)\n");
711  }
712  if (status) {
713  full_cerr_write("(GDB stack trace failed unexpectedly)\n");
714  }
715  }
716  }

References clone(), cmssw_stacktrace(), and mps_update::status.

Referenced by edm::service::InitRootHandlers::stacktraceHelperThread().

◆ d2str() [1/2]

static std::string edm::service::d2str ( double  d)
static

Definition at line 157 of file Timing.cc.

157  {
158  std::stringstream t;
159  t << d;
160  return t.str();
161  }

References ztail::d, and OrderedSet::t.

◆ d2str() [2/2]

static std::string edm::service::d2str ( double  d)
static

Definition at line 277 of file SimpleMemoryCheck.cc.

277  {
278  std::ostringstream t;
279  t << d;
280  return t.str();
281  }

References ztail::d, and OrderedSet::t.

Referenced by edm::service::SimpleMemoryCheck::eventStatOutput(), edm::service::CPU::postEndJob(), edm::service::Timing::postEndJob(), and edm::service::SimpleMemoryCheck::postEndJob().

◆ formatTime()

static ELstring edm::service::formatTime ( const time_t  t)
static

Definition at line 98 of file ELoutput.cc.

98  { // Change log 7
99 
100  static char const dummy[] = "dd-Mon-yyyy hh:mm:ss TZN "; // Change log 7 for length only
101  char ts[sizeof(dummy)]; // Change log 7
102 
103  struct tm timebuf; // Change log 7
104 
105  strftime(ts, sizeof(dummy), "%d-%b-%Y %H:%M:%S %Z", localtime_r(&t, &timebuf)); // Change log 7
106  // mf 4-9-04
107 
108 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
109  // strip trailing blanks that would come when the time zone is not as
110  // long as the maximum allowed - probably not worth the time
111  unsigned int b = strlen(ts);
112  while (ts[--b] == ' ') {
113  ts[b] = 0;
114  }
115 #endif
116 
117  ELstring result(ts); // Change log 7
118  return result; // Change log 7
119  } // formatTime()

References b, mps_fire::result, and OrderedSet::t.

Referenced by edm::service::ELoutput::changeFile(), Vx3DHLTAnalyzer::dqmEndLuminosityBlock(), edm::service::ELoutput::ELoutput(), edm::service::ELoutput::log(), Vx3DHLTAnalyzer::reset(), and Vx3DHLTAnalyzer::writeToFile().

◆ getCPU()

static double edm::service::getCPU ( )
static

Definition at line 176 of file Timing.cc.

176  {
177  struct rusage usage;
178  getrusage(RUSAGE_SELF, &usage);
179 
180  double totalCPUTime = 0.0;
181  // User code
182  totalCPUTime = (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6);
183  // System functions
184  totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6);
185 
186  // Additionally, add in CPU usage from our child processes.
187  getrusage(RUSAGE_CHILDREN, &usage);
188  totalCPUTime += (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6);
189  totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6);
190 
191  return totalCPUTime;
192  }

References usage().

Referenced by edm::service::Timing::getTotalCPU(), edm::service::Timing::postBeginJob(), and edm::service::Timing::postEndJob().

◆ getTime()

static double edm::service::getTime ( )
static

Definition at line 169 of file Timing.cc.

169  {
170  struct timeval t;
171  if (gettimeofday(&t, nullptr) < 0)
172  throw cms::Exception("SysCallFailed", "Failed call to gettimeofday");
173  return static_cast<double>(t.tv_sec) + (static_cast<double>(t.tv_usec) * 1E-6);
174  }

References Exception, and OrderedSet::t.

Referenced by edm::service::Timing::accumulateTimeBegin(), edm::service::Timing::accumulateTimeEnd(), popStack(), edm::service::Timing::postBeginJob(), edm::service::Timing::postEndJob(), edm::service::Timing::postEvent(), edm::service::Timing::preEvent(), and pushStack().

◆ i2str()

static std::string edm::service::i2str ( int  i)
static

Definition at line 283 of file SimpleMemoryCheck.cc.

283  {
284  std::ostringstream t;
285  t << i;
286  return t.str();
287  }

References mps_fire::i, and OrderedSet::t.

Referenced by edm::service::SimpleMemoryCheck::eventStatOutput(), edm::service::CPU::postEndJob(), and edm::service::SimpleMemoryCheck::postEndJob().

◆ isProcessWideService() [1/9]

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

Definition at line 57 of file CPU.cc.

57 { return true; }

◆ isProcessWideService() [2/9]

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

Definition at line 343 of file DependencyGraph.cc.

343 { return true; }

◆ isProcessWideService() [3/9]

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

Definition at line 132 of file InitRootHandlers.cc.

132 { return true; }

◆ isProcessWideService() [4/9]

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

Definition at line 46 of file JobReportService.h.

46 { return true; }

◆ isProcessWideService() [5/9]

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

Definition at line 173 of file MessageLogger.h.

173 { return true; }

◆ isProcessWideService() [6/9]

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

Definition at line 93 of file SiteLocalConfigService.h.

93 { return true; }

◆ isProcessWideService() [7/9]

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

Definition at line 54 of file TFileAdaptor.h.

54 { return true; }

◆ isProcessWideService() [8/9]

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

Definition at line 98 of file TFileService.h.

98 { return true; }

Referenced by edm::serviceregistry::ServiceMaker< T, TMaker >::processWideService().

◆ isProcessWideService() [9/9]

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

Definition at line 29 of file ServiceMakerBase.h.

29 { return false; }

◆ moduleTimeStack()

static std::vector<double>& edm::service::moduleTimeStack ( )
static

Definition at line 197 of file Timing.cc.

197  {
198  static thread_local std::vector<double> s_stack;
199  return s_stack;
200  }

Referenced by popStack(), and pushStack().

◆ operator<<() [1/2]

std::ostream & edm::service::operator<< ( std::ostream &  os,
SimpleMemoryCheck::SignificantEvent const &  se 
)

Definition at line 987 of file SimpleMemoryCheck.cc.

987  {
988  os << "[" << se.count << "] " << se.event << " vsize = " << se.vsize << " deltaVsize = " << se.deltaVsize
989  << " rss = " << se.rss << " delta = " << se.deltaRss;
990 
991  if (se.monitorPssAndPrivate) {
992  os << " private = " << se.privateSize << " pss = " << se.pss;
993  }
994  return os;
995  }

References edm::service::SimpleMemoryCheck::SignificantEvent::count, edm::service::SimpleMemoryCheck::SignificantEvent::deltaRss, edm::service::SimpleMemoryCheck::SignificantEvent::deltaVsize, edm::service::SimpleMemoryCheck::SignificantEvent::event, edm::service::SimpleMemoryCheck::SignificantEvent::monitorPssAndPrivate, edm::service::SimpleMemoryCheck::SignificantEvent::privateSize, edm::service::SimpleMemoryCheck::SignificantEvent::pss, edm::service::SimpleMemoryCheck::SignificantEvent::rss, and edm::service::SimpleMemoryCheck::SignificantEvent::vsize.

◆ operator<<() [2/2]

std::ostream & edm::service::operator<< ( std::ostream &  os,
SimpleMemoryCheck::SignificantModule const &  se 
)

Definition at line 997 of file SimpleMemoryCheck.cc.

997  {
998  if (sm.postEarlyCount > 0) {
999  os << "\nPost Early Events: TotalDeltaVsize: " << sm.totalDeltaVsize
1000  << " (avg: " << sm.totalDeltaVsize / sm.postEarlyCount << "; max: " << sm.maxDeltaVsize << " during "
1001  << sm.eventMaxDeltaV << ")";
1002  }
1003  if (sm.totalEarlyVsize > 0) {
1004  os << "\n Early Events: TotalDeltaVsize: " << sm.totalEarlyVsize << " (max: " << sm.maxEarlyVsize << ")";
1005  }
1006 
1007  return os;
1008  }

References edm::service::SimpleMemoryCheck::SignificantModule::eventMaxDeltaV, edm::service::SimpleMemoryCheck::SignificantModule::maxDeltaVsize, edm::service::SimpleMemoryCheck::SignificantModule::maxEarlyVsize, edm::service::SimpleMemoryCheck::SignificantModule::postEarlyCount, edm::service::SimpleMemoryCheck::SignificantModule::totalDeltaVsize, and edm::service::SimpleMemoryCheck::SignificantModule::totalEarlyVsize.

◆ popStack()

static double edm::service::popStack ( )
static

Definition at line 202 of file Timing.cc.

202  {
203  auto& modStack = moduleTimeStack();
204  assert(!modStack.empty());
205  double curr_module_time = modStack.back();
206  modStack.pop_back();
207  double t = getTime() - curr_module_time;
208  return t;
209  }

References cms::cuda::assert(), getTime(), moduleTimeStack(), and OrderedSet::t.

Referenced by edm::service::Timing::postCommon().

◆ pushStack()

static void edm::service::pushStack ( bool  configuredInTopLevelProcess)
static

Definition at line 211 of file Timing.cc.

211  {
212  if (!configuredInTopLevelProcess) {
213  return;
214  }
215  auto& modStack = moduleTimeStack();
216  modStack.push_back(getTime());
217  }

References getTime(), and moduleTimeStack().

Referenced by edm::service::Timing::preModule(), edm::service::Timing::preModuleGlobal(), edm::service::Timing::preModuleStream(), edm::service::Timing::preOpenFile(), edm::service::Timing::preSourceEvent(), edm::service::Timing::preSourceLumi(), and edm::service::Timing::preSourceRun().

◆ summarizeContext()

static std::string edm::service::summarizeContext ( const std::string &  c)
static

Definition at line 127 of file ELstatistics.cc.

127  {
128  if (c.substr(0, 4) != "Run:")
129  return c;
130  std::istringstream is(c);
131  std::string runWord;
132  int run;
133  is >> runWord >> run;
134  if (!is)
135  return c;
136  if (runWord != "Run:")
137  return c;
138  std::string eventWord;
139  int event;
140  is >> eventWord >> event;
141  if (!is)
142  return c;
143  if (eventWord != "Event:")
144  return c;
145  std::ostringstream os;
146  os << run << "/" << event;
147  return os.str();
148  }

References HltBtagPostValidation_cff::c, event(), writedatasetfile::run, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::service::ELstatistics::log().

◆ ui2str()

static std::string edm::service::ui2str ( unsigned int  i)
static

Definition at line 163 of file Timing.cc.

163  {
164  std::stringstream t;
165  t << i;
166  return t.str();
167  }

References mps_fire::i, and OrderedSet::t.

Referenced by edm::service::Timing::postEndJob().

Variable Documentation

◆ dashC

char edm::service::dashC[] = "-c"
static

Definition at line 735 of file InitRootHandlers.cc.

◆ hereMsg

const ELstring edm::service::hereMsg = "available via this destination"
static

Definition at line 82 of file ELdestination.cc.

◆ noosMsg

const ELstring edm::service::noosMsg = "No ostream"
static

◆ notELoutputMsg

const ELstring edm::service::notELoutputMsg = "This destination is not an ELoutput"
static

Definition at line 84 of file ELdestination.cc.

Referenced by edm::service::ELdestination::changeFile().

◆ pstackName

char edm::service::pstackName[] = "(CMSSW stack trace helper)"
static

Definition at line 734 of file InitRootHandlers.cc.

cmsBatch.argv
argv
Definition: cmsBatch.py:279
mps_fire.i
i
Definition: mps_fire.py:355
mps_update.status
status
Definition: mps_update.py:69
edm::service::getTime
static double getTime()
Definition: Timing.cc:169
cms::cuda::assert
assert(be >=bs)
edm::ELstring
std::string ELstring
Definition: ELstring.h:21
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
OrderedSet.t
t
Definition: OrderedSet.py:90
b
double b
Definition: hdecay.h:118
edm::service::InitRootHandlers::getPstackArgv
static char *const * getPstackArgv()
Definition: InitRootHandlers.cc:877
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::service::moduleTimeStack
static std::vector< double > & moduleTimeStack()
Definition: Timing.cc:197
writedatasetfile.run
run
Definition: writedatasetfile.py:27
usage
void usage()
Definition: array2xmlEB.cc:14
Exception
Definition: hltDiff.cc:246
edm::service::cmssw_stacktrace
int cmssw_stacktrace(void *)
Definition: InitRootHandlers.cc:718
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:303
dummy
Definition: DummySelector.h:38
event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of "!*" before the partial wildcard feature was incorporated). The per-event "cost" of each negative criterion with multiple relevant triggers is about the same as ! *was in the past