| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# MemoryAuditor.cpp

Go to the documentation of this file.

    00001 // MemoryAuditor:
    00002 //  An auditor that monitors memory usage
    00003
    00004 #ifdef __ICC
    00005 // disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
    00006 //   TODO: there is only a partial overload of IAuditor::before and IAuditor::after
    00007 #pragma warning(disable:654)
    00008 #endif
    00009
    00010 #include "MemoryAuditor.h"
    00011 #include "GaudiKernel/MsgStream.h"
    00012 #include "GaudiKernel/AudFactory.h"
    00013
    00014 DECLARE_AUDITOR_FACTORY(MemoryAuditor)
    00015
    00016 MemoryAuditor::MemoryAuditor(const std::string& name, ISvcLocator* pSvcLocator)
    00017 : CommonAuditor(name, pSvcLocator) {
    00018 }
    00019
    00020 void MemoryAuditor::i_before(CustomEventTypeRef evt, const std::string& caller) {
    00021   i_printinfo("Memory usage before", evt, caller);
    00022 }
    00023
    00024 void MemoryAuditor::i_after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&){
    00025   i_printinfo("Memory usage has changed after", evt, caller);
    00026 }
    00027
    00028 void MemoryAuditor::i_printinfo(const std::string& msg, CustomEventTypeRef evt, const std::string& caller)
    00029 {
    00030    procInfo info;
    00031    // The fetch method returns true if memory usage has changed...
    00032    if(getProcInfo(info)) {
    00033      MsgStream log(msgSvc(), name());
    00034      log << MSG::INFO << msg << " " << caller << " " << evt <<
    00035        " virtual size = " << info.vsize << " MB"  <<
    00036        " resident set size = " << info.rss << " MB" << endmsg;
    00037    }
    00038 }

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