| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

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 Types

typedef std::string CustomEventType
typedef const CustomEventTypeCustomEventTypeRef
 Initialize
 ReInitialize
 Execute
 BeginRun
 EndRun
 Finalize
 Start
 Stop
 ReStart
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  StandardEventType
enum  Status

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 ()
StatusCode sysInitialize ()
virtual void before (StandardEventType, INamedInterface *)
virtual void before (StandardEventType, const std::string &)
virtual void before (CustomEventTypeRef, INamedInterface *)
virtual void before (CustomEventTypeRef, const std::string &)
virtual void before (StandardEventType, INamedInterface *)=0
virtual void before (StandardEventType, const std::string &)=0
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
virtual void after (StandardEventType, const std::string &, const StatusCode &)
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
virtual void after (StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (StandardEventType, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual const std::string & name () const
virtual bool isEnabled () const
IMessageSvcmsgSvc () const
int outputLevel () const
void setOutputLevel (int level)
ISvcLocatorserviceLocator () const
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
const std::vector< Property * > & getProperties () const
StatusCode setProperties ()
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
unsigned long addRef ()
unsigned long release ()
StatusCode queryInterface (const InterfaceID &riid, void **)

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 Initialize
 ReInitialize
 Execute
 BeginRun
 EndRun
 Finalize
 Start
 Stop
 ReStart
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

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

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.


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 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]

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]

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]

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]

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

StringArrayProperty MemStatAuditor::m_types [private]

Definition at line 45 of file MemStatAuditor.h.

IChronoStatSvc* MemStatAuditor::m_stat [private]

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:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:59:13 2011 for GaudiAud by doxygen 1.4.7