CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
edm::ModuleCallingContext Class Reference

#include <ModuleCallingContext.h>

Public Types

enum  State { State::kPrefetching, State::kRunning, State::kInvalid }
 
typedef ParentContext::Type Type
 

Public Member Functions

std::uintptr_t callID () const noexcept
 
unsigned depth () const noexcept
 
GlobalContext const * getGlobalContext () const noexcept(false)
 
StreamContext const * getStreamContext () const noexcept(false)
 
ModuleCallingContext const * getTopModuleCallingContext () const noexcept
 
GlobalContext const * globalContext () const
 
InternalContext const * internalContext () const
 
 ModuleCallingContext (ModuleDescription const *moduleDescription) noexcept
 
 ModuleCallingContext (ModuleDescription const *moduleDescription, std::uintptr_t id, State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread) noexcept
 
ModuleCallingContext const * moduleCallingContext () const
 
ModuleDescription const * moduleDescription () const noexcept
 
ParentContext const & parent () const noexcept
 
PlaceInPathContext const * placeInPathContext () const
 
ModuleCallingContext const * previousModuleOnThread () const noexcept
 
void setContext (State state, ParentContext const &parent, ModuleCallingContext const *previousOnThread) noexcept
 
void setState (State state) noexcept
 
State state () const noexcept
 
StreamContext const * streamContext () const
 
Type type () const noexcept
 

Private Attributes

std::uintptr_t id_
 
ModuleDescription const * moduleDescription_
 
ParentContext parent_
 
ModuleCallingContext const * previousModuleOnThread_
 
State state_
 

Detailed Description

Description: This is intended primarily to be passed to Services as an argument to their callback functions.

Usage:

Definition at line 33 of file ModuleCallingContext.h.

Member Typedef Documentation

◆ Type

Definition at line 35 of file ModuleCallingContext.h.

Member Enumeration Documentation

◆ State

Enumerator
kPrefetching 
kRunning 
kInvalid 

Definition at line 37 of file ModuleCallingContext.h.

37  {
38  kPrefetching, // prefetching products before starting to run
39  kRunning, // module actually running
40  kInvalid
41  };

Constructor & Destructor Documentation

◆ ModuleCallingContext() [1/2]

edm::ModuleCallingContext::ModuleCallingContext ( ModuleDescription const *  moduleDescription)
noexcept

Definition at line 14 of file ModuleCallingContext.cc.

◆ ModuleCallingContext() [2/2]

edm::ModuleCallingContext::ModuleCallingContext ( ModuleDescription const *  moduleDescription,
std::uintptr_t  id,
State  state,
ParentContext const &  parent,
ModuleCallingContext const *  previousOnThread 
)
noexcept

Definition at line 21 of file ModuleCallingContext.cc.

26  : previousModuleOnThread_(previousOnThread),
28  parent_(parent),
29  id_(id),
30  state_(state) {}
ModuleDescription const * moduleDescription_
ModuleDescription const * moduleDescription() const noexcept
ParentContext const & parent() const noexcept
State state() const noexcept
ModuleCallingContext const * previousModuleOnThread_

Member Function Documentation

◆ callID()

std::uintptr_t edm::ModuleCallingContext::callID ( ) const
inlinenoexcept

Returns a unique id for this module to differentiate possibly concurrent calls to the module. The value returned may be large so not appropriate for an index lookup. A value of 0 denotes a call to produce, analyze or filter. Other values denote a transform.

Definition at line 62 of file ModuleCallingContext.h.

References id_.

Referenced by edm::service::monitor_file_utilities::module_callid(), edm::moduleAlloc::monitor_file_utilities::module_callid(), edm::service::Tracer::postModuleTransform(), edm::service::Tracer::postModuleTransformAcquiring(), edm::service::Tracer::postModuleTransformPrefetching(), edm::service::Tracer::preModuleTransform(), edm::service::Tracer::preModuleTransformAcquiring(), and edm::service::Tracer::preModuleTransformPrefetching().

62 { return id_; }

◆ depth()

unsigned edm::ModuleCallingContext::depth ( void  ) const
noexcept

Definition at line 74 of file ModuleCallingContext.cc.

References internalContext(), edm::ParentContext::kInternal, edm::ParentContext::kModule, edm::InternalContext::moduleCallingContext(), moduleCallingContext(), and type().

Referenced by edm::ESModuleCallingContext::depth(), edm::service::Tracer::postEventReadFromSource(), edm::service::Tracer::postModuleAccessInputProcessBlock(), edm::service::Tracer::postModuleBeginProcessBlock(), edm::service::Tracer::postModuleEndProcessBlock(), edm::service::Tracer::postModuleEvent(), edm::service::Tracer::postModuleEventAcquire(), edm::service::Tracer::postModuleEventDelayedGet(), edm::service::Tracer::postModuleEventPrefetching(), edm::service::Tracer::postModuleGlobalBeginLumi(), edm::service::Tracer::postModuleGlobalBeginRun(), edm::service::Tracer::postModuleGlobalEndLumi(), edm::service::Tracer::postModuleGlobalEndRun(), edm::service::Tracer::postModuleGlobalPrefetching(), edm::service::Tracer::postModuleStreamBeginLumi(), edm::service::Tracer::postModuleStreamBeginRun(), edm::service::Tracer::postModuleStreamEndLumi(), edm::service::Tracer::postModuleStreamEndRun(), edm::service::Tracer::postModuleStreamPrefetching(), edm::service::Tracer::postModuleTransform(), edm::service::Tracer::postModuleTransformAcquiring(), edm::service::Tracer::postModuleTransformPrefetching(), edm::service::Tracer::postModuleWriteLumi(), edm::service::Tracer::postModuleWriteProcessBlock(), edm::service::Tracer::postModuleWriteRun(), edm::service::Tracer::preEventReadFromSource(), edm::service::Tracer::preModuleAccessInputProcessBlock(), edm::service::Tracer::preModuleBeginProcessBlock(), edm::service::Tracer::preModuleEndProcessBlock(), edm::service::Tracer::preModuleEvent(), edm::service::Tracer::preModuleEventAcquire(), edm::service::Tracer::preModuleEventDelayedGet(), edm::service::Tracer::preModuleEventPrefetching(), edm::service::Tracer::preModuleGlobalBeginLumi(), edm::service::Tracer::preModuleGlobalBeginRun(), edm::service::Tracer::preModuleGlobalEndLumi(), edm::service::Tracer::preModuleGlobalEndRun(), edm::service::Tracer::preModuleGlobalPrefetching(), edm::service::Tracer::preModuleStreamBeginLumi(), edm::service::Tracer::preModuleStreamBeginRun(), edm::service::Tracer::preModuleStreamEndLumi(), edm::service::Tracer::preModuleStreamEndRun(), edm::service::Tracer::preModuleStreamPrefetching(), edm::service::Tracer::preModuleTransform(), edm::service::Tracer::preModuleTransformAcquiring(), edm::service::Tracer::preModuleTransformPrefetching(), edm::service::Tracer::preModuleWriteLumi(), edm::service::Tracer::preModuleWriteProcessBlock(), and edm::service::Tracer::preModuleWriteRun().

74  {
75  unsigned depth = 0;
76  ModuleCallingContext const* mcc = this;
77  while (mcc->type() == ParentContext::Type::kModule) {
78  ++depth;
79  mcc = mcc->moduleCallingContext();
80  }
81  if (mcc->type() == ParentContext::Type::kInternal) {
82  ++depth;
83  mcc = mcc->internalContext()->moduleCallingContext();
84  }
85  while (mcc->type() == ParentContext::Type::kModule) {
86  ++depth;
87  mcc = mcc->moduleCallingContext();
88  }
89  return depth;
90  }
unsigned depth() const noexcept
ModuleCallingContext(ModuleDescription const *moduleDescription) noexcept

◆ getGlobalContext()

GlobalContext const * edm::ModuleCallingContext::getGlobalContext ( ) const
noexcept

Definition at line 51 of file ModuleCallingContext.cc.

References Exception, getTopModuleCallingContext(), globalContext(), edm::ParentContext::kGlobal, edm::errors::LogicError, and type().

Referenced by edm::Worker::emitPostModuleGlobalPrefetchingSignal(), and edm::service::MessageLogger::setThreadContext().

51  {
53  if (mcc->type() != ParentContext::Type::kGlobal) {
55  << "ModuleCallingContext::getGlobalContext() called in context not linked to a GlobalContext\n";
56  }
57  return mcc->globalContext();
58  }
ModuleCallingContext const * getTopModuleCallingContext() const noexcept
ModuleCallingContext(ModuleDescription const *moduleDescription) noexcept

◆ getStreamContext()

StreamContext const * edm::ModuleCallingContext::getStreamContext ( ) const
noexcept

Definition at line 40 of file ModuleCallingContext.cc.

References Exception, getTopModuleCallingContext(), edm::ParentContext::kPlaceInPath, edm::ParentContext::kStream, edm::errors::LogicError, edm::PlaceInPathContext::pathContext(), placeInPathContext(), edm::PathContext::streamContext(), streamContext(), and type().

Referenced by edm::Worker::emitPostModuleEventPrefetchingSignal(), edm::Worker::emitPostModuleStreamPrefetchingSignal(), edm::EventAcquireSignalsSentry::EventAcquireSignalsSentry(), edm::EventSignalsSentry::EventSignalsSentry(), edm::DelayedReader::getProduct(), edm::UnscheduledProductResolver::prefetchAsync_(), edm::TransformingProductResolver::prefetchAsync_(), edm::DelayedReaderInputProductResolver::resolveProduct_(), edm::service::MessageLogger::setThreadContext(), edm::TransformerBase::transformImpAsync(), edm::EventAcquireSignalsSentry::~EventAcquireSignalsSentry(), and edm::EventSignalsSentry::~EventSignalsSentry().

40  {
42  if (mcc->type() == ParentContext::Type::kPlaceInPath) {
43  return mcc->placeInPathContext()->pathContext()->streamContext();
44  } else if (mcc->type() != ParentContext::Type::kStream) {
46  << "ModuleCallingContext::getStreamContext() called in context not linked to a StreamContext\n";
47  }
48  return mcc->streamContext();
49  }
ModuleCallingContext const * getTopModuleCallingContext() const noexcept
ModuleCallingContext(ModuleDescription const *moduleDescription) noexcept

◆ getTopModuleCallingContext()

ModuleCallingContext const * edm::ModuleCallingContext::getTopModuleCallingContext ( ) const
noexcept

Definition at line 60 of file ModuleCallingContext.cc.

References internalContext(), edm::ParentContext::kInternal, edm::ParentContext::kModule, edm::InternalContext::moduleCallingContext(), moduleCallingContext(), and type().

Referenced by getGlobalContext(), getStreamContext(), edm::ESModuleCallingContext::getTopModuleCallingContext(), and edm::service::MessageLogger::setThreadContext().

60  {
61  ModuleCallingContext const* mcc = this;
62  while (mcc->type() == ParentContext::Type::kModule) {
63  mcc = mcc->moduleCallingContext();
64  }
65  if (mcc->type() == ParentContext::Type::kInternal) {
66  mcc = mcc->internalContext()->moduleCallingContext();
67  }
68  while (mcc->type() == ParentContext::Type::kModule) {
69  mcc = mcc->moduleCallingContext();
70  }
71  return mcc;
72  }
ModuleCallingContext(ModuleDescription const *moduleDescription) noexcept

◆ globalContext()

GlobalContext const* edm::ModuleCallingContext::globalContext ( ) const
inline

Definition at line 67 of file ModuleCallingContext.h.

References edm::ParentContext::globalContext(), and parent_.

Referenced by edm::exceptionContext(), and getGlobalContext().

67 { return parent_.globalContext(); }
GlobalContext const * globalContext() const noexcept(false)

◆ internalContext()

InternalContext const* edm::ModuleCallingContext::internalContext ( ) const
inline

Definition at line 68 of file ModuleCallingContext.h.

References edm::ParentContext::internalContext(), and parent_.

Referenced by depth(), edm::exceptionContext(), and getTopModuleCallingContext().

68 { return parent_.internalContext(); }
InternalContext const * internalContext() const noexcept(false)

◆ moduleCallingContext()

ModuleCallingContext const* edm::ModuleCallingContext::moduleCallingContext ( ) const
inline

Definition at line 64 of file ModuleCallingContext.h.

References edm::ParentContext::moduleCallingContext(), and parent_.

Referenced by depth(), edm::exceptionContext(), getTopModuleCallingContext(), and edm::operator<<().

64 { return parent_.moduleCallingContext(); }
ModuleCallingContext const * moduleCallingContext() const noexcept(false)

◆ moduleDescription()

ModuleDescription const* edm::ModuleCallingContext::moduleDescription ( ) const
inlinenoexcept

Definition at line 55 of file ModuleCallingContext.h.

References moduleDescription_.

Referenced by edm::Worker::description(), edm::exceptionContext(), PileupRandomNumberGenerator::findPresentModule(), edm::service::RandomNumberGeneratorService::getEngine(), edm::service::monitor_file_utilities::module_id(), edm::moduleAlloc::monitor_file_utilities::module_id(), edm::service::RandomNumberGeneratorService::mySeed(), edm::operator<<(), edm::SystemTimeKeeper::pauseModuleEvent(), edm::service::Tracer::postEventReadFromSource(), edm::service::SimpleMemoryCheck::postModule(), edm::service::Tracer::postModuleAccessInputProcessBlock(), edm::service::Tracer::postModuleBeginProcessBlock(), ROCmMonitoringService::postModuleBeginStream(), CUDAMonitoringService::postModuleBeginStream(), edm::service::Tracer::postModuleBeginStream(), edm::service::MessageLogger::postModuleBeginStream(), NVProfilerService::postModuleBeginStream(), edm::service::Tracer::postModuleEndProcessBlock(), edm::service::Tracer::postModuleEndStream(), edm::service::MessageLogger::postModuleEndStream(), NVProfilerService::postModuleEndStream(), ROCmMonitoringService::postModuleEvent(), CUDAMonitoringService::postModuleEvent(), FWPathsPopup::postModuleEvent(), edm::service::IgProfService::postModuleEvent(), edm::service::JeProfService::postModuleEvent(), edm::service::Timing::postModuleEvent(), TFileService::postModuleEvent(), edm::service::Tracer::postModuleEvent(), FastTimerService::postModuleEvent(), NVProfilerService::postModuleEvent(), edm::service::Tracer::postModuleEventAcquire(), FastTimerService::postModuleEventAcquire(), NVProfilerService::postModuleEventAcquire(), edm::service::Tracer::postModuleEventDelayedGet(), edm::service::Tracer::postModuleEventPrefetching(), NVProfilerService::postModuleEventPrefetching(), TFileService::postModuleGlobal(), edmtest::TestServiceOne::postModuleGlobalBeginLumi(), edmtest::TestServiceTwo::postModuleGlobalBeginLumi(), edm::service::Tracer::postModuleGlobalBeginLumi(), NVProfilerService::postModuleGlobalBeginLumi(), edmtest::TestServiceOne::postModuleGlobalBeginRun(), edmtest::TestServiceTwo::postModuleGlobalBeginRun(), edm::service::Tracer::postModuleGlobalBeginRun(), NVProfilerService::postModuleGlobalBeginRun(), edmtest::TestServiceOne::postModuleGlobalEndLumi(), edmtest::TestServiceTwo::postModuleGlobalEndLumi(), edm::service::Tracer::postModuleGlobalEndLumi(), NVProfilerService::postModuleGlobalEndLumi(), edmtest::TestServiceOne::postModuleGlobalEndRun(), edmtest::TestServiceTwo::postModuleGlobalEndRun(), edm::service::Tracer::postModuleGlobalEndRun(), NVProfilerService::postModuleGlobalEndRun(), edm::service::Tracer::postModuleGlobalPrefetching(), edmtest::TestServiceOne::postModuleStreamBeginLumi(), edmtest::TestServiceTwo::postModuleStreamBeginLumi(), edm::service::Tracer::postModuleStreamBeginLumi(), NVProfilerService::postModuleStreamBeginLumi(), edmtest::TestServiceOne::postModuleStreamBeginRun(), edmtest::TestServiceTwo::postModuleStreamBeginRun(), edm::service::Tracer::postModuleStreamBeginRun(), NVProfilerService::postModuleStreamBeginRun(), edm::service::RandomNumberGeneratorService::postModuleStreamCheck(), edmtest::TestServiceOne::postModuleStreamEndLumi(), edmtest::TestServiceTwo::postModuleStreamEndLumi(), edm::service::Tracer::postModuleStreamEndLumi(), NVProfilerService::postModuleStreamEndLumi(), edmtest::TestServiceOne::postModuleStreamEndRun(), edmtest::TestServiceTwo::postModuleStreamEndRun(), edm::service::Tracer::postModuleStreamEndRun(), NVProfilerService::postModuleStreamEndRun(), edm::service::Tracer::postModuleStreamPrefetching(), edm::service::Tracer::postModuleTransform(), edm::service::Tracer::postModuleTransformAcquiring(), edm::service::Tracer::postModuleTransformPrefetching(), edm::service::Tracer::postModuleWriteLumi(), edm::service::Tracer::postModuleWriteProcessBlock(), edm::service::Tracer::postModuleWriteRun(), edm::service::Tracer::preEventReadFromSource(), VariableHelperService::preModule(), edm::service::SimpleMemoryCheck::preModule(), edm::service::Tracer::preModuleAccessInputProcessBlock(), edm::service::Tracer::preModuleBeginProcessBlock(), edm::service::Tracer::preModuleBeginStream(), edm::service::MessageLogger::preModuleBeginStream(), NVProfilerService::preModuleBeginStream(), edm::service::Tracer::preModuleEndProcessBlock(), edm::service::Tracer::preModuleEndStream(), edm::service::MessageLogger::preModuleEndStream(), NVProfilerService::preModuleEndStream(), FWPathsPopup::preModuleEvent(), edm::service::IgProfService::preModuleEvent(), edm::service::JeProfService::preModuleEvent(), TFileService::preModuleEvent(), edm::service::Tracer::preModuleEvent(), evf::FastMonitoringService::preModuleEvent(), NVProfilerService::preModuleEvent(), edm::service::Tracer::preModuleEventAcquire(), evf::FastMonitoringService::preModuleEventAcquire(), NVProfilerService::preModuleEventAcquire(), edm::service::Tracer::preModuleEventDelayedGet(), edm::service::Tracer::preModuleEventPrefetching(), NVProfilerService::preModuleEventPrefetching(), TFileService::preModuleGlobal(), edmtest::TestServiceOne::preModuleGlobalBeginLumi(), edmtest::TestServiceTwo::preModuleGlobalBeginLumi(), edm::service::Tracer::preModuleGlobalBeginLumi(), NVProfilerService::preModuleGlobalBeginLumi(), edmtest::TestServiceOne::preModuleGlobalBeginRun(), edmtest::TestServiceTwo::preModuleGlobalBeginRun(), edm::service::Tracer::preModuleGlobalBeginRun(), NVProfilerService::preModuleGlobalBeginRun(), edmtest::TestServiceOne::preModuleGlobalEndLumi(), edmtest::TestServiceTwo::preModuleGlobalEndLumi(), edm::service::Tracer::preModuleGlobalEndLumi(), NVProfilerService::preModuleGlobalEndLumi(), edmtest::TestServiceOne::preModuleGlobalEndRun(), edmtest::TestServiceTwo::preModuleGlobalEndRun(), edm::service::Tracer::preModuleGlobalEndRun(), NVProfilerService::preModuleGlobalEndRun(), edm::service::Tracer::preModuleGlobalPrefetching(), edmtest::TestServiceOne::preModuleStreamBeginLumi(), edmtest::TestServiceTwo::preModuleStreamBeginLumi(), edm::service::Tracer::preModuleStreamBeginLumi(), NVProfilerService::preModuleStreamBeginLumi(), edmtest::TestServiceOne::preModuleStreamBeginRun(), edmtest::TestServiceTwo::preModuleStreamBeginRun(), edm::service::Tracer::preModuleStreamBeginRun(), NVProfilerService::preModuleStreamBeginRun(), edm::service::RandomNumberGeneratorService::preModuleStreamCheck(), edmtest::TestServiceOne::preModuleStreamEndLumi(), edmtest::TestServiceTwo::preModuleStreamEndLumi(), edm::service::Tracer::preModuleStreamEndLumi(), NVProfilerService::preModuleStreamEndLumi(), edmtest::TestServiceOne::preModuleStreamEndRun(), edmtest::TestServiceTwo::preModuleStreamEndRun(), edm::service::Tracer::preModuleStreamEndRun(), NVProfilerService::preModuleStreamEndRun(), edm::service::Tracer::preModuleStreamPrefetching(), edm::service::Tracer::preModuleTransform(), edm::service::Tracer::preModuleTransformAcquiring(), edm::service::Tracer::preModuleTransformPrefetching(), edm::service::Tracer::preModuleWriteLumi(), edm::service::Tracer::preModuleWriteProcessBlock(), edm::service::Tracer::preModuleWriteRun(), edm::SystemTimeKeeper::restartModuleEvent(), edm::SystemTimeKeeper::startModuleEvent(), edm::SystemTimeKeeper::stopModuleEvent(), and edm::service::ConcurrentModuleTimer::trackModule().

55 { return moduleDescription_; }
ModuleDescription const * moduleDescription_

◆ parent()

ParentContext const& edm::ModuleCallingContext::parent ( void  ) const
inlinenoexcept

◆ placeInPathContext()

PlaceInPathContext const* edm::ModuleCallingContext::placeInPathContext ( ) const
inline

◆ previousModuleOnThread()

ModuleCallingContext const* edm::ModuleCallingContext::previousModuleOnThread ( ) const
inlinenoexcept

◆ setContext()

void edm::ModuleCallingContext::setContext ( State  state,
ParentContext const &  parent,
ModuleCallingContext const *  previousOnThread 
)
noexcept

Definition at line 32 of file ModuleCallingContext.cc.

References class-composition::parent.

34  {
35  state_ = state;
36  parent_ = parent;
37  previousModuleOnThread_ = previousOnThread;
38  }
ParentContext const & parent() const noexcept
State state() const noexcept
ModuleCallingContext const * previousModuleOnThread_

◆ setState()

void edm::ModuleCallingContext::setState ( State  state)
inlinenoexcept

Definition at line 53 of file ModuleCallingContext.h.

References state(), and state_.

Referenced by edm::Worker::beginStream(), and edm::Worker::endStream().

◆ state()

State edm::ModuleCallingContext::state ( ) const
inlinenoexcept

◆ streamContext()

StreamContext const* edm::ModuleCallingContext::streamContext ( ) const
inline

Definition at line 66 of file ModuleCallingContext.h.

References parent_, and edm::ParentContext::streamContext().

Referenced by edm::exceptionContext(), and getStreamContext().

66 { return parent_.streamContext(); }
StreamContext const * streamContext() const noexcept(false)

◆ type()

Type edm::ModuleCallingContext::type ( ) const
inlinenoexcept

Member Data Documentation

◆ id_

std::uintptr_t edm::ModuleCallingContext::id_
private

Definition at line 91 of file ModuleCallingContext.h.

Referenced by callID().

◆ moduleDescription_

ModuleDescription const* edm::ModuleCallingContext::moduleDescription_
private

Definition at line 89 of file ModuleCallingContext.h.

Referenced by moduleDescription().

◆ parent_

ParentContext edm::ModuleCallingContext::parent_
private

◆ previousModuleOnThread_

ModuleCallingContext const* edm::ModuleCallingContext::previousModuleOnThread_
private

Definition at line 88 of file ModuleCallingContext.h.

Referenced by previousModuleOnThread().

◆ state_

State edm::ModuleCallingContext::state_
private

Definition at line 92 of file ModuleCallingContext.h.

Referenced by setState(), and state().