Go to the documentation of this file.
20 #include <gperftools/heap-checker.h>
21 #include <gperftools/heap-profiler.h>
22 #include <gperftools/profiler.h>
41 using extends::extends;
45 info() <<
"Initialised" <<
endmsg;
50 inSvc->addListener(
this, IncidentType::BeginEvent );
79 info() <<
" -> Stopping full audit" <<
endmsg;
89 if (
auto alg =
dynamic_cast<IAlgorithm*
>( i ) ) {
return alg->isSequence(); }
119 if ( IncidentType::BeginEvent == incident.
type() ) {
154 info() <<
"Starting Auditor for " <<
s <<
":" <<
type <<
endmsg;
158 warning() <<
"Auditor already running. Cannot be started for " <<
s <<
endmsg;
215 {
"Initialize",
"ReInitialize",
"Execute",
"Finalize" },
216 "List of phases to activate the Auditoring during" };
218 this,
"DisableFor", {},
"List of component names to disable the auditing for" };
220 this,
"EnableFor", {},
"Any component in this list will be audited. If empty, all will be done." };
223 this,
"DoFullEventProfile",
false,
224 "If true, instead of individually auditing components, the full event (or events) will be audited in one go" };
226 this,
"FullEventNSampleEvents", 1,
"The number of events to include in a full event audit, if enabled" };
228 "Number of events to skip before activating the auditing" };
230 "If true, auditing will be skipped for Sequencer objects." };
257 using AuditorBase::AuditorBase;
265 const char* profile = GetHeapProfile();
266 info() << profile <<
endmsg;
296 using AuditorBase::AuditorBase;
302 const char* HEAPCHECK = getenv(
"HEAPCHECK" );
304 fatal() <<
"Environment variable HEAPCHECK must be set to 'local'" <<
endmsg;
308 warning() <<
"Environment variable HEAPCHECK is set to " << HEAPCHECK
309 <<
" Partial Program Heap Checking is disabled" <<
endmsg;
323 if ( !
m_checker->NoLeaks() ) { warning() <<
"Leak detected for " <<
s <<
endmsg; }
351 using AuditorBase::AuditorBase;
357 ProfilerStart( (
s +
".prof" ).c_str() );
void after(CustomEventTypeRef type, const std::string &s, const StatusCode &) override
void before(CustomEventTypeRef type, const std::string &s) override
void google_before(const std::string &s) override
Start the google tool.
Gaudi::Property< int > m_freq
Gaudi::Property< bool > m_dumpProfileHeaps
void after(StandardEventType type, INamedInterface *i, const StatusCode &sc) override
bool m_inFullAudit
Internal flag to indicate if we are current in a full event audit.
bool alreadyRunning() override
check if we are already running the tool
virtual const std::string & name() const =0
Retrieve the name of the instance.
void before(CustomEventTypeRef type, INamedInterface *i) override
bool isPhaseEnabled(CustomEventTypeRef type) const
Check if auditing is enabled for the current processing phase.
StatusCode initialize() override
Initialize the auditor base.
Gaudi::Property< bool > m_skipSequencers
virtual void google_before(const std::string &s)=0
Start the google tool.
void beforeExecute(INamedInterface *i) override
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
void beforeInitialize(INamedInterface *i) override
void google_before(const std::string &s) override
Start the google tool.
bool isSequencer(INamedInterface *i) const
void afterFinalize(INamedInterface *i) override
const std::string & name() const override
void after(CustomEventTypeRef type, INamedInterface *i, const StatusCode &sc) override
void afterReinitialize(INamedInterface *i) override
void handle(const Incident &incident) override
Implement the handle method for the Incident service.
std::string getDumpName(CustomEventTypeRef type, std::string_view name) const
virtual bool alreadyRunning()=0
check if we are already running the tool
Gaudi::Property< std::vector< std::string > > m_veto
Gaudi::Property< std::vector< std::string > > m_list
bool isComponentEnabled(std::string_view name) const
Check if auditing is enabled for the given component.
Gaudi::Property< unsigned long long > m_eventsToSkip
void afterInitialize(INamedInterface *i) override
void stopAudit()
stop a full event audit
void google_after(const std::string &) override
stop the google tool
void before(StandardEventType type, const std::string &s) override
void after(StandardEventType type, const std::string &s, const StatusCode &sc) override
std::unique_ptr< HeapLeakChecker > m_checker
bool m_audit
Internal flag to say if auditing is enabled or not for the current event.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Base class used to extend a class implementing other interfaces.
Gaudi::Property< std::vector< std::string > > m_when
unsigned long long m_nEvts
Number of events processed.
void google_after(const std::string &s) override
stop the google tool
void afterExecute(INamedInterface *i, const StatusCode &s) override
virtual void google_after(const std::string &s)=0
stop the google tool
constexpr static const auto SUCCESS
void startAudit()
Start a full event audit.
Gaudi::Property< unsigned long long > m_nSampleEvents
bool alreadyRunning() override
check if we are already running the tool
StatusCode initialize() override
Initialize the auditor base.
#define DECLARE_COMPONENT(type)
Gaudi::Property< bool > m_printProfilesToLog
StatusCode finalize() override
Finalize the auditor base.
Gaudi::Property< bool > m_fullEventAudit
unsigned long long m_sampleEventCount
Internal count of the number of events currently processed during an audit.
const std::string & type() const
Access to the incident type.
std::string m_startedBy
Name of the component we are currently auditing.
constexpr static const auto FAILURE
void beforeReinitialize(INamedInterface *i) override
void beforeFinalize(INamedInterface *i) override
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Implementation of property with value of concrete type.
void google_after(const std::string &s) override
stop the google tool
void google_before(const std::string &s) override
Start the google tool.
void before(StandardEventType type, INamedInterface *i) override
bool alreadyRunning() override
check if we are already running the tool