Gaudi Framework, version v20r2

Generated: 18 Jul 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 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

IChronoStatSvcm_stat
double m_vSize


Constructor & Destructor Documentation

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

Definition at line 16 of file MemStatAuditor.cpp.

References IInterface::addRef(), StatusCode::isSuccess(), m_stat, m_vSize, ISvcLocator::service(), Auditor::serviceLocator(), and statSvc().

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

MemStatAuditor::~MemStatAuditor (  )  [virtual]

Definition at line 25 of file MemStatAuditor.cpp.

00025                                {
00026 }


Member Function Documentation

void MemStatAuditor::beforeInitialize ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 28 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterInitialize ( INamedInterface alg  )  [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 35 of file MemStatAuditor.cpp.

References INamedInterface::name(), and printinfo().

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

void MemStatAuditor::beforeReinitialize ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 41 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterReinitialize ( INamedInterface alg  )  [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 48 of file MemStatAuditor.cpp.

References INamedInterface::name(), and printinfo().

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

void MemStatAuditor::beforeExecute ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 54 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterExecute ( INamedInterface alg,
const StatusCode  
) [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 61 of file MemStatAuditor.cpp.

References INamedInterface::name(), and printinfo().

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

void MemStatAuditor::beforeBeginRun ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 68 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterBeginRun ( INamedInterface alg  )  [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 75 of file MemStatAuditor.cpp.

References INamedInterface::name(), and printinfo().

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

void MemStatAuditor::beforeEndRun ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 81 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterEndRun ( INamedInterface alg  )  [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 88 of file MemStatAuditor.cpp.

References INamedInterface::name(), and printinfo().

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

void MemStatAuditor::beforeFinalize ( INamedInterface alg  )  [virtual]

Deprecated:
use before

Reimplemented from Auditor.

Definition at line 94 of file MemStatAuditor.cpp.

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

void MemStatAuditor::afterFinalize ( INamedInterface alg  )  [virtual]

Deprecated:
use after

Reimplemented from Auditor.

Definition at line 101 of file MemStatAuditor.cpp.

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

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

References StatusCode::SUCCESS.

00111 {
00112   return StatusCode::SUCCESS;
00113 }

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

Definition at line 115 of file MemStatAuditor.cpp.

References endreq(), ProcStats::fetch(), MSG::INFO, ProcStats::instance(), m_vSize, Auditor::msgSvc(), Auditor::name(), procInfo::rss, statSvc(), and procInfo::vsize.

Referenced by afterBeginRun(), afterEndRun(), afterExecute(), afterInitialize(), and afterReinitialize().

00116 {
00117   bool status(false);
00118   ProcStats* p = ProcStats::instance();
00119   procInfo info;
00121   double deltaVSize =0.00001;
00122   
00123 
00124   if( p->fetch(info) == true) 
00125     {
00126       MsgStream log(msgSvc(), name());
00127 
00128       if (m_vSize>0 && info.vsize >0 ){
00129          deltaVSize=info.vsize-m_vSize;
00130       }
00131 
00132       // store the current VSize to be able to monitor the increment
00133       if (info.vsize>0) {
00134          m_vSize=info.vsize;
00135       }
00136 
00137       log << MSG::INFO << theString <<
00138         " \tvirtual size = " << info.vsize << " MB"  <<
00139         " \tresident set size = " << info.rss << " MB" <<
00140         " deltaVsize = " << deltaVSize << "  MB " << endreq;
00142       
00143       //      Stat stv( statSvc() , tag+":VMemUsage" , info.vsize ); 
00144       //   Stat str( statSvc() , tag+":RMemUsage" , info.rss   ); 
00146       status=true;
00147     }
00148   // fill the stat for every call, not just when there is a change
00149   // only monitor the increment in VSize
00150   Stat sts( statSvc() , tag+":VMem" , deltaVSize ); 
00151         
00152 
00154   return status; //FIXME
00155 };

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

Definition at line 43 of file MemStatAuditor.h.

References m_stat.

Referenced by MemStatAuditor(), and printinfo().

00043 { return m_stat; } 


Member Data Documentation

IChronoStatSvc* MemStatAuditor::m_stat [private]

Definition at line 44 of file MemStatAuditor.h.

Referenced by MemStatAuditor(), and statSvc().

double MemStatAuditor::m_vSize [private]

Definition at line 45 of file MemStatAuditor.h.

Referenced by MemStatAuditor(), and printinfo().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:08:36 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004