18 #include "boost/assign/list_of.hpp"
20 #ifdef TCMALLOC_OLD_GOOGLE_HEADERS
21 #include "google/heap-profiler.h"
22 #include "google/heap-checker.h"
23 #include "google/profiler.h"
25 #include "gperftools/heap-profiler.h"
26 #include "gperftools/heap-checker.h"
27 #include "gperftools/profiler.h"
60 inSvc->addListener(
this, IncidentType::BeginEvent );
106 return ( dynamic_cast<GaudiSequencer*>(i) != NULL ||
107 dynamic_cast<Sequencer*>(i) != NULL );
129 t << name <<
"-" <<
type;
130 if ( type ==
"Execute" ) t <<
"-Event" <<
m_nEvts;
143 if ( IncidentType::BeginEvent == incident.
type() )
207 <<
"Starting Auditor for " << s <<
":" << type
215 <<
"Auditor already running. Cannot be started for " << s
316 , m_log (
msgSvc() , name )
319 , m_sampleEventCount( 0 )
320 , m_inFullAudit ( false )
325 boost::assign::list_of
336 "List of phases to activate the Auditoring during" );
338 "List of component names to disable the auditing for" );
341 "The frequence to audit events. -1 means all events" );
343 "If true, instead of individually auditing components, the full event (or events) will be audited in one go" );
345 "The number of events to include in a full event audit, if enabled" );
347 "Number of events to skip before activating the auditing" );
349 "If true, auditing will be skipped for Sequencer objects." );
382 HeapProfilerStart(s.
c_str());
389 HeapProfilerDump(s.
c_str());
393 const char * profile = GetHeapProfile();
443 const char * HEAPCHECK = getenv(
"HEAPCHECK");
447 <<
"Environment variable HEAPCHECK must be set to 'local'"
454 <<
"Environment variable HEAPCHECK is set to " << HEAPCHECK
455 <<
" Partial Program Heap Checking is disabled"
525 ProfilerStart((s+
".prof").c_str());
StatusCode finalize()
Finalize the auditor base.
HeapLeakChecker * m_checker
void beforeBeginRun(INamedInterface *i)
Definition of the MsgStream class used to transmit messages.
std::string m_startedBy
Name of the component we are currently auditing.
HeapChecker(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
void beforeReinitialize(INamedInterface *i)
void stopAudit()
stop a full event audit
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
bool m_printProfilesToLog
const std::string & type() const
Access to the incident type.
virtual void google_before(const std::string &s)=0
Start the google tool.
virtual ~AuditorBase()
Destructor.
bool m_audit
Internal flag to say if auditing is enabled or not for the current event.
void before(CustomEventTypeRef type, const std::string &s)
void startAudit()
Start a full event audit.
unsigned long long m_nSampleEvents
Number of events to include in a full event audit.
virtual bool alreadyRunning()=0
check if we are already running the tool
StatusCode initialize()
Initialize the auditor base.
bool m_inFullAudit
Internal flag to indicate if we are current in a full event audit.
bool isFailure() const
Test for a status code of FAILURE.
unsigned long long m_sampleEventCount
Internal count of the number of events currently processed during an audit.
#define DECLARE_COMPONENT(type)
int m_freq
The frequency to audit events. -1 means all events.
void before(CustomEventTypeRef type, INamedInterface *i)
virtual const std::string & name() const =0
Retrieve the name of the instance.
bool alreadyRunning()
check if we are already running the tool
StatusCode initialize()
Initialize the auditor base.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void google_after(const std::string &)
stop the google tool
void after(CustomEventTypeRef type, const std::string &s, const StatusCode &)
void afterExecute(INamedInterface *i, const StatusCode &s)
unsigned long long m_nEvts
Number of events processed.
void after(CustomEventTypeRef type, INamedInterface *i, const StatusCode &sc)
bool isPhaseEnabled(CustomEventTypeRef type) const
Check if auditing is enabled for the current processing phase.
void beforeExecute(INamedInterface *i)
void google_before(const std::string &s)
Start the google tool.
This class is used for returning status codes from appropriate routines.
void google_after(const std::string &s)
stop the google tool
std::vector< std::string > m_list
Any component in this list will be audited. If empty, all will be done.
Auditor using the Google Heap Checker.
std::string getDumpName(CustomEventTypeRef type, const std::string &name) const
void afterBeginRun(INamedInterface *i)
bool m_fullEventAudit
Flag to indicate if full event auditing is enabled or not.
void google_before(const std::string &s)
Start the google tool.
void google_after(const std::string &s)
stop the google tool
bool alreadyRunning()
check if we are already running the tool
HeapProfiler(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
void afterFinalize(INamedInterface *i)
void afterReinitialize(INamedInterface *i)
void afterInitialize(INamedInterface *i)
std::vector< std::string > m_when
When to audit the algorithms.
void beforeEndRun(INamedInterface *i)
IInterface compliant class extending IInterface with the name() method.
void beforeInitialize(INamedInterface *i)
void beforeFinalize(INamedInterface *i)
Base class used to extend a class implementing other interfaces.
Base class for all Incidents (computing events).
void before(StandardEventType type, INamedInterface *i)
void handle(const Incident &incident)
Implement the handle method for the Incident service.
const std::string & name() const override
void google_before(const std::string &s)
Start the google tool.
MsgStream m_log
Messaging object.
void before(StandardEventType type, const std::string &s)
void after(StandardEventType type, INamedInterface *i, const StatusCode &sc)
CPUProfiler(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::string > m_veto
Veto list. Any component in this list will not be audited.
AuditorBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
void afterEndRun(INamedInterface *i)
unsigned long long m_eventsToSkip
Number of events to skip before auditing.
Base for Google Auditors.
virtual void google_after(const std::string &s)=0
stop the google tool
bool alreadyRunning()
check if we are already running the tool
Auditor using the Google CPU Profiler.
bool m_skipSequencers
Boolean indicating if sequencers should be skipped or not.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
The interface implemented by the IncidentSvc service.
void after(StandardEventType type, const std::string &s, const StatusCode &sc)
bool isComponentEnabled(const std::string &name) const
Check if auditing is enabled for the given component.
Auditor based on the Google Heap Profiler.
bool isSequencer(INamedInterface *i) const
Check if the component in question is a GaudiSequencer or a Sequencer.