ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonVTune
src
VTuneAuditor.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Framework include(s)
6
#include "GaudiKernel/INamedInterface.h"
7
8
// Local include(s)
9
#include "
VTuneAuditor.h
"
10
11
/*
12
* Constructor
13
*/
14
VTuneAuditor::VTuneAuditor
(
const
std::string& name,
15
ISvcLocator* pSvcLocator ):
16
Auditor( name, pSvcLocator ),
17
m_vtuneProfilerSvc
(
"VTuneProfilerService"
, name )
18
{
19
20
declareProperty(
"ProfiledAlgs"
,
m_algs
,
21
"List of profiled algorithms."
);
22
23
}
24
25
/*
26
* Initialize the Auditor
27
*/
28
StatusCode
VTuneAuditor::initialize
()
29
{
30
31
if
( !
m_vtuneProfilerSvc
.retrieve().isSuccess() ) {
32
return
StatusCode::FAILURE;
33
}
34
35
// Copy algorithms from the service
36
const
IProperty* vtuneProfSvcProp =
dynamic_cast<
const
IProperty*
>
(&(*m_vtuneProfilerSvc));
37
if
( !vtuneProfSvcProp ) {
38
msgStream() << MSG::ERROR
39
<<
"Could not retrieve IProperty interface to VTuneProfilerService."
40
<<
endmsg
;
41
return
StatusCode::FAILURE;
42
}
43
44
std::vector<std::string> props2Copy = {
"ProfiledAlgs"
};
45
for
(
auto
& prop : props2Copy) {
46
if
( !
setProperty
(vtuneProfSvcProp->getProperty(prop)) ) {
47
msgStream() << MSG::ERROR
48
<<
"Cannot set "
<< prop <<
" property."
49
<<
endmsg
;
50
return
StatusCode::FAILURE;
51
}
52
}
53
54
return
StatusCode::SUCCESS;
55
56
}
57
58
/*
59
* Implementation of base class methods
60
*/
61
void
VTuneAuditor::before
(
const
std::string& event,
const
std::string& name,
const
EventContext& ) {
62
63
for
(
auto
& val :
m_algs
) {
64
if
( event == IAuditor::Execute && name == val ) {
65
if
(
m_vtuneProfilerSvc
->resumeProfiling().isFailure() ) {
66
msgStream() << MSG::ERROR
67
<<
"Could not resume the profiling from the auditor"
68
<<
endmsg
;
69
}
70
break
;
71
}
72
}
73
return
;
74
75
}
76
77
void
VTuneAuditor::after
(
const
std::string& event,
const
std::string& name,
const
EventContext&,
78
const
StatusCode& ) {
79
80
for
(
auto
& val :
m_algs
) {
81
if
( event == IAuditor::Execute && name == val ) {
82
if
(
m_vtuneProfilerSvc
->pauseProfiling().isFailure() ) {
83
msgStream() << MSG::ERROR
84
<<
"Could not pause the profiling from the auditor"
85
<<
endmsg
;
86
}
87
break
;
88
}
89
}
90
return
;
91
92
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
setProperty
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
Definition
NanobindBindings.cxx:75
VTuneAuditor.h
VTuneAuditor::after
virtual void after(const std::string &event, const std::string &name, const EventContext &, const StatusCode &) override
Definition
VTuneAuditor.cxx:77
VTuneAuditor::before
virtual void before(const std::string &event, const std::string &name, const EventContext &) override
Implement inherited methods from Auditor.
Definition
VTuneAuditor.cxx:61
VTuneAuditor::initialize
virtual StatusCode initialize() override
Gaudi hooks.
Definition
VTuneAuditor.cxx:28
VTuneAuditor::m_algs
std::vector< std::string > m_algs
Property: List of algorithms to profile.
Definition
VTuneAuditor.h:41
VTuneAuditor::VTuneAuditor
VTuneAuditor(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
VTuneAuditor.cxx:14
VTuneAuditor::m_vtuneProfilerSvc
ServiceHandle< IVTuneProfilerSvc > m_vtuneProfilerSvc
Handle to VTuneProfilerSvc.
Definition
VTuneAuditor.h:38
Generated on
for ATLAS Offline Software by
1.17.0