Go to the documentation of this file.00001
00002
00003
00004 #ifdef __ICC
00005
00006
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
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 }