13 #include <boost/foreach.hpp>
25 #pragma GCC diagnostic ignored "-Wunused-function"
27 #include "ittnotify.h"
29 typedef std::map<std::string, __itt_event>
TaskTypes;
51 const __itt_event event_ = 0,
const __itt_event parent_event_ = 0):
112 bool isIncluded(
const std::string& name)
const;
113 bool isExcluded(
const std::string& name)
const;
117 std::string
stackIndent(
bool newLevel =
false)
const;
118 std::string
taskTypeName(
const std::string& component_name)
const;
124 ,m_nEvents(0), m_isStarted(false) {
127 "Names of included algorithms."
130 "Names of excluded algorithms."
133 "After what event we stop profiling. "
134 "If 0 than we also profile finalization stage."
137 "After what event we stop profiling. "
138 "If 0 than we also profile finalization stage. Default = 0."
141 "Algorithm name, for which intel amplifier task type will be created."
142 "By default all algorithms have a corresponding task type.");
144 "The String delimiter between sequences/algorithms names in "
145 "\"Task Type\" grouping at Amplifier. Default=\" \"."
148 "Enable frames (needed for detecting slow events). Default=false."
151 "Frames rate. The recommended maximum rate for calling the Frame API is "
152 "1000 frames (events) per second. A higher rate may result in large product"
153 " memory consumption and slow finalization. "
154 "You need update \"slow-frames-threshold\" and \"fast-frames-threshold\" "
155 "parameters of amplxe-cl tool to separate slow, medium and fast events. "
156 "For use frames you need to switch on \"EnableFrames\". "
169 __itt_event taskId = 0;
170 TaskTypes::const_iterator iter =
m_tasktypes.find(typeName);
172 taskId = iter->second;
177 taskId = __itt_event_create(typeName.c_str(), typeName.size());
178 m_tasktypes.insert(TaskTypes::value_type(typeName, taskId));
184 if (parent != NULL) {
206 __itt_event_start(state.
event);
260 std::stringstream
indent(std::stringstream::out);
261 indent << std::setw(
stackLevel()*2+(newLevel?2:0)) <<
" ";
268 std::string delim =
"";
271 result += delim+value.
name;
293 std::string str_excluded, str_included, str_eventtypes;
296 str_excluded +=
" " +
name;
298 BOOST_FOREACH(
const std::string& name,
m_included)
300 str_included +=
" " +
name;
305 str_eventtypes +=
" " +
name;
310 <<
"): " << str_included <<
endmsg;
315 <<
"): " << str_excluded <<
endmsg;
320 <<
"): " << str_eventtypes <<
endmsg;
324 domain = __itt_domain_create(
"Event loop");
355 const std::string&
name = i->
name();
392 __itt_frame_begin_v3(
domain, NULL);
403 __itt_frame_end_v3(
domain, NULL);
407 const std::string&
name = i->
name();
413 if (state.
event != 0) {
416 __itt_event_end(state.
event);
428 }
else if (state.
status) {
const std::string BeginEvent
Processing of a new event has started.
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...
virtual const std::string & name() const
Retrieve the name of the instance.
const std::string & type() const
Access to the incident type.
StandardEventType
Defines the standard (= used by the framework) auditable event types.
std::vector< std::string > m_algs_for_tasktypes
const std::string EndProcessing
Incident raised just after the loop over the algorithms (note: before the execution of OutputStreams)...
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.
#define DECLARE_COMPONENT(type)
void after(StandardEventType type, INamedInterface *i, const StatusCode &sc)
Audit the end of a standard "event".
virtual const std::string & name() const =0
Retrieve the name of the instance.
virtual void before(StandardEventType, INamedInterface *)
The following methods are meant to be implemented by the child class...
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.
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.
void before(StandardEventType type, INamedInterface *i)
The following methods are meant to be implemented by the child class...
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)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
The interface implemented by the IncidentSvc service.
virtual void after(StandardEventType, INamedInterface *, const StatusCode &)
Audit the end of a standard "event".
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.