13 #include "GaudiKernel/Auditor.h"
14 #include "GaudiKernel/IAuditorSvc.h"
15 #include "GaudiKernel/GaudiException.h"
16 #include "GaudiKernel/MsgStream.h"
17 #include "GaudiKernel/IIncidentListener.h"
18 #include "GaudiKernel/IIncidentSvc.h"
22 #pragma GCC diagnostic ignored "-Wunused-function"
24 #include "ittnotify.h"
26 typedef std::map<std::string, __itt_event>
TaskTypes;
48 const __itt_event event_ = 0,
const __itt_event parent_event_ = 0):
109 bool isIncluded(
const std::string& name)
const;
110 bool isExcluded(
const std::string& name)
const;
114 std::string
stackIndent(
bool newLevel =
false)
const;
115 std::string
taskTypeName(
const std::string& component_name)
const;
121 ,m_nEvents(0), m_isStarted(false) {
124 "Names of included algorithms."
127 "Names of excluded algorithms."
130 "After what event we stop profiling. "
131 "If 0 than we also profile finalization stage."
134 "After what event we stop profiling. "
135 "If 0 than we also profile finalization stage. Default = 0."
138 "Algorithm name, for which intel amplifier task type will be created."
139 "By default all algorithms have a corresponding task type.");
141 "The String delimiter between sequences/algorithms names in "
142 "\"Task Type\" grouping at Amplifier. Default=\" \"."
145 "Enable frames (needed for detecting slow events). Default=false."
148 "Frames rate. The recommended maximum rate for calling the Frame API is "
149 "1000 frames (events) per second. A higher rate may result in large product"
150 " memory consumption and slow finalization. "
151 "You need update \"slow-frames-threshold\" and \"fast-frames-threshold\" "
152 "parameters of amplxe-cl tool to separate slow, medium and fast events. "
153 "For use frames you need to switch on \"EnableFrames\". "
166 __itt_event taskId = 0;
167 TaskTypes::const_iterator iter =
m_tasktypes.find(typeName);
169 taskId = iter->second;
174 taskId = __itt_event_create(typeName.c_str(), typeName.size());
175 m_tasktypes.insert(TaskTypes::value_type(typeName, taskId));
181 if (parent != NULL) {
203 __itt_event_start(state.
event);
257 std::stringstream
indent(std::stringstream::out);
258 indent << std::setw(
stackLevel()*2+(newLevel?2:0)) <<
" ";
265 std::string delim =
"";
267 result += delim+
value.name;
284 inSvc->
addListener(
this, IncidentType::BeginEvent);
287 inSvc->
addListener(
this, IncidentType::EndProcessing);
289 std::string str_excluded, str_included, str_eventtypes;
291 str_excluded +=
" " +
name;
294 str_included +=
" " +
name;
297 str_eventtypes +=
" " +
name;
300 if (!m_included.empty()) {
301 m_log <<
MSG::INFO <<
"Included algorithms (" << m_included.size()
302 <<
"): " << str_included <<
endmsg;
305 if (!m_excluded.empty()){
306 m_log <<
MSG::INFO <<
"Excluded algorithms (" << m_excluded.size()
307 <<
"): " << str_excluded <<
endmsg;
310 if (!m_algs_for_tasktypes.empty()){
311 m_log <<
MSG::INFO <<
"Event types (" << m_algs_for_tasktypes.size()
312 <<
"): " << str_eventtypes <<
endmsg;
316 domain = __itt_domain_create(
"Event loop");
325 if (IncidentType::BeginEvent != incident.
type())
return;
347 const std::string&
name = i->
name();
384 __itt_frame_begin_v3(
domain, NULL);
395 __itt_frame_end_v3(
domain, NULL);
399 const std::string&
name = i->
name();
405 if (state.
event != 0) {
408 __itt_event_end(state.
event);
420 }
else if (state.
status) {
void start_profiling_component(const std::string &name)
std::map< std::string, __itt_event > TaskTypes
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const std::string & type() const
Access to the incident type.
std::vector< std::string > m_algs_for_tasktypes
void skip_profiling_component(const std::string &name)
bool isExcluded(const std::string &name) const
bool isFailure() const
Test for a status code of FAILURE.
void after(StandardEventType type, INamedInterface *i, const StatusCode &sc)
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
std::vector< std::string > m_excluded
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
The interface implemented by any class wanting to listen to Incidents.
stack_entity(const std::string &name_, bool status_, const __itt_event event_=0, const __itt_event parent_event_=0)
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
void after(StandardEventType, INamedInterface *, const StatusCode &) override
IntelProfilerAuditor(const std::string &name, ISvcLocator *pSvcLocator)
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
std::vector< stack_entity > m_stack
std::string stackIndent(bool newLevel=false) const
IInterface compliant class extending IInterface with the name() method.
std::string taskTypeName(const std::string &component_name) const
Base class for all Incidents (computing events).
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
void setLevel(int level)
Update outputlevel.
const std::string & name() const override
void before(StandardEventType type, INamedInterface *i)
int outputLevel() const
Retrieve the output level of current auditor.
bool isIncluded(const std::string &name) const
std::string typeName(const std::type_info &typ)
void before(StandardEventType, INamedInterface *) override
The following methods are meant to be implemented by the child class...
The interface implemented by the IncidentSvc service.
std::vector< std::string > m_included
Base class from which all concrete auditor classes should be derived.
void handle(const Incident &incident)
Inform that a new incident has occurred.