All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Google::HeapChecker Class Reference

Auditor using the Google Heap Checker. More...

#include <GoogleAuditor.cpp>

Inheritance diagram for Google::HeapChecker:
Collaboration diagram for Google::HeapChecker:

Public Member Functions

 HeapChecker (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
 
virtual ~HeapChecker ()
 
StatusCode initialize ()
 Initialize the auditor base.
 
- Public Member Functions inherited from Google::AuditorBase
 AuditorBase (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
 
virtual ~AuditorBase ()
 Destructor.
 
StatusCode finalize ()
 Finalize the auditor base.
 
void handle (const Incident &incident)
 Implement the handle method for the Incident service.
 
void before (StandardEventType type, INamedInterface *i)
 The following methods are meant to be implemented by the child class...
 
void before (CustomEventTypeRef type, INamedInterface *i)
 
void before (StandardEventType type, const std::string &s)
 
void before (CustomEventTypeRef type, const std::string &s)
 
void after (StandardEventType type, INamedInterface *i, const StatusCode &sc)
 
void after (CustomEventTypeRef type, INamedInterface *i, const StatusCode &sc)
 
void after (StandardEventType type, const std::string &s, const StatusCode &sc)
 
void after (CustomEventTypeRef type, const std::string &s, const StatusCode &)
 
void beforeInitialize (INamedInterface *i)
 
void beforeReinitialize (INamedInterface *i)
 
void beforeExecute (INamedInterface *i)
 
void beforeBeginRun (INamedInterface *i)
 
void beforeEndRun (INamedInterface *i)
 
void beforeFinalize (INamedInterface *i)
 
void afterInitialize (INamedInterface *i)
 
void afterReinitialize (INamedInterface *i)
 
void afterExecute (INamedInterface *i, const StatusCode &s)
 
void afterBeginRun (INamedInterface *i)
 
void afterEndRun (INamedInterface *i)
 
void afterFinalize (INamedInterface *i)
 
- Public Member Functions inherited from extends1< Auditor, IIncidentListener >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends1 (A1 a1)
 Templated constructor with 1 argument.
 
 extends1 ()
 Default constructor.
 
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends1 (A1 a1)
 Templated constructor with 1 argument.
 
 extends1 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends1 ()
 Virtual destructor.
 
virtual ~extends1 ()
 Virtual destructor.
 
- Public Member Functions inherited from Auditor
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor.
 
virtual ~Auditor ()
 Destructor.
 
StatusCode sysInitialize ()
 Initialization method invoked by the framework.
 
StatusCode sysFinalize ()
 Finalization method invoked by the framework.
 
virtual const std::string & name () const
 
virtual bool isEnabled () const
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
int outputLevel () const
 Retrieve the output level of current auditor.
 
void setOutputLevel (int level)
 Set the output level for current auditor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator.
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist.
 
virtual StatusCode setProperty (const Property &p)
 Set a value of a property of an auditor.
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
 
virtual StatusCode getProperty (Property *p) const
 Get the value of a property.
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name.
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
 
const std::vector< Property * > & getProperties () const
 Get all properties.
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setProperties ()
 Set the auditor's properties.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor.
 
virtual ~Auditor ()
 Destructor.
 
StatusCode sysInitialize ()
 Initialization method invoked by the framework.
 
StatusCode sysFinalize ()
 Finalization method invoked by the framework.
 
virtual const std::string & name () const
 
virtual bool isEnabled () const
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
int outputLevel () const
 Retrieve the output level of current auditor.
 
void setOutputLevel (int level)
 Set the output level for current auditor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator.
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist.
 
virtual StatusCode setProperty (const Property &p)
 Set a value of a property of an auditor.
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
 
virtual StatusCode getProperty (Property *p) const
 Get the value of a property.
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name.
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
 
const std::vector< Property * > & getProperties () const
 Get all properties.
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setProperties ()
 Set the auditor's properties.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
- Public Member Functions inherited from extend_interfaces1< IIncidentListener >
virtual ~extend_interfaces1 ()
 Virtual destructor.
 
virtual ~extend_interfaces1 ()
 Virtual destructor.
 
- Public Member Functions inherited from IIncidentListener
 DeclareInterfaceID (IIncidentListener, 2, 0)
 InterfaceID.
 
 DeclareInterfaceID (IIncidentListener, 2, 0)
 InterfaceID.
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance.
 
virtual unsigned long release ()=0
 Release Interface instance.
 
virtual unsigned long refCount () const =0
 Current reference count.
 
virtual ~IInterface ()
 Virtual destructor.
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance.
 
virtual unsigned long release ()=0
 Release Interface instance.
 
virtual unsigned long refCount () const =0
 Current reference count.
 
virtual ~IInterface ()
 Virtual destructor.
 

Protected Member Functions

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
 

Private Attributes

bool m_enabled
 
HeapLeakChecker * m_checker
 

Additional Inherited Members

- Public Types inherited from extends1< Auditor, IIncidentListener >
typedef extends1 base_class
 Typedef to this class.
 
typedef extends1 base_class
 Typedef to this class.
 
typedef extend_interfaces1
< IIncidentListener
extend_interfaces_base
 Typedef to the base of this class.
 
typedef extend_interfaces1
< IIncidentListener
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
- Protected Attributes inherited from Google::AuditorBase
MsgStream m_log
 Messaging object.
 

Detailed Description

Auditor using the Google Heap Checker.

See

http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html

For more details on usage.

Author
Chris Jones
Date
18/04/2011

Definition at line 415 of file GoogleAuditor.cpp.

Constructor & Destructor Documentation

Google::HeapChecker::HeapChecker ( const std::string &  name,
ISvcLocator pSvcLocator 
)
inline

Constructor.

Definition at line 421 of file GoogleAuditor.cpp.

: AuditorBase ( name, pSvcLocator ),
m_enabled ( true ),
m_checker ( NULL )
{ }
virtual Google::HeapChecker::~HeapChecker ( )
inlinevirtual

Definition at line 427 of file GoogleAuditor.cpp.

{ delete m_checker; }

Member Function Documentation

bool Google::HeapChecker::alreadyRunning ( )
inlineprotectedvirtual

check if we are already running the tool

Implements Google::AuditorBase.

Definition at line 479 of file GoogleAuditor.cpp.

{ return m_enabled && m_checker != NULL ; }
void Google::HeapChecker::google_after ( const std::string &  s)
inlineprotectedvirtual

stop the google tool

Implements Google::AuditorBase.

Definition at line 466 of file GoogleAuditor.cpp.

{
if ( m_enabled && m_checker )
{
if ( ! m_checker->NoLeaks() )
{
m_log << MSG::WARNING << "Leak detected for " << s << endmsg;
}
delete m_checker;
m_checker = NULL;
}
}
void Google::HeapChecker::google_before ( const std::string &  s)
inlineprotectedvirtual

Start the google tool.

Implements Google::AuditorBase.

Definition at line 458 of file GoogleAuditor.cpp.

{
if ( m_enabled && !m_checker )
{
m_checker = new HeapLeakChecker(s.c_str());
}
}
StatusCode Google::HeapChecker::initialize ( )
inlinevirtual

Initialize the auditor base.

Reimplemented from Google::AuditorBase.

Definition at line 431 of file GoogleAuditor.cpp.

{
if ( sc.isFailure() ) return sc;
const char * HEAPCHECK = getenv("HEAPCHECK");
if ( !HEAPCHECK )
{
<< "Environment variable HEAPCHECK must be set to 'local'"
<< endmsg;
}
if ( std::string(HEAPCHECK) != "local" )
{
<< "Environment variable HEAPCHECK is set to " << HEAPCHECK
<< " Partial Program Heap Checking is disabled"
<< endmsg;
m_enabled = false;
}
return sc;
}

Member Data Documentation

HeapLeakChecker* Google::HeapChecker::m_checker
private

Definition at line 484 of file GoogleAuditor.cpp.

bool Google::HeapChecker::m_enabled
private

Definition at line 483 of file GoogleAuditor.cpp.


The documentation for this class was generated from the following file: