|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
Just a minor modification of MemoryAuditor to allow the output memory statistics table to be printed. More...
#include <GaudiAud/MemStatAudit.h>


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 | |
Just a minor modification of MemoryAuditor to allow the output memory statistics table to be printed.
Definition at line 15 of file MemStatAuditor.h.
| 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.
{}
| 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; }
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.