Gaudi Framework, version v20r3

Generated: 24 Nov 2008

MemStatAuditor Class Reference

#include <GaudiAud/MemStatAudit.h>

Inheritance diagram for MemStatAuditor:

Inheritance graph
[legend]
Collaboration diagram for MemStatAuditor:

Collaboration graph
[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 20 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)
IChronoStatSvcstatSvc () const

Private Attributes

StringArrayProperty m_types
IChronoStatSvcm_stat
double m_vSize

Constructor & Destructor Documentation

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

Definition at line 16 of file MemStatAuditor.cpp.

00016                                                                               :
00017   Auditor(name, pSvcLocator) 
00018 {
00019   declareProperty("CustomEventTypes",m_types);
00020 
00021   StatusCode sc = serviceLocator()->service("ChronoStatSvc" , m_stat );
00022   if( sc.isSuccess() && 0 != statSvc() ) { statSvc()->addRef(); } 
00023   m_vSize=-1.;
00024   
00025 }

MemStatAuditor::~MemStatAuditor (  )  [virtual]

Definition at line 27 of file MemStatAuditor.cpp.

00027                                {
00028 }


Member Function Documentation

void MemStatAuditor::beforeInitialize ( INamedInterface  )  [virtual]

Deprecated:
use before

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  )  [virtual]

Deprecated:
use after

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  )  [virtual]

Deprecated:
use before

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  )  [virtual]

Deprecated:
use after

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  )  [virtual]

Deprecated:
use before

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 ,
const StatusCode  
) [virtual]

Deprecated:
use after

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  )  [virtual]

Deprecated:
use before

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  )  [virtual]

Deprecated:
use after

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  )  [virtual]

Deprecated:
use before

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  )  [virtual]

Deprecated:
use after

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  )  [virtual]

Deprecated:
use before

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  )  [virtual]

Deprecated:
use after

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 " << endreq;
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 };

IChronoStatSvc* MemStatAuditor::statSvc (  )  const [inline, private]

Definition at line 47 of file MemStatAuditor.h.

00047 { return m_stat; } 


Member Data Documentation

Definition at line 45 of file MemStatAuditor.h.

Definition at line 48 of file MemStatAuditor.h.

double MemStatAuditor::m_vSize [private]

Definition at line 49 of file MemStatAuditor.h.


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

Generated at Mon Nov 24 14:45:58 2008 for Gaudi Framework, version v20r3 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004