The Gaudi Framework  v31r0 (aeb156f0)
precedence::Duration Struct Reference

#include <src/PrecedenceRulesGraph.h>

Inheritance diagram for precedence::Duration:
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 329 of file PrecedenceRulesGraph.h.

Constructor & Destructor Documentation

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

Definition at line 330 of file PrecedenceRulesGraph.h.

330  : m_slot( slot ) {
331  SmartIF<IMessageSvc> msgSvc{svcLocator};
332  MsgStream log{msgSvc, "Duration.Getter"};
333 
334  // Figure if we can discover the algorithm timings
335  m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
336  if ( !m_timelineSvc.isValid() )
337  log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to add "
338  << "algorithm's runtimes to the TTT dumps" << endmsg;
339  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
SmartIF< ITimelineSvc > m_timelineSvc
const EventSlot & m_slot
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

Member Function Documentation

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

Definition at line 341 of file PrecedenceRulesGraph.h.

341  {
342 
344 
345  if ( m_timelineSvc.isValid() ) {
346 
347  TimelineEvent te;
348  te.algorithm = props.m_name;
349  te.slot = m_slot.eventContext->slot();
350  te.event = m_slot.eventContext->evt();
351 
353  time = std::to_string( std::chrono::duration_cast<std::chrono::nanoseconds>( te.end - te.start ).count() );
354  }
355 
356  return time;
357  }
ContextID_t slot() const
Definition: EventContext.h:48
T to_string(T...args)
std::string algorithm
Definition: ITimelineSvc.h:21
ContextEvt_t evt() const
Definition: EventContext.h:47
STL class.
time_point end
Definition: ITimelineSvc.h:24
SmartIF< ITimelineSvc > m_timelineSvc
const EventSlot & m_slot
time_point start
Definition: ITimelineSvc.h:23
virtual bool getTimelineEvent(TimelineEvent &) const =0
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
Definition: EventSlot.h:73
std::string precedence::Duration::operator() ( const DecisionHubProps ) const
inline

Definition at line 359 of file PrecedenceRulesGraph.h.

359 { return ""; }
std::string precedence::Duration::operator() ( const DataProps ) const
inline

Definition at line 361 of file PrecedenceRulesGraph.h.

361 { return ""; }

Member Data Documentation

const EventSlot& precedence::Duration::m_slot

Definition at line 363 of file PrecedenceRulesGraph.h.

SmartIF<ITimelineSvc> precedence::Duration::m_timelineSvc

Definition at line 364 of file PrecedenceRulesGraph.h.


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