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. More...
 
virtual ~HeapChecker ()
 
StatusCode initialize ()
 
- Public Member Functions inherited from Google::AuditorBase
 AuditorBase (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor. More...
 
virtual ~AuditorBase ()
 Destructor. More...
 
StatusCode initialize ()
 Initialize the auditor base. More...
 
StatusCode finalize ()
 Finalize the auditor base. More...
 
void handle (const Incident &incident)
 Implement the handle method for the Incident service. More...
 
void before (StandardEventType type, INamedInterface *i)
 
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 extends< BASE, Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Member Functions

void google_before (const std::string &s)
 Start the google tool. More...
 
void google_after (const std::string &s)
 stop the google tool More...
 
bool alreadyRunning ()
 check if we are already running the tool More...
 

Private Attributes

bool m_enabled
 
HeapLeakChecker * m_checker
 

Additional Inherited Members

- Public Types inherited from extends< BASE, Interfaces >
typedef extends base_class
 Typedef to this class. More...
 
typedef extend_interfaces< Interfaces...> extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extends base_class
 Typedef to this class. More...
 
typedef extend_interfaces< Interfaces...> extend_interfaces_base
 Typedef to the base of this class. More...
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Attributes inherited from Google::AuditorBase
MsgStream m_log
 Messaging object. More...
 

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 421 of file GoogleAuditor.cpp.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 427 of file GoogleAuditor.cpp.

428  : AuditorBase ( name, pSvcLocator ),
429  m_enabled ( true ),
430  m_checker ( NULL )
431  { }
HeapLeakChecker * m_checker
AuditorBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual Google::HeapChecker::~HeapChecker ( )
inlinevirtual

Definition at line 433 of file GoogleAuditor.cpp.

433 { delete m_checker; }
HeapLeakChecker * m_checker

Member Function Documentation

bool Google::HeapChecker::alreadyRunning ( )
inlineprotectedvirtual

check if we are already running the tool

Implements Google::AuditorBase.

Definition at line 485 of file GoogleAuditor.cpp.

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

stop the google tool

Implements Google::AuditorBase.

Definition at line 472 of file GoogleAuditor.cpp.

473  {
474  if ( m_enabled && m_checker )
475  {
476  if ( ! m_checker->NoLeaks() )
477  {
478  m_log << MSG::WARNING << "Leak detected for " << s << endmsg;
479  }
480  delete m_checker;
481  m_checker = NULL;
482  }
483  }
HeapLeakChecker * m_checker
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
string s
Definition: gaudirun.py:246
MsgStream m_log
Messaging object.
void Google::HeapChecker::google_before ( const std::string &  s)
inlineprotectedvirtual

Start the google tool.

Implements Google::AuditorBase.

Definition at line 464 of file GoogleAuditor.cpp.

465  {
466  if ( m_enabled && !m_checker )
467  {
468  m_checker = new HeapLeakChecker(s.c_str());
469  }
470  }
HeapLeakChecker * m_checker
string s
Definition: gaudirun.py:246
StatusCode Google::HeapChecker::initialize ( )
inline

Definition at line 437 of file GoogleAuditor.cpp.

438  {
440  if ( sc.isFailure() ) return sc;
441 
442  const char * HEAPCHECK = getenv("HEAPCHECK");
443  if ( !HEAPCHECK )
444  {
445  m_log << MSG::FATAL
446  << "Environment variable HEAPCHECK must be set to 'local'"
447  << endmsg;
448  return StatusCode::FAILURE;
449  }
450  if ( std::string(HEAPCHECK) != "local" )
451  {
453  << "Environment variable HEAPCHECK is set to " << HEAPCHECK
454  << " Partial Program Heap Checking is disabled"
455  << endmsg;
456  m_enabled = false;
457  }
458 
459  return sc;
460  }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
StatusCode initialize()
Initialize the auditor base.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Messaging object.

Member Data Documentation

HeapLeakChecker* Google::HeapChecker::m_checker
private

Definition at line 490 of file GoogleAuditor.cpp.

bool Google::HeapChecker::m_enabled
private

Definition at line 489 of file GoogleAuditor.cpp.


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