| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# MemStatAuditor Class Reference

`#include <GaudiAud/MemStatAudit.h>`

Inheritance diagram for MemStatAuditor:

[legend]
Collaboration diagram for MemStatAuditor:

[legend]

List of all members.

## Detailed Description

Just a minor modification of MemoryAuditor to allow the ouput memory statistics table to be printed.

Author:
  Vanya Belyaev

Date:
  04/02/2001

Definition at line 17 of file MemStatAuditor.h.

## Public Member Functions
| MemStatAuditor (const std::string &name, ISvcLocator *pSvcLocator)
virtual | ~MemStatAuditor ()
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 (const std::string &theString, const std::string &Tag)
SmartIF< IChronoStatSvc > & | statSvc () const
## Private Attributes
StringArrayProperty | m_types
SmartIF< IChronoStatSvc > | m_stat
double | m_vSize

## Constructor & Destructor Documentation

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

Definition at line 14 of file MemStatAuditor.cpp.

    00014                                                                               :
    00015   Auditor(name, pSvcLocator), m_vSize(-1.)
    00016 {
    00017   declareProperty("CustomEventTypes",m_types);
    00018
    00019   m_stat = serviceLocator()->service("ChronoStatSvc");
    00020 }

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

Definition at line 22 of file MemStatAuditor.cpp.

    00022                                {
    00023 }

## Member Function Documentation

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

Reimplemented from Auditor.

Definition at line 25 of file MemStatAuditor.cpp.

    00025                                                       {
    00026   //DR not useful
    00027   //   std::string theString = "Memory usage before ";
    00028   //   theString += alg->name() ;
    00029   //   theString += " \tInitialization Method";
    00030   //   printinfo(theString, alg->name() );
    00031 }

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

Reimplemented from Auditor.

Definition at line 32 of file MemStatAuditor.cpp.

    00032                                                          {
    00033   std::string theString = "Memory usage has changed after  ";
    00034   theString += ini->name() ;
    00035   theString += " \tInitialization Method";
    00036   printinfo(theString, ini->name() );
    00037 }

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

Reimplemented from Auditor.

Definition at line 38 of file MemStatAuditor.cpp.

    00038                                                         {
    00039   //DR not useful
    00040   //   std::string theString = "Memory usage before ";
    00041   //   theString += alg->name() ;
    00042   //   theString += " \tReinitialization Method";
    00043   //   printinfo(theString, alg->name() );
    00044 }

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

Reimplemented from Auditor.

Definition at line 45 of file MemStatAuditor.cpp.

    00045                                                            {
    00046   std::string theString = "Memory usage has changed after  ";
    00047   theString += ini->name() ;
    00048   theString += " \tReinitialization Method";
    00049   printinfo(theString, ini->name() );
    00050 }

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

Reimplemented from Auditor.

Definition at line 51 of file MemStatAuditor.cpp.

    00051                                                    {
    00052   //DR not useful
    00053   //   std::string theString = "Memory usage has changed before ";
    00054   //   theString += alg->name() ;
    00055   //   theString += " \tBefExecute Method";
    00056   //   printinfo(theString, alg->name() );
    00057 }

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

Reimplemented from Auditor.

Definition at line 58 of file MemStatAuditor.cpp.

    00058                                                                            {
    00059   std::string theString = "Memory usage has changed after  ";
    00060   theString += alg->name() ;
    00061   theString += " \tExecute Method";
    00062   printinfo(theString, alg->name() );
    00063
    00064 }

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

Reimplemented from Auditor.

Definition at line 65 of file MemStatAuditor.cpp.

    00065                                                     {
    00066   //DR not useful
    00067   //   std::string theString = "Memory usage before ";
    00068   //   theString += alg->name() ;
    00069   //   theString += " \tBeginRun Method";
    00070   //   printinfo(theString, alg->name() );
    00071 }

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

Reimplemented from Auditor.

Definition at line 72 of file MemStatAuditor.cpp.

    00072                                                        {
    00073   std::string theString = "Memory usage has changed after  ";
    00074   theString += ini->name() ;
    00075   theString += " \tBeginRun Method";
    00076   printinfo(theString, ini->name() );
    00077 }

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

Reimplemented from Auditor.

Definition at line 78 of file MemStatAuditor.cpp.

    00078                                                   {
    00079   //DR not useful
    00080   //   std::string theString = "Memory usage before ";
    00081   //   theString += alg->name() ;
    00082   //   theString += " \tEndRun Method";
    00083   //   printinfo(theString, alg->name() );
    00084 }

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

Reimplemented from Auditor.

Definition at line 85 of file MemStatAuditor.cpp.

    00085                                                      {
    00086   std::string theString = "Memory usage has changed after  ";
    00087   theString += ini->name() ;
    00088   theString += " \tEndRun Method";
    00089   printinfo(theString, ini->name() );
    00090 }

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

Reimplemented from Auditor.

Definition at line 91 of file MemStatAuditor.cpp.

    00091                                                      {
    00092   //DR not useful
    00093   //   std::string theString = "Memory usage has changed before ";
    00094   //   theString += alg->name() ;
    00095   //   theString += " \tFinalize Method";
    00096   //   printinfo(theString, alg->name() );
    00097 }

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

Reimplemented from Auditor.

Definition at line 98 of file MemStatAuditor.cpp.

    00098                                                    {
    00099   //DR not useful
    00100   //   std::string theString = "Memory usage has changed after  ";
    00101   //   theString += alg->name() ;
    00102   //   theString += " \tFinalize Method";
    00103   //   printinfo(theString, alg->name() );
    00104
    00105 }

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

Reimplemented from Auditor.

Definition at line 108 of file MemStatAuditor.cpp.

    00108                                                                       {
    00109
    00110   if (m_types.value().size() != 0) {
    00111     if ( (m_types.value())[0] == "none") {
    00112       return;
    00113     }
    00114
    00115     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00116          m_types.value().end() ) {
    00117       return;
    00118     }
    00119   }
    00120
    00121   std::string theString = "Memory usage before ";
    00122   theString += caller + " with auditor trigger " + evt;
    00123   printinfo(theString, caller);
    00124
    00125 }

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

Reimplemented from Auditor.

Definition at line 128 of file MemStatAuditor.cpp.

    00128                                                                                         {
    00129
    00130   if (m_types.value().size() != 0) {
    00131     if ( (m_types.value())[0] == "none") {
    00132       return;
    00133     }
    00134
    00135     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00136          m_types.value().end() ) {
    00137       return;
    00138     }
    00139   }
    00140
    00141   std::string theString = "Memory usage has changed after ";
    00142   theString += caller + " with auditor trigger " + evt;
    00143   printinfo(theString, caller);
    00144
    00145 }

StatusCode MemStatAuditor::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 147 of file MemStatAuditor.cpp.

    00148 {
    00149   return StatusCode::SUCCESS;
    00150 }

bool MemStatAuditor::printinfo | ( | const std::string & | theString,
|  | const std::string & | Tag |
| ) |  |  | `[private]`

cannot be eaxactly 0

Definition at line 152 of file MemStatAuditor.cpp.

    00153 {
    00154   bool status(false);
    00155   ProcStats* p = ProcStats::instance();
    00156   procInfo info;
    00158   double deltaVSize =0.00001;
    00159
    00160
    00161   if( p->fetch(info) == true)
    00162     {
    00163       MsgStream log(msgSvc(), name());
    00164
    00165       if (m_vSize>0 && info.vsize >0 ){
    00166          deltaVSize=info.vsize-m_vSize;
    00167       }
    00168
    00169       // store the current VSize to be able to monitor the increment
    00170       if (info.vsize>0) {
    00171          m_vSize=info.vsize;
    00172       }
    00173
    00174       log << MSG::INFO << theString <<
    00175         " \tvirtual size = " << info.vsize << " MB"  <<
    00176         " \tresident set size = " << info.rss << " MB" <<
    00177         " deltaVsize = " << deltaVSize << "  MB " << endmsg;
    00179
    00180       //      Stat stv( statSvc() , tag+":VMemUsage" , info.vsize );
    00181       //   Stat str( statSvc() , tag+":RMemUsage" , info.rss   );
    00183       status=true;
    00184     }
    00185   // fill the stat for every call, not just when there is a change
    00186   // only monitor the increment in VSize
    00187   Stat sts( statSvc() , tag+":VMem" , deltaVSize );
    00188
    00189
    00191   return status; //FIXME
    00192 };

SmartIF<IChronoStatSvc>& MemStatAuditor::statSvc | ( |  | ) | const`[inline, private]`

Definition at line 44 of file MemStatAuditor.h.

    00044 { return m_stat; }

## Member Data Documentation

StringArrayProperty MemStatAuditor::m_types`[private]`

Definition at line 42 of file MemStatAuditor.h.

SmartIF<IChronoStatSvc> MemStatAuditor::m_stat`[mutable, private]`

Definition at line 45 of file MemStatAuditor.h.

double MemStatAuditor::m_vSize`[private]`

Definition at line 46 of file MemStatAuditor.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiAud/src/MemStatAuditor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiAud/src/MemStatAuditor.cpp