| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# MemoryAuditor Class Reference

`#include <MemoryAuditor.h>`

Inheritance diagram for MemoryAuditor:

[legend]
Collaboration diagram for MemoryAuditor:

[legend]

List of all members.

## 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)
virtual void | after (CustomEventTypeRef evt, const std::string &caller, const StatusCode &)
virtual StatusCode | sysFinalize ()
| Finalization method invoked by the framework.
## Private Member Functions
bool | printinfo (std::string theString)
## Private Attributes
StringArrayProperty | m_types

## Detailed Description

Definition at line 12 of file MemoryAuditor.h.

## Constructor & Destructor Documentation

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

Definition at line 11 of file MemoryAuditor.cpp.

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

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

Definition at line 18 of file MemoryAuditor.cpp.

    00018                              {
    00019 }

## Member Function Documentation

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

Reimplemented from Auditor.

Definition at line 21 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 27 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 33 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 39 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 45 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 51 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 57 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 63 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 69 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 75 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 81 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 87 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 95 of file MemoryAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 114 of file MemoryAuditor.cpp.

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

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 134 of file MemoryAuditor.cpp.

    00135 {
    00136   return StatusCode::SUCCESS;
    00137 }

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

Definition at line 139 of file MemoryAuditor.cpp.

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

## Member Data Documentation

StringArrayProperty MemoryAuditor::m_types`[private]`

Definition at line 37 of file MemoryAuditor.h.

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

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