| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# MemStatAuditor Class Reference

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

`#include <GaudiAud/MemStatAudit.h>`

Inheritance diagram for MemStatAuditor:
[legend]
Collaboration diagram for MemStatAuditor:
[legend]

List of all members.

## Public Member Functions
| MemStatAuditor (const std::string &name, ISvcLocator *pSvcLocator)
| local
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

## 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.

## Constructor & Destructor Documentation

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

local

Definition at line 19 of file MemStatAuditor.cpp.

    00019                                                                               :
    00020   Auditor(name, pSvcLocator), m_vSize(-1.)
    00021 {
    00022   declareProperty("CustomEventTypes",m_types);
    00023
    00024   m_stat = serviceLocator()->service("ChronoStatSvc");
    00025 }

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

Definition at line 27 of file MemStatAuditor.cpp.

    00027                                {
    00028 }

## Member Function Documentation

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

Reimplemented from Auditor.

Definition at line 30 of file MemStatAuditor.cpp.

    00030                                                       {
    00031   //DR not useful
    00032   //   std::string theString = "Memory usage before ";
    00033   //   theString += alg->name() ;
    00034   //   theString += " \tInitialization Method";
    00035   //   printinfo(theString, alg->name() );
    00036 }

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

Reimplemented from Auditor.

Definition at line 37 of file MemStatAuditor.cpp.

    00037                                                          {
    00038   std::string theString = "Memory usage has changed after  ";
    00039   theString += ini->name() ;
    00040   theString += " \tInitialization Method";
    00041   printinfo(theString, ini->name() );
    00042 }

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

Reimplemented from Auditor.

Definition at line 43 of file MemStatAuditor.cpp.

    00043                                                         {
    00044   //DR not useful
    00045   //   std::string theString = "Memory usage before ";
    00046   //   theString += alg->name() ;
    00047   //   theString += " \tReinitialization Method";
    00048   //   printinfo(theString, alg->name() );
    00049 }

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

Reimplemented from Auditor.

Definition at line 50 of file MemStatAuditor.cpp.

    00050                                                            {
    00051   std::string theString = "Memory usage has changed after  ";
    00052   theString += ini->name() ;
    00053   theString += " \tReinitialization Method";
    00054   printinfo(theString, ini->name() );
    00055 }

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

Reimplemented from Auditor.

Definition at line 56 of file MemStatAuditor.cpp.

    00056                                                    {
    00057   //DR not useful
    00058   //   std::string theString = "Memory usage has changed before ";
    00059   //   theString += alg->name() ;
    00060   //   theString += " \tBefExecute Method";
    00061   //   printinfo(theString, alg->name() );
    00062 }

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

Reimplemented from Auditor.

Definition at line 63 of file MemStatAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 70 of file MemStatAuditor.cpp.

    00070                                                     {
    00071   //DR not useful
    00072   //   std::string theString = "Memory usage before ";
    00073   //   theString += alg->name() ;
    00074   //   theString += " \tBeginRun Method";
    00075   //   printinfo(theString, alg->name() );
    00076 }

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

Reimplemented from Auditor.

Definition at line 77 of file MemStatAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 83 of file MemStatAuditor.cpp.

    00083                                                   {
    00084   //DR not useful
    00085   //   std::string theString = "Memory usage before ";
    00086   //   theString += alg->name() ;
    00087   //   theString += " \tEndRun Method";
    00088   //   printinfo(theString, alg->name() );
    00089 }

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

Reimplemented from Auditor.

Definition at line 90 of file MemStatAuditor.cpp.

    00090                                                      {
    00091   std::string theString = "Memory usage has changed after  ";
    00092   theString += ini->name() ;
    00093   theString += " \tEndRun Method";
    00094   printinfo(theString, ini->name() );
    00095 }

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

Reimplemented from Auditor.

Definition at line 96 of file MemStatAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 103 of file MemStatAuditor.cpp.

    00103                                                    {
    00104   //DR not useful
    00105   //   std::string theString = "Memory usage has changed after  ";
    00106   //   theString += alg->name() ;
    00107   //   theString += " \tFinalize Method";
    00108   //   printinfo(theString, alg->name() );
    00109
    00110 }

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

Reimplemented from Auditor.

Definition at line 113 of file MemStatAuditor.cpp.

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

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

Reimplemented from Auditor.

Definition at line 133 of file MemStatAuditor.cpp.

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

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 152 of file MemStatAuditor.cpp.

    00153 {
    00154   return StatusCode::SUCCESS;
    00155 }

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

cannot be eaxactly 0

Definition at line 157 of file MemStatAuditor.cpp.

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

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_v21r11/GaudiAud/src/MemStatAuditor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r11/GaudiAud/src/MemStatAuditor.cpp