Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 2012
Public Member Functions | Private Member Functions | Private Attributes

MemStatAuditor Class Reference

Just a minor modification of MemoryAuditor to allow the output 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 StatusCode initialize ()

Private Member Functions

virtual void i_before (CustomEventTypeRef evt, const std::string &caller)
 Re-implement i_before to avoid monitoring the memory usage before a function.
virtual void i_printinfo (const std::string &msg, CustomEventTypeRef evt, const std::string &caller)
 Report the memory usage.
SmartIF< IChronoStatSvc > & statSvc ()

Private Attributes

SmartIF< IChronoStatSvcm_stat
double m_vSize
 vsize of the previous call to printinfo

Detailed Description

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

Author:
Vanya Belyaev
Marco Clemencic
Date:
04/02/2001

Definition at line 15 of file MemStatAuditor.h.


Constructor & Destructor Documentation

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

local

Definition at line 19 of file MemStatAuditor.cpp.

                                                                              :
  MemoryAuditor(name, pSvcLocator), m_vSize(-1.)
{
}
MemStatAuditor::~MemStatAuditor (  ) [virtual]

Definition at line 24 of file MemStatAuditor.cpp.

{}

Member Function Documentation

void MemStatAuditor::i_before ( CustomEventTypeRef  evt,
const std::string caller 
) [private, virtual]

Re-implement i_before to avoid monitoring the memory usage before a function.

Reimplemented from MemoryAuditor.

Definition at line 39 of file MemStatAuditor.cpp.

                                                                                     {
  // It's not interesting to monitor the memory usage before the methods.
}
void MemStatAuditor::i_printinfo ( const std::string msg,
CustomEventTypeRef  evt,
const std::string caller 
) [private, virtual]

Report the memory usage.

Reimplemented from MemoryAuditor.

Definition at line 43 of file MemStatAuditor.cpp.

                                                                                                      {
  // cannot be exactly 0
  double deltaVSize = 0.00001;

  procInfo info;
  if (getProcInfo(info)) {
    MsgStream log(msgSvc(), name());

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

    log << MSG::INFO << msg << " " << caller << " " << evt <<
        " \tvirtual size = " << info.vsize << " MB"  <<
        " \tresident set size = " << info.rss << " MB" <<
        " deltaVsize = " << deltaVSize << "  MB" << endmsg;
  }
  // fill the stat for every call, not just when there is a change
  // only monitor the increment in VSize
  // Stat stv(statSvc(), caller + ":VMemUsage", info.vsize);
  // Stat str(statSvc(), caller + ":RMemUsage", info.rss);
  Stat sts(statSvc(), caller + ":VMem", deltaVSize);
}
StatusCode MemStatAuditor::initialize (  ) [virtual]

Reimplemented from Auditor.

Definition at line 26 of file MemStatAuditor.cpp.

                                      {
  StatusCode sc = CommonAuditor::initialize();
  if (UNLIKELY(sc.isFailure())) return sc;

  m_stat = serviceLocator()->service("ChronoStatSvc");
  if (UNLIKELY(!m_stat.get())) {
    MsgStream log(msgSvc(), name());
    log << MSG::ERROR << "Cannot get ChronoStatSvc" << endmsg;
    return StatusCode::FAILURE;
  }
  return StatusCode::SUCCESS;
}
SmartIF<IChronoStatSvc>& MemStatAuditor::statSvc (  ) [inline, private]

Definition at line 27 of file MemStatAuditor.h.

{ return m_stat; }

Member Data Documentation

Definition at line 28 of file MemStatAuditor.h.

double MemStatAuditor::m_vSize [private]

vsize of the previous call to printinfo

Definition at line 31 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 Thu Jun 28 2012 23:27:42 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004