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  MessageLogger
 
struct  MessageLoggerDefaults
 
class  MessageServicePSetValidation
 
class  PrescaleService
 
struct  ProcInfo
 
class  ProcInfoFetcher
 
class  ProductRegistryDumper
 
class  RandomNumberGeneratorService
 
class  ResourceEnforcer
 
class  SimpleMemoryCheck
 
class  SingleThreadMSPresence
 
class  SiteLocalConfigService
 
struct  smapsInfo
 
class  StallMonitor
 
class  SystemBounds
 
class  TestService
 
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 double getChildrenCPU ()
 
static double getCPU ()
 
static double getTime ()
 
static std::string i2str (int i)
 
bool isProcessWideService (void const *)
 
bool isProcessWideService (JobReportService const *)
 
bool isProcessWideService (TFileAdaptor const *)
 
bool isProcessWideService (CPU const *)
 
bool isProcessWideService (TFileService const *)
 
bool isProcessWideService (SiteLocalConfigService const *)
 
bool isProcessWideService (InitRootHandlers const *)
 
bool isProcessWideService (MessageLogger const *)
 
bool isProcessWideService (DependencyGraph 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 ui2str (unsigned int i)
 

Variables

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

Function Documentation

◆ cmssw_stacktrace()

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

Definition at line 735 of file InitRootHandlers.cc.

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

Referenced by cmssw_stacktrace_fork().

735  {
736  set_default_signals();
737 
739  // NOTE: this is NOT async-signal-safe at CERN's lxplus service.
740  // CERN uses LD_PRELOAD to replace execv with a function from libsnoopy which
741  // calls dlsym.
742 #ifdef __linux__
743  syscall(SYS_execve, "/bin/sh", argv, __environ);
744 #else
745  execv("/bin/sh", argv);
746 #endif
747  ::abort();
748  return 1;
749  }
static char const *const * getPstackArgv()

◆ cmssw_stacktrace_fork()

void edm::service::cmssw_stacktrace_fork ( )
static

Definition at line 704 of file InitRootHandlers.cc.

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

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

704  {
705  char child_stack[4 * 1024];
706  char* child_stack_ptr = child_stack + 4 * 1024;
707  // On Linux, we currently use jemalloc. This registers pthread_atfork handlers; these
708  // handlers are *not* async-signal safe. Hence, a deadlock is possible if we invoke
709  // fork() from our signal handlers. Accordingly, we use clone (not POSIX, but AS-safe)
710  // as that is closer to the 'raw metal' syscall and avoids pthread_atfork handlers.
711  int pid =
712 #ifdef __linux__
713  clone(edm::service::cmssw_stacktrace, child_stack_ptr, CLONE_VM | CLONE_FS | SIGCHLD, nullptr);
714 #else
715  fork();
716  if (child_stack_ptr) {
717  } // Suppress 'unused variable' warning on non-Linux
718  if (pid == 0) {
720  }
721 #endif
722  if (pid == -1) {
723  full_cerr_write("(Attempt to perform stack dump failed.)\n");
724  } else {
725  int status;
726  if (waitpid(pid, &status, 0) == -1) {
727  full_cerr_write("(Failed to wait on stack dump output.)\n");
728  }
729  if (status) {
730  full_cerr_write("(GDB stack trace failed unexpectedly)\n");
731  }
732  }
733  }
int cmssw_stacktrace(void *)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135

◆ d2str() [1/2]

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

Definition at line 145 of file Timing.cc.

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

145  {
146  std::stringstream t;
147  t << d;
148  return t.str();
149  }
d
Definition: ztail.py:151

◆ d2str() [2/2]

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

◆ getChildrenCPU()

static double edm::service::getChildrenCPU ( )
static

Definition at line 164 of file Timing.cc.

References usage().

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

164  {
165  struct rusage usage;
166 
167  getrusage(RUSAGE_CHILDREN, &usage);
168  double totalCPUTime = (double)usage.ru_utime.tv_sec + (double(usage.ru_utime.tv_usec) * 1E-6);
169  totalCPUTime += (double)usage.ru_stime.tv_sec + (double(usage.ru_stime.tv_usec) * 1E-6);
170 
171  return totalCPUTime;
172  }
void usage()
Definition: array2xmlEB.cc:14

◆ getCPU()

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

Definition at line 174 of file Timing.cc.

References usage().

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

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

◆ getTime()

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

Definition at line 157 of file Timing.cc.

References Exception, and submitPVValidationJobs::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().

157  {
158  struct timeval t;
159  if (gettimeofday(&t, nullptr) < 0)
160  throw cms::Exception("SysCallFailed", "Failed call to gettimeofday");
161  return static_cast<double>(t.tv_sec) + (static_cast<double>(t.tv_usec) * 1E-6);
162  }

◆ i2str()

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

Definition at line 281 of file SimpleMemoryCheck.cc.

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

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

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

◆ isProcessWideService() [1/9]

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

Definition at line 29 of file ServiceMakerBase.h.

29 { return false; }

◆ isProcessWideService() [2/9]

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

Definition at line 46 of file JobReportService.h.

46 { return true; }

◆ isProcessWideService() [3/9]

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

Definition at line 54 of file TFileAdaptor.h.

54 { return true; }

◆ isProcessWideService() [4/9]

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

Definition at line 57 of file CPU.cc.

57 { return true; }

◆ isProcessWideService() [5/9]

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

Definition at line 98 of file TFileService.h.

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

98 { return true; }

◆ isProcessWideService() [6/9]

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

Definition at line 99 of file SiteLocalConfigService.h.

99 { return true; }

◆ isProcessWideService() [7/9]

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

Definition at line 145 of file InitRootHandlers.cc.

145 { return true; }

◆ isProcessWideService() [8/9]

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

Definition at line 195 of file MessageLogger.h.

195 { return true; }

◆ isProcessWideService() [9/9]

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

Definition at line 343 of file DependencyGraph.cc.

343 { return true; }

◆ moduleTimeStack()

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

Definition at line 195 of file Timing.cc.

Referenced by popStack(), and pushStack().

195  {
196  static thread_local std::vector<double> s_stack;
197  return s_stack;
198  }

◆ operator<<() [1/2]

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

Definition at line 963 of file SimpleMemoryCheck.cc.

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.

963  {
964  os << "[" << se.count << "] " << se.event << " vsize = " << se.vsize << " deltaVsize = " << se.deltaVsize
965  << " rss = " << se.rss << " delta = " << se.deltaRss;
966 
967  if (se.monitorPssAndPrivate) {
968  os << " private = " << se.privateSize << " pss = " << se.pss;
969  }
970  return os;
971  }

◆ operator<<() [2/2]

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

Definition at line 973 of file SimpleMemoryCheck.cc.

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.

973  {
974  if (sm.postEarlyCount > 0) {
975  os << "\nPost Early Events: TotalDeltaVsize: " << sm.totalDeltaVsize
976  << " (avg: " << sm.totalDeltaVsize / sm.postEarlyCount << "; max: " << sm.maxDeltaVsize << " during "
977  << sm.eventMaxDeltaV << ")";
978  }
979  if (sm.totalEarlyVsize > 0) {
980  os << "\n Early Events: TotalDeltaVsize: " << sm.totalEarlyVsize << " (max: " << sm.maxEarlyVsize << ")";
981  }
982 
983  return os;
984  }

◆ popStack()

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

Definition at line 200 of file Timing.cc.

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

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

200  {
201  auto& modStack = moduleTimeStack();
202  assert(!modStack.empty());
203  double curr_module_time = modStack.back();
204  modStack.pop_back();
205  double t = getTime() - curr_module_time;
206  return t;
207  }
assert(be >=bs)
static std::vector< double > & moduleTimeStack()
Definition: Timing.cc:195
static double getTime()
Definition: Timing.cc:157

◆ pushStack()

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

Definition at line 209 of file Timing.cc.

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

209  {
210  if (!configuredInTopLevelProcess) {
211  return;
212  }
213  auto& modStack = moduleTimeStack();
214  modStack.push_back(getTime());
215  }
static std::vector< double > & moduleTimeStack()
Definition: Timing.cc:195
static double getTime()
Definition: Timing.cc:157

◆ ui2str()

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

Definition at line 151 of file Timing.cc.

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

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

151  {
152  std::stringstream t;
153  t << i;
154  return t.str();
155  }

Variable Documentation

◆ dashC

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

Definition at line 752 of file InitRootHandlers.cc.

◆ hereMsg

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

Definition at line 83 of file ELdestination.cc.

◆ noosMsg

const std::string edm::service::noosMsg = "No ostream"
static

◆ notELoutputMsg

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

Definition at line 85 of file ELdestination.cc.

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

◆ pstackName

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

Definition at line 751 of file InitRootHandlers.cc.