The Gaudi Framework  v32r2 (46d42edc)
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 328 of file PrecedenceRulesGraph.h.

Constructor & Destructor Documentation

◆ Duration()

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

Definition at line 329 of file PrecedenceRulesGraph.h.

329  : m_slot( slot ) {
331  MsgStream log{msgSvc, "Duration.Getter"};
332 
333  // Figure if we can discover the algorithm timings
334  m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
335  if ( !m_timelineSvc.isValid() )
336  log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to add "
337  << "algorithm's runtimes to the TTT dumps" << endmsg;
338  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
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
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:192

Member Function Documentation

◆ operator()() [1/3]

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

Definition at line 340 of file PrecedenceRulesGraph.h.

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

◆ operator()() [2/3]

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

Definition at line 358 of file PrecedenceRulesGraph.h.

358 { return ""; }

◆ operator()() [3/3]

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

Definition at line 360 of file PrecedenceRulesGraph.h.

360 { return ""; }

Member Data Documentation

◆ m_slot

const EventSlot& precedence::Duration::m_slot

Definition at line 362 of file PrecedenceRulesGraph.h.

◆ m_timelineSvc

SmartIF<ITimelineSvc> precedence::Duration::m_timelineSvc

Definition at line 363 of file PrecedenceRulesGraph.h.


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