| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 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:
[legend]
Collaboration diagram for MemStatAuditor:
[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< IChronoStatSvc > | m_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 | ( | void | ) | `[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

SmartIF<IChronoStatSvc> MemStatAuditor::m_stat`[private]`

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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiAud/src/MemStatAuditor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiAud/src/MemStatAuditor.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines