CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::service::StallMonitor Class Reference

Public Member Functions

 StallMonitor (ParameterSet const &, ActivityRegistry &)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

using ModuleID = decltype(std::declval< ModuleDescription >().id())
 
using StreamID_value = decltype(std::declval< StreamID >().value())
 

Private Member Functions

void postBeginJob ()
 
void postEndJob ()
 
void postEvent (StreamContext const &)
 
void postEventReadFromSource (StreamContext const &, ModuleCallingContext const &)
 
void postModuleEvent (StreamContext const &, ModuleCallingContext const &)
 
void postModuleEventAcquire (StreamContext const &, ModuleCallingContext const &)
 
void postModuleEventPrefetching (StreamContext const &, ModuleCallingContext const &)
 
void postModuleGlobalTransition (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleStreamTransition (StreamContext const &, ModuleCallingContext const &)
 
void postSourceEvent (StreamID)
 
void preEvent (StreamContext const &)
 
void preEventReadFromSource (StreamContext const &, ModuleCallingContext const &)
 
void preModuleConstruction (edm::ModuleDescription const &)
 
void preModuleEvent (StreamContext const &, ModuleCallingContext const &)
 
void preModuleEventAcquire (StreamContext const &, ModuleCallingContext const &)
 
void preModuleGlobalTransition (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleStreamTransition (StreamContext const &, ModuleCallingContext const &)
 
void preSourceEvent (StreamID)
 

Private Attributes

decltype(now()) beginTime_ {}
 
ThreadSafeOutputFileStream file_
 
std::vector< std::string > moduleLabels_ {}
 
std::vector< StallStatistics > moduleStats_ {}
 
unsigned int numStreams_
 
tbb::concurrent_unordered_map< std::pair< StreamID_value, ModuleID >, std::pair< decltype(beginTime_), bool > > stallStart_ {}
 
duration_t const stallThreshold_
 
bool const validFile_
 

Detailed Description

Definition at line 193 of file StallMonitor.cc.

Member Typedef Documentation

using edm::service::StallMonitor::ModuleID = decltype(std::declval<ModuleDescription>().id())
private

Definition at line 228 of file StallMonitor.cc.

using edm::service::StallMonitor::StreamID_value = decltype(std::declval<StreamID>().value())
private

Definition at line 227 of file StallMonitor.cc.

Constructor & Destructor Documentation

StallMonitor::StallMonitor ( ParameterSet const &  iPS,
ActivityRegistry iRegistry 
)

Definition at line 250 of file StallMonitor.cc.

References edm::Event, edm::ParameterSet::getUntrackedParameter(), edm::service::SystemBounds::maxNumberOfStreams(), numStreams_, postBeginJob(), postEndJob(), postEvent(), postEventReadFromSource(), postModuleEvent(), postModuleEventAcquire(), postModuleEventPrefetching(), postModuleGlobalTransition(), postModuleStreamTransition(), postSourceEvent(), preEvent(), preEventReadFromSource(), preModuleConstruction(), preModuleEvent(), preModuleEventAcquire(), preModuleGlobalTransition(), preModuleStreamTransition(), preSourceEvent(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::ThreadSafeOutputFileStream::write().

251  : file_{iPS.getUntrackedParameter<std::string>("fileName", filename_default)},
252  validFile_{file_},
254  std::chrono::round<duration_t>(duration<double>(iPS.getUntrackedParameter<double>("stallThreshold")))} {
260  iRegistry.watchPostEndJob(this, &StallMonitor::postEndJob);
261 
262  if (validFile_) {
263  // Only enable the following callbacks if writing to a file.
266  iRegistry.watchPreEvent(this, &StallMonitor::preEvent);
271  iRegistry.watchPostEvent(this, &StallMonitor::postEvent);
272 
277 
282 
289 
296 
297  iRegistry.preallocateSignal_.connect(
298  [this](service::SystemBounds const& iBounds) { numStreams_ = iBounds.maxNumberOfStreams(); });
299 
300  std::ostringstream oss;
301  oss << "# Transition Symbol\n";
302  oss << "#----------------- ------\n";
303  oss << "# globalBeginRun " << Phase::globalBeginRun << "\n"
304  << "# streamBeginRun " << Phase::streamBeginRun << "\n"
305  << "# globalBeginLumi " << Phase::globalBeginLumi << "\n"
306  << "# streamBeginLumi " << Phase::streamBeginLumi << "\n"
307  << "# Event " << Phase::Event << "\n"
308  << "# streamEndLumi " << Phase::streamEndLumi << "\n"
309  << "# globalEndLumi " << Phase::globalEndLumi << "\n"
310  << "# streamEndRun " << Phase::streamEndRun << "\n"
311  << "# globalEndRun " << Phase::globalEndRun << "\n";
312  oss << "# Step Symbol Entries\n"
313  << "# -------------------------- ------ ------------------------------------------\n"
314  << "# preSourceEvent " << step::preSourceEvent << " <Stream ID> <Time since beginJob (ms)>\n"
315  << "# postSourceEvent " << step::postSourceEvent << " <Stream ID> <Time since beginJob (ms)>\n"
316  << "# preEvent " << step::preEvent
317  << " <Stream ID> <Run#> <LumiBlock#> <Event#> <Time since beginJob (ms)>\n"
318  << "# postModuleEventPrefetching " << step::postModuleEventPrefetching
319  << " <Stream ID> <Module ID> <Time since beginJob (ms)>\n"
320  << "# preModuleEventAcquire " << step::preModuleEventAcquire
321  << " <Stream ID> <Module ID> <Time since beginJob (ms)>\n"
322  << "# postModuleEventAcquire " << step::postModuleEventAcquire
323  << " <Stream ID> <Module ID> <Time since beginJob (ms)>\n"
324  << "# preModuleTransition " << step::preModuleEvent
325  << " <Stream ID> <Module ID> <Transition type> <Time since beginJob (ms)>\n"
326  << "# preEventReadFromSource " << step::preEventReadFromSource
327  << " <Stream ID> <Module ID> <Time since beginJob (ms)>\n"
328  << "# postEventReadFromSource " << step::postEventReadFromSource
329  << " <Stream ID> <Module ID> <Time since beginJob (ms)>\n"
330  << "# postModuleTransition " << step::postModuleEvent
331  << " <Stream ID> <Module ID> <Transition type> <Time since beginJob (ms)>\n"
332  << "# postEvent " << step::postEvent
333  << " <Stream ID> <Run#> <LumiBlock#> <Event#> <Time since beginJob (ms)>\n";
334  file_.write(oss.str());
335  }
336 }
void watchPostModuleGlobalEndLumi(PostModuleGlobalEndLumi::slot_type const &iSlot)
void watchPreModuleGlobalBeginRun(PreModuleGlobalBeginRun::slot_type const &iSlot)
void watchPreEvent(PreEvent::slot_type const &iSlot)
void preModuleEvent(StreamContext const &, ModuleCallingContext const &)
void watchPreModuleEventAcquire(PreModuleEventAcquire::slot_type const &iSlot)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void watchPreModuleConstruction(PreModuleConstruction::slot_type const &iSlot)
void preSourceEvent(StreamID)
ThreadSafeOutputFileStream file_
void watchPostEvent(PostEvent::slot_type const &iSlot)
void postEvent(StreamContext const &)
void watchPreEventReadFromSource(PreEventReadFromSource::slot_type const &iSlot)
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
void watchPostModuleGlobalBeginLumi(PostModuleGlobalBeginLumi::slot_type const &iSlot)
void watchPostModuleStreamEndLumi(PostModuleStreamEndLumi::slot_type const &iSlot)
void watchPostModuleStreamBeginRun(PostModuleStreamBeginRun::slot_type const &iSlot)
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
void watchPreModuleGlobalEndRun(PreModuleGlobalEndRun::slot_type const &iSlot)
void preModuleConstruction(edm::ModuleDescription const &)
void watchPostModuleWriteRun(PostModuleWriteRun::slot_type const &iSlot)
void preModuleStreamTransition(StreamContext const &, ModuleCallingContext const &)
void watchPostModuleWriteLumi(PostModuleWriteLumi::slot_type const &iSlot)
Preallocate preallocateSignal_
signal is emitted before beginJob
void watchPostModuleEventPrefetching(PostModuleEventPrefetching::slot_type const &iSlot)
void postModuleEventPrefetching(StreamContext const &, ModuleCallingContext const &)
void preEventReadFromSource(StreamContext const &, ModuleCallingContext const &)
void watchPostModuleEventAcquire(PostModuleEventAcquire::slot_type const &iSlot)
duration_t const stallThreshold_
void preEvent(StreamContext const &)
void watchPreModuleGlobalBeginLumi(PreModuleGlobalBeginLumi::slot_type const &iSlot)
void watchPostModuleStreamEndRun(PostModuleStreamEndRun::slot_type const &iSlot)
void watchPreModuleStreamBeginLumi(PreModuleStreamBeginLumi::slot_type const &iSlot)
void preModuleEventAcquire(StreamContext const &, ModuleCallingContext const &)
void postModuleEventAcquire(StreamContext const &, ModuleCallingContext const &)
void postEventReadFromSource(StreamContext const &, ModuleCallingContext const &)
void watchPostModuleGlobalEndRun(PostModuleGlobalEndRun::slot_type const &iSlot)
void postModuleGlobalTransition(GlobalContext const &, ModuleCallingContext const &)
void watchPostModuleStreamBeginLumi(PostModuleStreamBeginLumi::slot_type const &iSlot)
void watchPreModuleStreamEndLumi(PreModuleStreamEndLumi::slot_type const &iSlot)
void watchPreModuleStreamBeginRun(PreModuleStreamBeginRun::slot_type const &iSlot)
void watchPreModuleWriteRun(PreModuleWriteRun::slot_type const &iSlot)
void postModuleStreamTransition(StreamContext const &, ModuleCallingContext const &)
void postSourceEvent(StreamID)
void postModuleEvent(StreamContext const &, ModuleCallingContext const &)
void watchPreModuleStreamEndRun(PreModuleStreamEndRun::slot_type const &iSlot)
void watchPostEventReadFromSource(PostEventReadFromSource::slot_type const &iSlot)
void watchPostModuleGlobalBeginRun(PostModuleGlobalBeginRun::slot_type const &iSlot)
void watchPreModuleWriteLumi(PreModuleWriteLumi::slot_type const &iSlot)
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void connect(U iFunc)
Definition: Signal.h:62
void watchPreModuleGlobalEndLumi(PreModuleGlobalEndLumi::slot_type const &iSlot)
void preModuleGlobalTransition(GlobalContext const &, ModuleCallingContext const &)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal

Member Function Documentation

void StallMonitor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 338 of file StallMonitor.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ConfigurationDescriptions::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

338  {
340  desc.addUntracked<std::string>("fileName", filename_default)
341  ->setComment(
342  "Name of file to which detailed timing information should be written.\n"
343  "An empty filename argument (the default) indicates that no extra\n"
344  "information will be written to a dedicated file, but only the summary\n"
345  "including stalling-modules information will be logged.");
346  desc.addUntracked<double>("stallThreshold", threshold_default)
347  ->setComment(
348  "Threshold (in seconds) used to classify modules as stalled.\n"
349  "Microsecond granularity allowed.");
350  descriptions.add("StallMonitor", desc);
351  descriptions.setComment(
352  "This service keeps track of various times in event-processing to determine which modules are stalling.");
353 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void StallMonitor::postBeginJob ( )
private

Definition at line 376 of file StallMonitor.cc.

References beginTime_, mps_fire::i, label, moduleLabels_, moduleStats_, cmsPerfSuiteHarvest::now, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, ApeEstimator_cff::width, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

376  {
377  // Since a (push,emplace)_back cannot be called for a vector of a
378  // type containing atomics (like 'StallStatistics')--i.e. atomics
379  // have no copy/move-assignment operators, we must specify the size
380  // of the vector at construction time.
381  moduleStats_ = std::vector<StallStatistics>(moduleLabels_.size());
382  for (std::size_t i{}; i < moduleStats_.size(); ++i) {
383  moduleStats_[i].setLabel(moduleLabels_[i]);
384  }
385 
386  if (validFile_) {
387  std::size_t const width{std::to_string(moduleLabels_.size()).size()};
388 
389  OStreamColumn col0{"Module ID", width};
390  std::string const lastCol{"Module label"};
391 
392  std::ostringstream oss;
393  oss << "\n# " << col0 << space << lastCol << '\n';
394  oss << "# " << std::string(col0.width() + space.size() + lastCol.size(), '-') << '\n';
395 
396  for (std::size_t i{}; i < moduleLabels_.size(); ++i) {
397  auto const& label = moduleLabels_[i];
398  if (label.empty())
399  continue; // See comment in filling of moduleLabels_;
400  oss << "#M " << std::setw(width) << std::left << col0(i) << space << std::left << moduleLabels_[i] << '\n';
401  }
402  oss << '\n';
403  file_.write(oss.str());
404  }
405  // Don't need the labels anymore--info. is now part of the
406  // module-statistics objects.
407  moduleLabels_.clear();
408 
409  beginTime_ = now();
410 }
size
Write out results.
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
std::vector< std::string > moduleLabels_
char const * label
std::vector< StallStatistics > moduleStats_
void StallMonitor::postEndJob ( )
private

Definition at line 544 of file StallMonitor.cc.

References KineDebug3::count(), DEFINE_FWK_SERVICE, edm::for_all(), SiStripPI::max, moduleStats_, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, protons_cff::time, and ApeEstimator_cff::width.

Referenced by StallMonitor().

544  {
545  // Prepare summary
546  std::size_t width{};
547  edm::for_all(moduleStats_, [&width](auto const& stats) {
548  if (stats.numberOfStalls() == 0u)
549  return;
550  width = std::max(width, stats.label().size());
551  });
552 
553  OStreamColumn tag{"StallMonitor>"};
554  OStreamColumn col1{"Module label", width};
555  OStreamColumn col2{"# of stalls"};
556  OStreamColumn col3{"Total stalled time"};
557  OStreamColumn col4{"Max stalled time"};
558 
559  LogAbsolute out{"StallMonitor"};
560  out << '\n';
561  out << tag << space << col1 << space << col2 << space << col3 << space << col4 << '\n';
562 
563  out << tag << space << std::setfill('-') << col1(std::string{}) << space << col2(std::string{}) << space
564  << col3(std::string{}) << space << col4(std::string{}) << '\n';
565 
566  using seconds_d = duration<double>;
567 
568  auto to_seconds_str = [](auto const& duration) {
569  std::ostringstream oss;
570  auto const time = duration_cast<seconds_d>(duration).count();
571  oss << time << " s";
572  return oss.str();
573  };
574 
575  out << std::setfill(' ');
576  for (auto const& stats : moduleStats_) {
577  if (stats.label().empty() || // See comment in filling of moduleLabels_;
578  stats.numberOfStalls() == 0u)
579  continue;
580  out << std::left << tag << space << col1(stats.label()) << space << std::right << col2(stats.numberOfStalls())
581  << space << col3(to_seconds_str(stats.totalStalledTime())) << space
582  << col4(to_seconds_str(stats.maxStalledTime())) << '\n';
583  }
584 }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
std::vector< StallStatistics > moduleStats_
void StallMonitor::postEvent ( StreamContext const &  sc)
private

Definition at line 537 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), runTauDisplay::eid, edm::StreamContext::eventID(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

537  {
538  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
539  auto const& eid = sc.eventID();
540  auto msg = assembleMessage<step::postEvent>(stream_id(sc), eid.run(), eid.luminosityBlock(), eid.event(), t);
542 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postEventReadFromSource ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 524 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

524  {
525  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
526  auto msg = assembleMessage<step::postEventReadFromSource>(stream_id(sc), module_id(mcc), t);
528 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postModuleEvent ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 530 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), edm::Event, eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

530  {
531  auto const postModEvent = duration_cast<duration_t>(now() - beginTime_).count();
532  auto msg = assembleMessage<step::postModuleEvent>(
533  stream_id(sc), module_id(mcc), static_cast<std::underlying_type_t<Phase>>(Phase::Event), postModEvent);
535 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postModuleEventAcquire ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 464 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

464  {
465  auto const postModEventAcquire = duration_cast<duration_t>(now() - beginTime_).count();
466  auto msg = assembleMessage<step::postModuleEventAcquire>(stream_id(sc), module_id(mcc), postModEventAcquire);
468 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postModuleEventPrefetching ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 431 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, stallStart_, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

431  {
432  auto const sid = stream_id(sc);
433  auto const mid = module_id(mcc);
434  auto start = stallStart_[std::make_pair(sid, mid)] = std::make_pair(now(), false);
435 
436  if (validFile_) {
437  auto const t = duration_cast<duration_t>(start.first - beginTime_).count();
438  auto msg = assembleMessage<step::postModuleEventPrefetching>(sid, mid, t);
440  }
441 }
Definition: start.py:1
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tbb::concurrent_unordered_map< std::pair< StreamID_value, ModuleID >, std::pair< decltype(beginTime_), bool > > stallStart_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postModuleGlobalTransition ( GlobalContext const &  gc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 512 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, numStreams_, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

512  {
513  auto const postModTime = duration_cast<duration_t>(now() - beginTime_).count();
514  auto msg = assembleMessage<step::postModuleEvent>(numStreams_, module_id(mcc), toTransition(gc), postModTime);
516 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postModuleStreamTransition ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 500 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

500  {
501  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
502  auto msg = assembleMessage<step::postModuleEvent>(stream_id(sc), module_id(mcc), toTransition(sc), t);
504 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::postSourceEvent ( StreamID  sid)
private

Definition at line 418 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, edm::StreamID::value(), and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

418  {
419  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
420  auto msg = assembleMessage<step::postSourceEvent>(sid.value(), t);
422 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
unsigned int value() const
Definition: StreamID.h:42
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preEvent ( StreamContext const &  sc)
private

Definition at line 424 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), runTauDisplay::eid, edm::StreamContext::eventID(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

424  {
425  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
426  auto const& eid = sc.eventID();
427  auto msg = assembleMessage<step::preEvent>(stream_id(sc), eid.run(), eid.luminosityBlock(), eid.event(), t);
429 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preEventReadFromSource ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 518 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

518  {
519  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
520  auto msg = assembleMessage<step::preEventReadFromSource>(stream_id(sc), module_id(mcc), t);
522 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preModuleConstruction ( edm::ModuleDescription const &  md)
private

Definition at line 355 of file StallMonitor.cc.

References edm::ModuleDescription::id(), edm::ModuleDescription::moduleLabel(), and moduleLabels_.

Referenced by StallMonitor().

355  {
356  // Module labels are dense, so if the module id is greater than the
357  // size of moduleLabels_, grow the vector to the correct index and
358  // assign the last entry to the desired label. Note that with the
359  // current implementation, there is no module with ID '0'. In
360  // principle, the module-information vectors are therefore each one
361  // entry too large. However, since removing the entry at the front
362  // makes for awkward indexing later on, and since the sizes of these
363  // extra entries are on the order of bytes, we will leave them in
364  // and skip over them later when printing out summaries. The
365  // extraneous entries can be identified by their module labels being
366  // empty.
367  auto const mid = md.id();
368  if (mid < moduleLabels_.size()) {
369  moduleLabels_[mid] = md.moduleLabel();
370  } else {
371  moduleLabels_.resize(mid + 1);
372  moduleLabels_.back() = md.moduleLabel();
373  }
374 }
std::vector< std::string > moduleLabels_
void StallMonitor::preModuleEvent ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 470 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), edm::Event, moduleStats_, eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, stallStart_, lumiCalc2::startT, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

470  {
471  auto const preModEvent = now();
472  auto const sid = stream_id(sc);
473  auto const mid = module_id(mcc);
474  auto const& start = stallStart_[std::make_pair(sid, mid)];
475  auto startT = start.first.time_since_epoch();
476  if (validFile_) {
477  auto t = duration_cast<duration_t>(preModEvent - beginTime_).count();
478  auto msg =
479  assembleMessage<step::preModuleEvent>(sid, mid, static_cast<std::underlying_type_t<Phase>>(Phase::Event), t);
481  }
482  // Check for stalls if prefetch was called and we did not already check before acquire
483  if (duration_t::duration::zero() != startT && !start.second) {
484  auto const preFetch_to_preModEvent = duration_cast<duration_t>(preModEvent - start.first);
485  if (preFetch_to_preModEvent < stallThreshold_)
486  return;
487  moduleStats_[mid].update(preFetch_to_preModEvent);
488  }
489 }
Definition: start.py:1
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
duration_t const stallThreshold_
tbb::concurrent_unordered_map< std::pair< StreamID_value, ModuleID >, std::pair< decltype(beginTime_), bool > > stallStart_
tuple msg
Definition: mps_check.py:285
std::vector< StallStatistics > moduleStats_
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preModuleEventAcquire ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 443 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), moduleStats_, eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, stallStart_, lumiCalc2::startT, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

443  {
444  auto const preModEventAcquire = now();
445  auto const sid = stream_id(sc);
446  auto const mid = module_id(mcc);
447  auto& start = stallStart_[std::make_pair(sid, mid)];
448  auto startT = start.first.time_since_epoch();
449  start.second = true; // record so the preModuleEvent knows that acquire was called
450  if (validFile_) {
451  auto t = duration_cast<duration_t>(preModEventAcquire - beginTime_).count();
452  auto msg = assembleMessage<step::preModuleEventAcquire>(sid, mid, t);
454  }
455  // Check for stalls if prefetch was called
456  if (duration_t::duration::zero() != startT) {
457  auto const preFetch_to_preModEventAcquire = duration_cast<duration_t>(preModEventAcquire - start.first);
458  if (preFetch_to_preModEventAcquire < stallThreshold_)
459  return;
460  moduleStats_[mid].update(preFetch_to_preModEventAcquire);
461  }
462 }
Definition: start.py:1
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
duration_t const stallThreshold_
tbb::concurrent_unordered_map< std::pair< StreamID_value, ModuleID >, std::pair< decltype(beginTime_), bool > > stallStart_
tuple msg
Definition: mps_check.py:285
std::vector< StallStatistics > moduleStats_
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preModuleGlobalTransition ( GlobalContext const &  gc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 506 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, numStreams_, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

506  {
507  auto t = duration_cast<duration_t>(now() - beginTime_).count();
508  auto msg = assembleMessage<step::preModuleEvent>(numStreams_, module_id(mcc), toTransition(gc), t);
510 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preModuleStreamTransition ( StreamContext const &  sc,
ModuleCallingContext const &  mcc 
)
private

Definition at line 491 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

491  {
492  auto const tNow = now();
493  auto const sid = stream_id(sc);
494  auto const mid = module_id(mcc);
495  auto t = duration_cast<duration_t>(tNow - beginTime_).count();
496  auto msg = assembleMessage<step::preModuleEvent>(sid, mid, toTransition(sc), t);
498 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511
void StallMonitor::preSourceEvent ( StreamID  sid)
private

Definition at line 412 of file StallMonitor.cc.

References beginTime_, KineDebug3::count(), eostools::move(), mps_check::msg, cmsPerfSuiteHarvest::now, protons_cff::t, edm::StreamID::value(), and edm::ThreadSafeOutputFileStream::write().

Referenced by StallMonitor().

412  {
413  auto const t = duration_cast<duration_t>(now() - beginTime_).count();
414  auto msg = assembleMessage<step::preSourceEvent>(sid.value(), t);
416 }
ThreadSafeOutputFileStream file_
decltype(now()) beginTime_
unsigned int value() const
Definition: StreamID.h:42
tuple msg
Definition: mps_check.py:285
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

decltype(now()) edm::service::StallMonitor::beginTime_ {}
private
ThreadSafeOutputFileStream edm::service::StallMonitor::file_
private

Definition at line 218 of file StallMonitor.cc.

std::vector<std::string> edm::service::StallMonitor::moduleLabels_ {}
private

Definition at line 232 of file StallMonitor.cc.

Referenced by postBeginJob(), and preModuleConstruction().

std::vector<StallStatistics> edm::service::StallMonitor::moduleStats_ {}
private

Definition at line 233 of file StallMonitor.cc.

Referenced by postBeginJob(), postEndJob(), preModuleEvent(), and preModuleEventAcquire().

unsigned int edm::service::StallMonitor::numStreams_
private
tbb::concurrent_unordered_map<std::pair<StreamID_value, ModuleID>, std::pair<decltype(beginTime_), bool> > edm::service::StallMonitor::stallStart_ {}
private
duration_t const edm::service::StallMonitor::stallThreshold_
private

Definition at line 220 of file StallMonitor.cc.

bool const edm::service::StallMonitor::validFile_
private

Definition at line 219 of file StallMonitor.cc.