| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

Public Member Functions | Protected Member Functions | Private Attributes

# Google::HeapChecker Class Reference

Auditor using the Google Heap Checker. More...

`#include <GoogleAuditor.cpp>`

Inheritance diagram for Google::HeapChecker:
[legend]
Collaboration diagram for Google::HeapChecker:
[legend]

List of all members.

## Public Member Functions
| HeapChecker (const std::string &name, ISvcLocator *pSvcLocator)
| Constructor.
virtual | ~HeapChecker ()
StatusCode | initialize ()
| Initialize the auditor base.
## 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

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

## Constructor & Destructor Documentation

Google::HeapChecker::HeapChecker | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator
| ) |  | `[inline]`

Constructor.

Definition at line 393 of file GoogleAuditor.cpp.

          : AuditorBase ( name, pSvcLocator ),
            m_enabled   ( true ),
            m_checker   ( NULL )
        { }

virtual Google::HeapChecker::~HeapChecker | ( | ) | `[inline, virtual]`

Definition at line 399 of file GoogleAuditor.cpp.

    { delete m_checker; }

## Member Function Documentation

bool Google::HeapChecker::alreadyRunning | ( | ) | `[inline, protected, virtual]`

check if we are already running the tool

Implements Google::AuditorBase.

Definition at line 451 of file GoogleAuditor.cpp.

    { return m_enabled && m_checker != NULL ; }

void Google::HeapChecker::google_after | ( | const std::string & | s ) | `[inline, protected, virtual]`

stop the google tool

Implements Google::AuditorBase.

Definition at line 438 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 ) | `[inline, protected, virtual]`

Start the google tool.

Implements Google::AuditorBase.

Definition at line 430 of file GoogleAuditor.cpp.

        {
          if ( m_enabled && !m_checker )
          {
            m_checker = new HeapLeakChecker(s.c_str());
          }
        }

StatusCode Google::HeapChecker::initialize | ( | void | ) | `[inline, virtual]`

Initialize the auditor base.

Reimplemented from Google::AuditorBase.

Definition at line 403 of file GoogleAuditor.cpp.

        {
          const StatusCode sc = AuditorBase::initialize();
          if ( sc.isFailure() ) return sc;

          const char * HEAPCHECK = getenv("HEAPCHECK");
          if ( !HEAPCHECK )
          {
            m_log << MSG::FATAL
                  << "Environment variable HEAPCHECK must be set to 'local'"
                  << endmsg;
            return StatusCode::FAILURE;
          }
          if ( std::string(HEAPCHECK) != "local" )
          {
            m_log << MSG::WARNING
                  << "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 456 of file GoogleAuditor.cpp.

bool Google::HeapChecker::m_enabled`[private]`

Definition at line 455 of file GoogleAuditor.cpp.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiProfiling/src/component/google/GoogleAuditor.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines