The Gaudi Framework  v33r0 (d5ea422b)
precedence::Duration Struct Reference

#include <src/PRGraph/PrecedenceRulesGraph.h>

Collaboration diagram for precedence::Duration:

Public Member Functions

 Duration (const EventSlot &slot, SmartIF< ISvcLocator > &svcLocator)
 
std::string operator() (const AlgoProps &props) const
 
std::string operator() (const DecisionHubProps &) const
 
std::string operator() (const DataProps &) const
 

Public Attributes

const EventSlotm_slot
 
SmartIF< ITimelineSvcm_timelineSvc
 

Detailed Description

Definition at line 338 of file PrecedenceRulesGraph.h.

Constructor & Destructor Documentation

◆ Duration()

precedence::Duration::Duration ( const EventSlot slot,
SmartIF< ISvcLocator > &  svcLocator 
)
inline

Definition at line 339 of file PrecedenceRulesGraph.h.

339  : m_slot( slot ) {
341  MsgStream log{msgSvc, "Duration.Getter"};
342 
343  // Figure if we can discover the algorithm timings
344  m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
345  if ( !m_timelineSvc.isValid() )
346  log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to add "
347  << "algorithm's runtimes to the TTT dumps" << endmsg;
348  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:34
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:72
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:86
SmartIF< ITimelineSvc > m_timelineSvc
GAUDI_API ISvcLocator * svcLocator()
const EventSlot & m_slot
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

Member Function Documentation

◆ operator()() [1/3]

std::string precedence::Duration::operator() ( const AlgoProps props) const
inline

Definition at line 350 of file PrecedenceRulesGraph.h.

350  {
351 
353 
354  if ( m_timelineSvc.isValid() ) {
355 
356  TimelineEvent te;
357  te.algorithm = props.m_name;
358  te.slot = m_slot.eventContext->slot();
359  te.event = m_slot.eventContext->evt();
360 
362  time = std::to_string( std::chrono::duration_cast<std::chrono::nanoseconds>( te.end - te.start ).count() );
363  }
364 
365  return time;
366  }
ContextID_t slot() const
Definition: EventContext.h:51
ContextEvt_t evt() const
Definition: EventContext.h:50
T to_string(T... args)
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:72
virtual bool getTimelineEvent(TimelineEvent &) const =0
std::string algorithm
Definition: ITimelineSvc.h:31
STL class.
time_point end
Definition: ITimelineSvc.h:34
SmartIF< ITimelineSvc > m_timelineSvc
const EventSlot & m_slot
time_point start
Definition: ITimelineSvc.h:33
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
Definition: EventSlot.h:83

◆ operator()() [2/3]

std::string precedence::Duration::operator() ( const DecisionHubProps ) const
inline

Definition at line 368 of file PrecedenceRulesGraph.h.

368 { return ""; }

◆ operator()() [3/3]

std::string precedence::Duration::operator() ( const DataProps ) const
inline

Definition at line 370 of file PrecedenceRulesGraph.h.

370 { return ""; }

Member Data Documentation

◆ m_slot

const EventSlot& precedence::Duration::m_slot

Definition at line 372 of file PrecedenceRulesGraph.h.

◆ m_timelineSvc

SmartIF<ITimelineSvc> precedence::Duration::m_timelineSvc

Definition at line 373 of file PrecedenceRulesGraph.h.


The documentation for this struct was generated from the following file: