| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# MemoryAuditor Class Reference

`#include <MemoryAuditor.h>`

Inheritance diagram for MemoryAuditor:

[legend]
Collaboration diagram for MemoryAuditor:

[legend]

List of all members.

## Detailed Description

Definition at line 14 of file MemoryAuditor.h.

## Public Member Functions
| MemoryAuditor (const std::string &name, ISvcLocator *pSvcLocator)
virtual | ~MemoryAuditor ()
virtual void | beforeInitialize (INamedInterface *alg)
virtual void | afterInitialize (INamedInterface *alg)
virtual void | beforeReinitialize (INamedInterface *alg)
virtual void | afterReinitialize (INamedInterface *alg)
virtual void | beforeExecute (INamedInterface *alg)
virtual void | afterExecute (INamedInterface *alg, const StatusCode &)
virtual void | beforeBeginRun (INamedInterface *alg)
virtual void | afterBeginRun (INamedInterface *alg)
virtual void | beforeEndRun (INamedInterface *alg)
virtual void | afterEndRun (INamedInterface *alg)
virtual void | beforeFinalize (INamedInterface *alg)
virtual void | afterFinalize (INamedInterface *alg)
virtual void | before (CustomEventTypeRef evt, const std::string &caller)
| Audit the start of a custom "event" for callers that do not implement INamedInterface.
virtual void | after (CustomEventTypeRef evt, const std::string &caller, const StatusCode &)
| Audit the end of a custom "event" for callers that do not implement INamedInterface.
virtual StatusCode | sysFinalize ()
| Finalization method invoked by the framework.
## Private Member Functions
bool | printinfo (std::string theString)
## Private Attributes
StringArrayProperty | m_types

## Constructor & Destructor Documentation

MemoryAuditor::MemoryAuditor | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  |

Definition at line 13 of file MemoryAuditor.cpp.

    00013                                                                             :
    00014   Auditor(name, pSvcLocator)
    00015 {
    00016   declareProperty("CustomEventTypes",m_types);
    00017
    00018 }

MemoryAuditor::~MemoryAuditor | ( |  | ) | `[virtual]`

Definition at line 20 of file MemoryAuditor.cpp.

    00020                              {
    00021 }

## Member Function Documentation

void MemoryAuditor::beforeInitialize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 23 of file MemoryAuditor.cpp.

    00023                                                          {
    00024   std::string theString = "Memory usage before ";
    00025   theString += alg->name() ;
    00026   theString += " Initialization Method";
    00027   printinfo(theString);
    00028 }

void MemoryAuditor::afterInitialize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 29 of file MemoryAuditor.cpp.

    00029                                                         {
    00030   std::string theString = "Memory usage has changed after ";
    00031   theString += alg->name() ;
    00032   theString += " Initialization Method";
    00033   printinfo(theString);
    00034 }

void MemoryAuditor::beforeReinitialize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 35 of file MemoryAuditor.cpp.

    00035                                                            {
    00036   std::string theString = "Memory usage before ";
    00037   theString += alg->name() ;
    00038   theString += " Reinitialization Method";
    00039   printinfo(theString);
    00040 }

void MemoryAuditor::afterReinitialize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 41 of file MemoryAuditor.cpp.

    00041                                                           {
    00042   std::string theString = "Memory usage has changed after ";
    00043   theString += alg->name() ;
    00044   theString += " Reinitialization Method";
    00045   printinfo(theString);
    00046 }

void MemoryAuditor::beforeExecute | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 47 of file MemoryAuditor.cpp.

    00047                                                       {
    00048   std::string theString = "Memory usage has changed before ";
    00049   theString += alg->name() ;
    00050   theString += " Execute Method";
    00051   printinfo(theString);
    00052 }

void MemoryAuditor::afterExecute | ( | INamedInterface * | ,
|  | const StatusCode & |  |
| ) |  |  | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 53 of file MemoryAuditor.cpp.

    00053                                                                           {
    00054   std::string theString = "Memory usage has changed after ";
    00055   theString += alg->name() ;
    00056   theString += " Execute Method";
    00057   printinfo(theString);
    00058 }

void MemoryAuditor::beforeBeginRun | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 59 of file MemoryAuditor.cpp.

    00059                                                        {
    00060   std::string theString = "Memory usage before ";
    00061   theString += ini->name() ;
    00062   theString += " BeginRun Method";
    00063   printinfo(theString);
    00064 }

void MemoryAuditor::afterBeginRun | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 65 of file MemoryAuditor.cpp.

    00065                                                       {
    00066   std::string theString = "Memory usage has changed after ";
    00067   theString += ini->name() ;
    00068   theString += " BeginRun Method";
    00069   printinfo(theString);
    00070 }

void MemoryAuditor::beforeEndRun | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 71 of file MemoryAuditor.cpp.

    00071                                                      {
    00072   std::string theString = "Memory usage before ";
    00073   theString += ini->name() ;
    00074   theString += " EndRun Method";
    00075   printinfo(theString);
    00076 }

void MemoryAuditor::afterEndRun | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 77 of file MemoryAuditor.cpp.

    00077                                                     {
    00078   std::string theString = "Memory usage has changed after ";
    00079   theString += ini->name() ;
    00080   theString += " EndRun Method";
    00081   printinfo(theString);
    00082 }

void MemoryAuditor::beforeFinalize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use before

Reimplemented from Auditor.

Definition at line 83 of file MemoryAuditor.cpp.

    00083                                                         {
    00084   std::string theString = "Memory usage has changed before ";
    00085   theString += alg->name() ;
    00086   theString += " Finalize Method";
    00087   printinfo(theString);
    00088 }

void MemoryAuditor::afterFinalize | ( | INamedInterface * |  | ) | `[virtual]`

Deprecated:
  use after

Reimplemented from Auditor.

Definition at line 89 of file MemoryAuditor.cpp.

    00089                                                       {
    00090   std::string theString = "Memory usage has changed after ";
    00091   theString += alg->name() ;
    00092   theString += " Finalize Method";
    00093   printinfo(theString);
    00094 }

void MemoryAuditor::before | ( | CustomEventTypeRef | ,
|  | const std::string & |  |
| ) |  |  | `[virtual]`

Audit the start of a custom "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 97 of file MemoryAuditor.cpp.

    00097                                                                      {
    00098   if (m_types.value().size() != 0) {
    00099     if ( (m_types.value())[0] == "none") {
    00100       return;
    00101     }
    00102
    00103     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00104          m_types.value().end() ) {
    00105       return;
    00106     }
    00107   }
    00108
    00109   std::string theString = "Memory usage before ";
    00110   theString += caller + " with auditor trigger " + evt;
    00111   printinfo(theString);
    00112
    00113 }

void MemoryAuditor::after | ( | CustomEventTypeRef | ,
|  | const std::string & | ,
|  | const StatusCode & | sc |
| ) |  |  | `[virtual]`

Audit the end of a custom "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 116 of file MemoryAuditor.cpp.

    00116                                                                                        {
    00117
    00118   if (m_types.value().size() != 0) {
    00119     if ( (m_types.value())[0] == "none") {
    00120       return;
    00121     }
    00122
    00123     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00124          m_types.value().end() ) {
    00125       return;
    00126     }
    00127   }
    00128
    00129   std::string theString = "Memory usage has changed after ";
    00130   theString += caller + " with auditor trigger " + evt;
    00131   printinfo(theString);
    00132
    00133 }

StatusCode MemoryAuditor::sysFinalize | ( |  | ) | `[virtual]`

Finalization method invoked by the framework.

This method is responsible for any bookkeeping of initialization required by the framework itself.

RETURN !!!

catch GaudiExeption

(1) perform the printout of message

(2) print the exception itself (NB! - GaudiException is a linked list of all "previous exceptions")

catch std::exception

(1) perform the printout of message

(2) print the exception itself

catch unknown exception

(1) perform the printout

Reimplemented from Auditor.

Definition at line 136 of file MemoryAuditor.cpp.

    00137 {
    00138   return StatusCode::SUCCESS;
    00139 }

bool MemoryAuditor::printinfo | ( | std::string | theString | ) | `[private]`

Definition at line 141 of file MemoryAuditor.cpp.

    00142 {
    00143    ProcStats* p = ProcStats::instance();
    00144    procInfo info;
    00145
    00146    // The fetch method returns true if memory usage has changed...
    00147    if( p->fetch(info) == true) {
    00148      MsgStream log(msgSvc(), name());
    00149      log << MSG::INFO << theString <<
    00150        " virtual size = " << info.vsize << " MB"  <<
    00151        " resident set size = " << info.rss << " MB" << endreq;
    00152      return true;
    00153     }
    00154    else {
    00155       return false;
    00156    }
    00157 }

## Member Data Documentation

StringArrayProperty MemoryAuditor::m_types`[private]`

Definition at line 39 of file MemoryAuditor.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiAud/src/MemoryAuditor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiAud/src/MemoryAuditor.cpp