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";
22 : base_class(
name, svcloc ),
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." );
48 ATH_MSG_INFO(
"ResumeEvent/PauseEvent don't work in conjuction with ProfiledAlgs. " <<
49 "Execute methods of all provided algorithms will be sampled in all events." );
55 if ((auditorSvc()==0) || auditorSvc()->getAuditor(
"VTuneAuditor")==0) {
57 return StatusCode::FAILURE;
74 return StatusCode::SUCCESS;
86 return StatusCode::SUCCESS;
93 m_runner = std::make_unique< VTuneProfileRunner >();
95 return StatusCode::SUCCESS;
107 return StatusCode::SUCCESS;
116 return StatusCode::SUCCESS;
136 if ( !
m_algs.empty() )
return;
141 if( inc.type() == ENDEVTLOOP_INCIDENT_NAME ) {
145 <<
"Could not pause the profiling";
154 if( inc.type() == BEGINEVENT_INCIDENT_NAME ) {
157 std::lock_guard<std::mutex> lock(
m_mutex);
164 <<
"Could not resume the profiling";
171 else if( inc.type() == ENDEVENT_INCIDENT_NAME ) {
173 std::lock_guard<std::mutex> lock(
m_mutex);
181 <<
"Could not pause the profiling";
202 return StatusCode::FAILURE;
205 if ( 0 != audSvc->getAuditor( audName ) ) {
207 << audName <<
"]... good.");
208 return StatusCode::SUCCESS;
211 const std::string
propName =
"Auditors";
212 IProperty * audSvcProp =
dynamic_cast<IProperty*
>(audSvc);
214 if ( 0 == audSvcProp ) {
215 ATH_MSG_ERROR (
"Could not dyn-cast IAuditorSvc to an IProperty !!");
216 return StatusCode::FAILURE;
219 StringArrayProperty audNames;
220 audNames.assign( audSvcProp->getProperty(
propName) );
221 std::vector<std::string> updatedNames( audNames.value() );
222 updatedNames.push_back( audName );
223 audNames.set( updatedNames );
225 if ( !audSvcProp->setProperty( audNames ).isSuccess() ) {
227 (
"Could not add [" << audName
228 <<
"] to the list of auditors of [AuditorSvc] !!"
230 << audSvcProp->getProperty(
propName));
231 return StatusCode::FAILURE;
235 if ( 0 == audSvc->getAuditor( audName ) ) {
237 << audName <<
"] !!");
238 return StatusCode::FAILURE;
242 return StatusCode::SUCCESS;