Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011
Public Member Functions | Private Member Functions | Private Attributes

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:
Inheritance graph
[legend]
Collaboration diagram for MemStatAuditor:
Collaboration graph
[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< 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 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.

                                                                              :
  Auditor(name, pSvcLocator), m_vSize(-1.)
{
  declareProperty("CustomEventTypes",m_types);

  m_stat = serviceLocator()->service("ChronoStatSvc");
}
MemStatAuditor::~MemStatAuditor (  ) [virtual]

Definition at line 27 of file MemStatAuditor.cpp.

                               {
}

Member Function Documentation

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

Reimplemented from Auditor.

Definition at line 133 of file MemStatAuditor.cpp.

                                                                                        {

  if (m_types.value().size() != 0) {
    if ( (m_types.value())[0] == "none") {
      return;
    }

    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
         m_types.value().end() ) {
      return;
    }
  }

  std::string theString = "Memory usage has changed after ";
  theString += caller + " with auditor trigger " + evt;
  printinfo(theString, caller);

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

Reimplemented from Auditor.

Definition at line 77 of file MemStatAuditor.cpp.

                                                       {
  std::string theString = "Memory usage has changed after  ";
  theString += ini->name() ;
  theString += " \tBeginRun Method";
  printinfo(theString, ini->name() );
}
void MemStatAuditor::afterEndRun ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 90 of file MemStatAuditor.cpp.

                                                     {
  std::string theString = "Memory usage has changed after  ";
  theString += ini->name() ;
  theString += " \tEndRun Method";
  printinfo(theString, ini->name() );
}
void MemStatAuditor::afterExecute ( INamedInterface alg,
const StatusCode  
) [virtual]

Reimplemented from Auditor.

Definition at line 63 of file MemStatAuditor.cpp.

                                                                           {
  std::string theString = "Memory usage has changed after  ";
  theString += alg->name() ;
  theString += " \tExecute Method";
  printinfo(theString, alg->name() );

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

Reimplemented from Auditor.

Definition at line 103 of file MemStatAuditor.cpp.

                                                   {
  //DR not useful
  //   std::string theString = "Memory usage has changed after  ";
  //   theString += alg->name() ;
  //   theString += " \tFinalize Method";
  //   printinfo(theString, alg->name() );

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

Reimplemented from Auditor.

Definition at line 37 of file MemStatAuditor.cpp.

                                                         {
  std::string theString = "Memory usage has changed after  ";
  theString += ini->name() ;
  theString += " \tInitialization Method";
  printinfo(theString, ini->name() );
}
void MemStatAuditor::afterReinitialize ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 50 of file MemStatAuditor.cpp.

                                                           {
  std::string theString = "Memory usage has changed after  ";
  theString += ini->name() ;
  theString += " \tReinitialization Method";
  printinfo(theString, ini->name() );
}
void MemStatAuditor::before ( CustomEventTypeRef  evt,
const std::string caller 
) [virtual]

Reimplemented from Auditor.

Definition at line 113 of file MemStatAuditor.cpp.

                                                                      {

  if (m_types.value().size() != 0) {
    if ( (m_types.value())[0] == "none") {
      return;
    }

    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
         m_types.value().end() ) {
      return;
    }
  }

  std::string theString = "Memory usage before ";
  theString += caller + " with auditor trigger " + evt;
  printinfo(theString, caller);

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

Reimplemented from Auditor.

Definition at line 70 of file MemStatAuditor.cpp.

                                                    {
  //DR not useful
  //   std::string theString = "Memory usage before ";
  //   theString += alg->name() ;
  //   theString += " \tBeginRun Method";
  //   printinfo(theString, alg->name() );
}
void MemStatAuditor::beforeEndRun ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 83 of file MemStatAuditor.cpp.

                                                  {
  //DR not useful
  //   std::string theString = "Memory usage before ";
  //   theString += alg->name() ;
  //   theString += " \tEndRun Method";
  //   printinfo(theString, alg->name() );
}
void MemStatAuditor::beforeExecute ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 56 of file MemStatAuditor.cpp.

                                                   {
  //DR not useful
  //   std::string theString = "Memory usage has changed before ";
  //   theString += alg->name() ;
  //   theString += " \tBefExecute Method";
  //   printinfo(theString, alg->name() );
}
void MemStatAuditor::beforeFinalize ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 96 of file MemStatAuditor.cpp.

                                                     {
  //DR not useful
  //   std::string theString = "Memory usage has changed before ";
  //   theString += alg->name() ;
  //   theString += " \tFinalize Method";
  //   printinfo(theString, alg->name() );
}
void MemStatAuditor::beforeInitialize ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 30 of file MemStatAuditor.cpp.

                                                      {
  //DR not useful
  //   std::string theString = "Memory usage before ";
  //   theString += alg->name() ;
  //   theString += " \tInitialization Method";
  //   printinfo(theString, alg->name() );
}
void MemStatAuditor::beforeReinitialize ( INamedInterface alg ) [virtual]

Reimplemented from Auditor.

Definition at line 43 of file MemStatAuditor.cpp.

                                                        {
  //DR not useful
  //   std::string theString = "Memory usage before ";
  //   theString += alg->name() ;
  //   theString += " \tReinitialization Method";
  //   printinfo(theString, alg->name() );
}
bool MemStatAuditor::printinfo ( const std::string theString,
const std::string Tag 
) [private]

cannot be eaxactly 0

Definition at line 157 of file MemStatAuditor.cpp.

{
  bool status(false);
  ProcStats* p = ProcStats::instance();
  procInfo info;
  double deltaVSize =0.00001;


  if( p->fetch(info) == true)
    {
      MsgStream log(msgSvc(), name());

      if (m_vSize>0 && info.vsize >0 ){
         deltaVSize=info.vsize-m_vSize;
      }

      // store the current VSize to be able to monitor the increment
      if (info.vsize>0) {
         m_vSize=info.vsize;
      }

      log << MSG::INFO << theString <<
        " \tvirtual size = " << info.vsize << " MB"  <<
        " \tresident set size = " << info.rss << " MB" <<
        " deltaVsize = " << deltaVSize << "  MB " << endmsg;

      //      Stat stv( statSvc() , tag+":VMemUsage" , info.vsize );
      //   Stat str( statSvc() , tag+":RMemUsage" , info.rss   );
      status=true;
    }
  // fill the stat for every call, not just when there is a change
  // only monitor the increment in VSize
  Stat sts( statSvc() , tag+":VMem" , deltaVSize );


  return status; //FIXME
}
SmartIF<IChronoStatSvc>& MemStatAuditor::statSvc (  ) const [inline, private]

Definition at line 44 of file MemStatAuditor.h.

{ return m_stat; }
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.

{
  return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 45 of file MemStatAuditor.h.

Definition at line 42 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:28:16 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004