|
ATLAS Offline Software
|
Go to the documentation of this file.
14 static const std::string BEGINEVENT_INCIDENT_NAME =
"BeginEvent";
15 static const std::string ENDEVENT_INCIDENT_NAME =
"EndEvent";
16 static const std::string ENDEVTLOOP_INCIDENT_NAME =
"EndEvtLoop";
23 m_incidentSvc(
"IncidentSvc",
name ),
24 m_processedEvents( 0 ) {
27 "Event in which to resume the profiling." );
29 "Event in which to pause the profiling. Negative number "
30 "profiles the entire event-loop." );
31 declareProperty(
"ProfiledAlgs",
m_algs,
32 "List of profiled algorithms." );
43 return StatusCode::FAILURE;
48 return StatusCode::SUCCESS;
51 return AthService::queryInterface( riid, ppvIF );
68 ATH_MSG_INFO(
"ResumeEvent/PauseEvent don't work in conjuction with ProfiledAlgs. " <<
69 "Execute methods of all provided algorithms will be sampled in all events." );
75 if ((auditorSvc()==0) || auditorSvc()->getAuditor(
"VTuneAuditor")==0) {
77 return StatusCode::FAILURE;
94 return StatusCode::SUCCESS;
106 return StatusCode::SUCCESS;
113 m_runner = std::make_unique< VTuneProfileRunner >();
115 return StatusCode::SUCCESS;
127 return StatusCode::SUCCESS;
136 return StatusCode::SUCCESS;
156 if ( !
m_algs.empty() )
return;
161 if( inc.type() == ENDEVTLOOP_INCIDENT_NAME ) {
165 <<
"Could not pause the profiling";
174 if( inc.type() == BEGINEVENT_INCIDENT_NAME ) {
177 std::lock_guard<std::mutex> lock(
m_mutex);
184 <<
"Could not resume the profiling";
191 else if( inc.type() == ENDEVENT_INCIDENT_NAME ) {
193 std::lock_guard<std::mutex> lock(
m_mutex);
201 <<
"Could not pause the profiling";
222 return StatusCode::FAILURE;
225 if ( 0 != audSvc->getAuditor( audName ) ) {
227 << audName <<
"]... good.");
228 return StatusCode::SUCCESS;
231 const std::string
propName =
"Auditors";
232 IProperty * audSvcProp =
dynamic_cast<IProperty*
>(audSvc);
234 if ( 0 == audSvcProp ) {
235 ATH_MSG_ERROR (
"Could not dyn-cast IAuditorSvc to an IProperty !!");
236 return StatusCode::FAILURE;
239 StringArrayProperty audNames;
240 audNames.assign( audSvcProp->getProperty(
propName) );
241 std::vector<std::string> updatedNames( audNames.value() );
242 updatedNames.push_back( audName );
243 audNames.set( updatedNames );
245 if ( !audSvcProp->setProperty( audNames ).isSuccess() ) {
247 (
"Could not add [" << audName
248 <<
"] to the list of auditors of [AuditorSvc] !!"
250 << audSvcProp->getProperty(
propName));
251 return StatusCode::FAILURE;
255 if ( 0 == audSvc->getAuditor( audName ) ) {
257 << audName <<
"] !!");
258 return StatusCode::FAILURE;
262 return StatusCode::SUCCESS;
virtual bool isProfilingRunning() const override
Is the profiling running at the moment?
static const InterfaceID & interfaceID()
Interface ID definition.
#define ATH_MSG_VERBOSE(x)
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle to the incident service.
virtual StatusCode pauseProfiling() override
Pause profiling.
std::atomic< int > m_processedEvents
Number of events processed so far.
virtual StatusCode resumeProfiling() override
Resume profiling.
int m_resumeEvent
Property: Event in which profiling should start.
::StatusCode StatusCode
StatusCode definition for legacy code.
VTuneProfilerService(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi service constructor.
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvIF) override
Function declaring the interface(s) implemented by the service.
#define CHECK(...)
Evaluate an expression and check for errors.
virtual void handle(const Incident &inc) override
Function handling incoming incidents.
int m_pauseEvent
Property: Event in which profiling should pause.
Helpers for checking error return status codes and reporting errors.
virtual StatusCode initialize() override
Standard Gaudi initialization function.
#define REPORT_MESSAGE(LVL)
Report a message.
StatusCode makeAuditor(const std::string &audName, IAuditorSvc *audSvc)
Helper method to create auditors.
std::unique_ptr< VTuneProfileRunner > m_runner
Unique ptr to the VTuneProfileRunner.
#define ATH_MSG_WARNING(x)
std::vector< std::string > m_algs
Property: List of algorithms to profile.