The Gaudi Framework  v33r0 (d5ea422b)
IntelProfilerAuditor Class Reference
Inheritance diagram for IntelProfilerAuditor:
Collaboration diagram for IntelProfilerAuditor:

Classes

struct  stack_entity
 

Public Member Functions

StatusCode initialize () override
 
void handle (const Incident &incident) override
 
void before (StandardEventType type, INamedInterface *i) override
 
void after (StandardEventType type, INamedInterface *i, const StatusCode &sc) override
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
- Public Member Functions inherited from extends< Auditor, IIncidentListener >
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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Auditor
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
 Auditor (const Auditor &a)=delete
 
Auditoroperator= (const Auditor &rhs)=delete
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize () override
 Finalization method invoked by the framework. More...
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
void beforeInitialize (INamedInterface *) override
 
void afterInitialize (INamedInterface *) override
 
void beforeReinitialize (INamedInterface *) override
 
void afterReinitialize (INamedInterface *) override
 
void beforeExecute (INamedInterface *) override
 
void afterExecute (INamedInterface *, const StatusCode &) override
 
void beforeFinalize (INamedInterface *) override
 
void afterFinalize (INamedInterface *) override
 
virtual StatusCode finalize ()
 
const std::stringname () const override
 
bool isEnabled () const override
 
SmartIF< ISvcLocator > & serviceLocator () const override
 The standard service locator. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T = IService>
SmartIF< T > service (const std::string &name, bool createIf=false) const
 
StatusCode setProperties ()
 Set the auditor's properties. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Private Member Functions

void start_profiling_component (const std::string &name)
 
void skip_profiling_component (const std::string &name)
 
void start ()
 
void pause ()
 
void resume ()
 
void stop ()
 
bool hasIncludes () const
 
bool isIncluded (const std::string &name) const
 
bool isExcluded (const std::string &name) const
 
bool isRunning () const
 
int stackLevel () const
 
std::string stackIndent (bool newLevel=false) const
 
std::string taskTypeName (const std::string &component_name) const
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_included {this, "IncludeAlgorithms", {}, "Names of included algorithms."}
 
Gaudi::Property< std::vector< std::string > > m_excluded {this, "ExcludeAlgorithms", {}, "Names of excluded algorithms."}
 
Gaudi::Property< int > m_nStartFromEvent
 
Gaudi::Property< int > m_nStopAtEvent
 
Gaudi::Property< std::vector< std::string > > m_algs_for_tasktypes
 
Gaudi::Property< std::stringm_alg_delim
 
Gaudi::Property< bool > m_enable_frames
 
Gaudi::Property< int > m_frames_rate
 
int m_nEvents = 0
 
__itt_domain * domain = nullptr
 
bool m_isStarted = false
 
std::vector< stack_entitym_stack
 
TaskTypes m_tasktypes
 

Additional Inherited Members

- Public Types inherited from extends< Auditor, IIncidentListener >
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 Auditor
using Factory = Gaudi::PluginService::Factory< IAuditor *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IAuditor, IProperty > >
using base_class = CommonMessaging
 
- 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...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Detailed Description

Definition at line 41 of file IntelProfilerAuditor.cpp.

Member Function Documentation

◆ after() [1/5]

void Auditor::after
override

Definition at line 107 of file Auditor.cpp.

107  {
108  switch ( evt ) {
109  case Initialize:
110  afterInitialize( obj );
111  break;
112  case ReInitialize:
113  afterReinitialize( obj );
114  break;
115  case Execute:
116  afterExecute( obj, sc );
117  break;
118  case Finalize:
119  afterFinalize( obj );
120  break;
121  case Start:
122  break;
123  case Stop:
124  break;
125  case ReStart:
126  break;
127  default:
128  break; // do nothing
129  }
130 }
void afterExecute(INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:141
void afterInitialize(INamedInterface *) override
Definition: Auditor.cpp:137
void afterFinalize(INamedInterface *) override
Definition: Auditor.cpp:143
void afterReinitialize(INamedInterface *) override
Definition: Auditor.cpp:139

◆ after() [2/5]

void Auditor::after
override

Definition at line 131 of file Auditor.cpp.

131 {}

◆ after() [3/5]

void Auditor::after
override

Definition at line 133 of file Auditor.cpp.

133 {}

◆ after() [4/5]

void Auditor::after
override

Definition at line 134 of file Auditor.cpp.

134 {}

◆ after() [5/5]

void IntelProfilerAuditor::after ( StandardEventType  type,
INamedInterface i,
const StatusCode sc 
)
override

Definition at line 328 of file IntelProfilerAuditor.cpp.

328  {
329  // Skip unnecessary event types
330  if ( !( ( type == IAuditor::Execute ) && m_isStarted ) ) return;
331 
332  if ( ( m_nEvents + 1 ) % m_frames_rate == 0 ) { __itt_frame_end_v3( domain, NULL ); }
333 
334  // Name of the current component
335  const std::string& name = i->name();
336  stack_entity state = m_stack.back();
337  // Remove component from stack.
338  m_stack.pop_back();
339 
340  if ( state.event != 0 ) {
341  debug() << stackIndent( true ) << "End event for " << name << endmsg;
342  __itt_event_end( state.event );
343 
344  if ( state.parent_event != 0 ) {
345  debug() << stackIndent() << "Resume event for " << state.parent_event << endmsg;
346  __itt_event_start( state.parent_event );
347  }
348  }
349 
350  if ( m_stack.empty() ) {
351  // Pause if there are no parent components (top algorithm).
352  pause();
353  } else if ( state.status ) {
354  // If the profiling is running and we have parent component that is
355  // paused then pause the profiling.
356  if ( !m_stack.back().status ) { pause(); }
357  } else {
358  // If the profiling was stopped, but the parent component should be profiled
359  // then resume profiling.
360  if ( m_stack.back().status ) { resume(); }
361  }
362 }
Gaudi::Property< int > m_frames_rate
virtual const std::string & name() const =0
Retrieve the name of the instance.
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< stack_entity > m_stack
const std::string & name() const override
Definition: Auditor.cpp:187
std::string stackIndent(bool newLevel=false) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ before() [1/5]

void Auditor::before
override

Definition at line 101 of file Auditor.cpp.

101 {}

◆ before() [2/5]

void Auditor::before
override

Definition at line 104 of file Auditor.cpp.

104 {}

◆ before() [3/5]

void Auditor::before
override

The following methods are meant to be implemented by the child class...

Definition at line 77 of file Auditor.cpp.

77  {
78  switch ( evt ) {
79  case Initialize:
80  beforeInitialize( obj );
81  break;
82  case ReInitialize:
83  beforeReinitialize( obj );
84  break;
85  case Execute:
86  beforeExecute( obj );
87  break;
88  case Finalize:
89  beforeFinalize( obj );
90  break;
91  case Start:
92  break;
93  case Stop:
94  break;
95  case ReStart:
96  break;
97  default:
98  break; // do nothing
99  }
100 }
void beforeInitialize(INamedInterface *) override
Definition: Auditor.cpp:136
void beforeExecute(INamedInterface *) override
Definition: Auditor.cpp:140
void beforeReinitialize(INamedInterface *) override
Definition: Auditor.cpp:138
void beforeFinalize(INamedInterface *) override
Definition: Auditor.cpp:142

◆ before() [4/5]

void Auditor::before
override

Definition at line 103 of file Auditor.cpp.

103 {}

◆ before() [5/5]

void IntelProfilerAuditor::before ( StandardEventType  type,
INamedInterface i 
)
override

Definition at line 284 of file IntelProfilerAuditor.cpp.

284  {
285  // Skip unnecessary event types.
286  if ( !( ( type == IAuditor::Execute ) && m_isStarted ) ) return;
287 
288  // Name of the current component.
289  const std::string& name = i->name();
290  // debug() << "Before: " << name << " " << type << endmsg;
291 
292  if ( isRunning() ) {
293  if ( isExcluded( name ) ) {
294  // If profiling is running and component is explicitly excluded
295  // then skip component.
297  } else {
298  // If profiling is running and component is'not explicitly excluded
299  // then start profiling for component (add to stack).
301  }
302  } else {
303  if ( hasIncludes() ) {
304  // If the profiling is not running and "includes" is explicitly defined ...
305  if ( isIncluded( name ) ) {
306  // and the current component is in the include's list then start the
307  // component profiling.
309  } else {
310  // and the current component is not in the includes list then skip
311  // a profiling of the component.
313  }
314  } else {
315  // If "Includes" property isn't present and the component is ...
316  if ( isExcluded( name ) ) {
317  // in the excludes list then skip a profiling
319  } else {
320  // not in the exclude list then start a profiling
322  }
323  }
324  }
325  if ( m_nEvents % m_frames_rate == 0 ) { __itt_frame_begin_v3( domain, NULL ); }
326 }
void start_profiling_component(const std::string &name)
void skip_profiling_component(const std::string &name)
Gaudi::Property< int > m_frames_rate
virtual const std::string & name() const =0
Retrieve the name of the instance.
STL class.
bool isExcluded(const std::string &name) const
const std::string & name() const override
Definition: Auditor.cpp:187
bool isIncluded(const std::string &name) const

◆ handle()

void IntelProfilerAuditor::handle ( const Incident incident)
override

Definition at line 268 of file IntelProfilerAuditor.cpp.

268  {
269  if ( IncidentType::BeginEvent != incident.type() ) return;
270  // Increment the event counter
271  ++m_nEvents;
272 
273  if ( m_nStartFromEvent == m_nEvents ) {
274  info() << "Start profiling (event #" << m_nEvents << ")" << endmsg;
275  start();
276  }
277 
278  if ( m_nStopAtEvent == m_nEvents ) {
279  info() << "Stop profiling (event #" << m_nEvents << ")" << endmsg;
280  stop();
281  }
282 }
Gaudi::Property< int > m_nStartFromEvent
Gaudi::Property< int > m_nStopAtEvent
const std::string & type() const
Access to the incident type.
Definition: Incident.h:48
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ hasIncludes()

bool IntelProfilerAuditor::hasIncludes ( ) const
private

Definition at line 200 of file IntelProfilerAuditor.cpp.

200 { return !m_included.empty(); }
Gaudi::Property< std::vector< std::string > > m_included

◆ initialize()

StatusCode IntelProfilerAuditor::initialize ( )
overridevirtual

Reimplemented from Auditor.

Definition at line 230 of file IntelProfilerAuditor.cpp.

230  {
231  info() << "Initialised" << endmsg;
232 
233  IIncidentSvc* inSvc = NULL;
234  const StatusCode sc = serviceLocator()->service( "IncidentSvc", inSvc );
235  if ( sc.isFailure() ) return sc;
236  // Useful to start profiling only after some event, we don't need profile
237  // initialization stage. For that we need to count events with BeginEvent
238  // listener.
239  inSvc->addListener( this, IncidentType::BeginEvent );
240  // If the end event number don't setup we finish profiling at the end
241  // of loop. We don't need profiling finalization stage.
242  inSvc->addListener( this, IncidentType::EndProcessing );
243 
244  std::string str_excluded, str_included, str_eventtypes;
245  for ( const auto& name : m_excluded ) { str_excluded += " " + name; }
246  for ( const auto& name : m_included ) { str_included += " " + name; }
247  for ( const auto& name : m_algs_for_tasktypes ) { str_eventtypes += " " + name; }
248 
249  if ( !m_included.empty() ) {
250  info() << "Included algorithms (" << m_included.size() << "): " << str_included << endmsg;
251  }
252 
253  if ( !m_excluded.empty() ) {
254  info() << "Excluded algorithms (" << m_excluded.size() << "): " << str_excluded << endmsg;
255  }
256 
257  if ( !m_algs_for_tasktypes.empty() ) {
258  info() << "Event types (" << m_algs_for_tasktypes.size() << "): " << str_eventtypes << endmsg;
259  }
260 
261  // Create a profiler domain for detection of slow events.
262  domain = __itt_domain_create( "Event loop" );
263  domain->flags = m_enable_frames;
264 
265  return StatusCode::SUCCESS;
266 }
Gaudi::Property< std::vector< std::string > > m_algs_for_tasktypes
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
Gaudi::Property< std::vector< std::string > > m_included
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Auditor.cpp:191
STL class.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Gaudi::Property< std::vector< std::string > > m_excluded
Gaudi::Property< bool > m_enable_frames
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
const std::string & name() const override
Definition: Auditor.cpp:187
bool isFailure() const
Definition: StatusCode.h:141
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:33

◆ isExcluded()

bool IntelProfilerAuditor::isExcluded ( const std::string name) const
private

Definition at line 206 of file IntelProfilerAuditor.cpp.

206  {
207  return std::find( m_excluded.begin(), m_excluded.end(), name ) != m_excluded.end();
208 }
Gaudi::Property< std::vector< std::string > > m_excluded
T find(T... args)
const std::string & name() const override
Definition: Auditor.cpp:187

◆ isIncluded()

bool IntelProfilerAuditor::isIncluded ( const std::string name) const
private

Definition at line 202 of file IntelProfilerAuditor.cpp.

202  {
203  return std::find( m_included.begin(), m_included.end(), name ) != m_included.end();
204 }
Gaudi::Property< std::vector< std::string > > m_included
T find(T... args)
const std::string & name() const override
Definition: Auditor.cpp:187

◆ isRunning()

bool IntelProfilerAuditor::isRunning ( ) const
private

Definition at line 210 of file IntelProfilerAuditor.cpp.

210 { return !m_stack.empty() && m_stack.back().status; }
std::vector< stack_entity > m_stack

◆ pause()

void IntelProfilerAuditor::pause ( )
private

Definition at line 182 of file IntelProfilerAuditor.cpp.

182  {
183  if ( !m_isStarted ) return;
184  debug() << stackIndent() << "Pause" << endmsg;
185  __itt_pause();
186 }
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::string stackIndent(bool newLevel=false) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ resume()

void IntelProfilerAuditor::resume ( )
private

Definition at line 176 of file IntelProfilerAuditor.cpp.

176  {
177  if ( !m_isStarted ) return;
178  debug() << stackIndent() << "Resume" << endmsg;
179  __itt_resume();
180 }
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::string stackIndent(bool newLevel=false) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ skip_profiling_component()

void IntelProfilerAuditor::skip_profiling_component ( const std::string name)
private

Definition at line 188 of file IntelProfilerAuditor.cpp.

188  {
189  if ( !m_isStarted ) return;
190  m_stack.push_back( stack_entity( name, false ) );
191  debug() << stackIndent() << "Skip component " << name << endmsg;
192 }
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< stack_entity > m_stack
const std::string & name() const override
Definition: Auditor.cpp:187
std::string stackIndent(bool newLevel=false) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ stackIndent()

std::string IntelProfilerAuditor::stackIndent ( bool  newLevel = false) const
private

Definition at line 214 of file IntelProfilerAuditor.cpp.

214  {
215  std::stringstream indent( std::stringstream::out );
216  indent << std::setw( stackLevel() * 2 + ( newLevel ? 2 : 0 ) ) << " ";
217  return indent.str();
218 }
T setw(T... args)

◆ stackLevel()

int IntelProfilerAuditor::stackLevel ( ) const
private

Definition at line 212 of file IntelProfilerAuditor.cpp.

212 { return m_stack.size(); }
std::vector< stack_entity > m_stack

◆ start()

void IntelProfilerAuditor::start ( )
private

Definition at line 130 of file IntelProfilerAuditor.cpp.

130  {
131  m_isStarted = true;
132  __itt_resume();
133 }

◆ start_profiling_component()

void IntelProfilerAuditor::start_profiling_component ( const std::string name)
private

Definition at line 135 of file IntelProfilerAuditor.cpp.

135  {
136  if ( !m_isStarted ) return;
138  __itt_event taskId = 0;
139  TaskTypes::const_iterator iter = m_tasktypes.find( typeName );
140  if ( iter != m_tasktypes.end() ) { taskId = iter->second; }
141 
142  if ( !taskId && m_algs_for_tasktypes.empty() ) {
143  // Create event
144  taskId = __itt_event_create( typeName.c_str(), typeName.size() );
145  m_tasktypes.insert( TaskTypes::value_type( typeName, taskId ) );
146  }
147 
148  stack_entity state = stack_entity( name, true, taskId );
149  stack_entity* parent = !m_stack.empty() ? &m_stack.back() : NULL;
150 
151  if ( parent != NULL ) {
152  if ( parent->event ) {
153  state.parent_event = parent->event;
154  } else {
155  state.parent_event = parent->parent_event;
156  }
157  }
158 
159  if ( taskId && state.parent_event ) {
160  debug() << stackIndent() << "Pause event " << state.parent_event << endmsg;
161  __itt_event_end( state.parent_event );
162  }
163  m_stack.push_back( state );
164 
165  debug() << stackIndent() << "Start profiling component " << typeName << endmsg;
166 
167  if ( taskId ) {
168  // Start event
169  debug() << stackIndent() << "Start event type " << state.event << " for " << typeName << endmsg;
170  __itt_event_start( state.event );
171  }
172 
173  __itt_resume();
174 }
Gaudi::Property< std::vector< std::string > > m_algs_for_tasktypes
T end(T... args)
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< stack_entity > m_stack
T insert(T... args)
T find(T... args)
T size(T... args)
T c_str(T... args)
std::string taskTypeName(const std::string &component_name) const
const std::string & name() const override
Definition: Auditor.cpp:187
std::string stackIndent(bool newLevel=false) const
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:31
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ stop()

void IntelProfilerAuditor::stop ( )
private

Definition at line 194 of file IntelProfilerAuditor.cpp.

194  {
195  if ( !m_isStarted ) return;
196  m_isStarted = false;
197  __itt_pause();
198 }

◆ taskTypeName()

std::string IntelProfilerAuditor::taskTypeName ( const std::string component_name) const
private

Definition at line 220 of file IntelProfilerAuditor.cpp.

220  {
221  std::string result;
222  std::string delim = "";
223  for ( const auto& value : m_stack ) {
224  result += delim + value.name;
225  delim = m_alg_delim;
226  }
227  return result + m_alg_delim + component_name;
228 }
STL class.
std::vector< stack_entity > m_stack
Gaudi::Property< std::string > m_alg_delim

Member Data Documentation

◆ domain

__itt_domain* IntelProfilerAuditor::domain = nullptr
private

Definition at line 102 of file IntelProfilerAuditor.cpp.

◆ m_alg_delim

Gaudi::Property<std::string> IntelProfilerAuditor::m_alg_delim
private
Initial value:
{this, "TaskTypeNameDelimeter", " ",
"The String delimiter between sequences/algorithms names in "
"\"Task Type\" grouping at Amplifier. Default=\" \"."}

Definition at line 84 of file IntelProfilerAuditor.cpp.

◆ m_algs_for_tasktypes

Gaudi::Property<std::vector<std::string> > IntelProfilerAuditor::m_algs_for_tasktypes
private
Initial value:
{
this,
"ComponentsForTaskTypes",
{},
"Algorithm name, for which intel amplifier task type will be created."
"By default all algorithms have a corresponding task type."}

Definition at line 78 of file IntelProfilerAuditor.cpp.

◆ m_enable_frames

Gaudi::Property<bool> IntelProfilerAuditor::m_enable_frames
private
Initial value:
{this, "EnableFrames", false,
"Enable frames (needed for detecting slow events). Default=false."}

Definition at line 87 of file IntelProfilerAuditor.cpp.

◆ m_excluded

Gaudi::Property<std::vector<std::string> > IntelProfilerAuditor::m_excluded {this, "ExcludeAlgorithms", {}, "Names of excluded algorithms."}
private

Definition at line 72 of file IntelProfilerAuditor.cpp.

◆ m_frames_rate

Gaudi::Property<int> IntelProfilerAuditor::m_frames_rate
private
Initial value:
{this, "FramesRate", 100,
"Frames rate. The recommended maximum rate for calling the Frame API is "
"1000 frames (events) per second. A higher rate may result in large product"
" memory consumption and slow finalization. "
"You need update \"slow-frames-threshold\" and \"fast-frames-threshold\" "
"parameters of amplxe-cl tool to separate slow, medium and fast events. "
"For use frames you need to switch on \"EnableFrames\". "
"Default=100"}

Definition at line 89 of file IntelProfilerAuditor.cpp.

◆ m_included

Gaudi::Property<std::vector<std::string> > IntelProfilerAuditor::m_included {this, "IncludeAlgorithms", {}, "Names of included algorithms."}
private

Definition at line 71 of file IntelProfilerAuditor.cpp.

◆ m_isStarted

bool IntelProfilerAuditor::m_isStarted = false
private

Definition at line 104 of file IntelProfilerAuditor.cpp.

◆ m_nEvents

int IntelProfilerAuditor::m_nEvents = 0
private

Definition at line 100 of file IntelProfilerAuditor.cpp.

◆ m_nStartFromEvent

Gaudi::Property<int> IntelProfilerAuditor::m_nStartFromEvent
private
Initial value:
{
this, "StartFromEventN", 1, "After what event we stop profiling. If 0 than we also profile finalization stage."}

Definition at line 73 of file IntelProfilerAuditor.cpp.

◆ m_nStopAtEvent

Gaudi::Property<int> IntelProfilerAuditor::m_nStopAtEvent
private
Initial value:
{
this, "StopAtEventN", 0,
"After what event we stop profiling. If 0 than we also profile finalization stage. Default = 0."}

Definition at line 75 of file IntelProfilerAuditor.cpp.

◆ m_stack

std::vector<stack_entity> IntelProfilerAuditor::m_stack
private

Definition at line 106 of file IntelProfilerAuditor.cpp.

◆ m_tasktypes

TaskTypes IntelProfilerAuditor::m_tasktypes
private

Definition at line 108 of file IntelProfilerAuditor.cpp.


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