TimelineSvc Class Reference

#include <src/TimelineSvc.h>

Inheritance diagram for TimelineSvc:
Collaboration diagram for TimelineSvc:

Public Member Functions

virtual StatusCode initialize ()
 
virtual StatusCode reinitialize ()
 
virtual StatusCode finalize ()
 
virtual void registerTimelineEvent (const TimelineEvent &e)
 
bool isEnabled () const
 
 TimelineSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~TimelineSvc ()
 
- Public Member Functions inherited from extends< BASE, Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Member Functions

void outputTimeline ()
 

Private Attributes

bool m_isEnabled
 
std::string m_timelineFile
 
tbb::concurrent_vector< TimelineEventm_events
 

Additional Inherited Members

- Public Types inherited from extends< BASE, Interfaces >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

Definition at line 12 of file TimelineSvc.h.

Constructor & Destructor Documentation

TimelineSvc::TimelineSvc ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 7 of file TimelineSvc.cpp.

8  : base_class( name, svc )
9 {
10 
11  declareProperty("TimelineFile", m_timelineFile = "timeline.csv");
12  declareProperty("RecordTimeline", m_isEnabled = false);
13 
14 }
extends base_class
Typedef to this class.
Definition: extends.h:14
std::string m_timelineFile
Definition: TimelineSvc.h:34
bool m_isEnabled
Definition: TimelineSvc.h:33
TimelineSvc::~TimelineSvc ( )
virtual

Definition at line 18 of file TimelineSvc.cpp.

18  {
19 
20 }

Member Function Documentation

StatusCode TimelineSvc::finalize ( )
virtual

Definition at line 56 of file TimelineSvc.cpp.

56  {
57 
58  if (m_events.size() > 0) {
59  MsgStream log( msgSvc(), name() );
60 
61  log << MSG::INFO << "Outputting timeline with " << m_events.size() << " entries to file " << m_timelineFile << endmsg;
62 
64 
65  }
66 
67  return StatusCode::SUCCESS;
68 
69 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::string m_timelineFile
Definition: TimelineSvc.h:34
tbb::concurrent_vector< TimelineEvent > m_events
Definition: TimelineSvc.h:35
void outputTimeline()
Definition: TimelineSvc.cpp:86
StatusCode TimelineSvc::initialize ( )
virtual

Definition at line 26 of file TimelineSvc.cpp.

26  {
27 
29  if (!sc.isSuccess()) return sc;
30 
31  MsgStream log( msgSvc(), name() );
32  log << MSG::DEBUG << "initialize" << endmsg;
33 
34  m_events.clear();
35 
36  return StatusCode::SUCCESS;
37 
38 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode initialize() override
Definition: Service.cpp:63
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
tbb::concurrent_vector< TimelineEvent > m_events
Definition: TimelineSvc.h:35
bool TimelineSvc::isEnabled ( ) const
inline

Definition at line 22 of file TimelineSvc.h.

22 { return m_isEnabled; }
bool m_isEnabled
Definition: TimelineSvc.h:33
void TimelineSvc::outputTimeline ( )
private

Definition at line 86 of file TimelineSvc.cpp.

86  {
87 
88  std::ofstream out(m_timelineFile, std::ofstream::out | std::ofstream::trunc);
89 
90  out << "#start end algorithm thread slot event" << std::endl;
91 
92  for(const auto & e : m_events){
93  out << std::chrono::duration_cast<std::chrono::nanoseconds>(e.start.time_since_epoch()).count() << " "
94  << std::chrono::duration_cast<std::chrono::nanoseconds>(e.end.time_since_epoch()).count() << " "
95  << e.algorithm << " "
96  << e.thread << " "
97  << e.slot << " "
98  << e.event << std::endl;
99  }
100 
101  out.close();
102 
103 }
std::string m_timelineFile
Definition: TimelineSvc.h:34
tbb::concurrent_vector< TimelineEvent > m_events
Definition: TimelineSvc.h:35
void TimelineSvc::registerTimelineEvent ( const TimelineEvent e)
virtual

Definition at line 75 of file TimelineSvc.cpp.

75  {
76 
77  m_events.push_back(e);
78 
79 }
tbb::concurrent_vector< TimelineEvent > m_events
Definition: TimelineSvc.h:35
StatusCode TimelineSvc::reinitialize ( )
virtual

Definition at line 43 of file TimelineSvc.cpp.

43  {
44 
45  MsgStream log( msgSvc(), name() );
46  log << MSG::DEBUG << "reinitialize" << endmsg;
47 
48  m_events.clear();
49 
50  return StatusCode::SUCCESS;
51 
52 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
tbb::concurrent_vector< TimelineEvent > m_events
Definition: TimelineSvc.h:35

Member Data Documentation

tbb::concurrent_vector<TimelineEvent> TimelineSvc::m_events
private

Definition at line 35 of file TimelineSvc.h.

bool TimelineSvc::m_isEnabled
private

Definition at line 33 of file TimelineSvc.h.

std::string TimelineSvc::m_timelineFile
private

Definition at line 34 of file TimelineSvc.h.


The documentation for this class was generated from the following files: