Gaudi Framework, version v23r6

Home   Generated: Wed Jan 30 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MemoryAuditor.cpp
Go to the documentation of this file.
1 // MemoryAuditor:
2 // An auditor that monitors memory usage
3 
4 #ifdef __ICC
5 // disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
6 // TODO: there is only a partial overload of IAuditor::before and IAuditor::after
7 #pragma warning(disable:654)
8 #endif
9 
10 #include "MemoryAuditor.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/AudFactory.h"
13 
15 
16 MemoryAuditor::MemoryAuditor(const std::string& name, ISvcLocator* pSvcLocator)
17 : CommonAuditor(name, pSvcLocator) {
18 }
19 
20 void MemoryAuditor::i_before(CustomEventTypeRef evt, const std::string& caller) {
21  i_printinfo("Memory usage before", evt, caller);
22 }
23 
24 void MemoryAuditor::i_after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&){
25  i_printinfo("Memory usage has changed after", evt, caller);
26 }
27 
28 void MemoryAuditor::i_printinfo(const std::string& msg, CustomEventTypeRef evt, const std::string& caller)
29 {
30  procInfo info;
31  // The fetch method returns true if memory usage has changed...
32  if(getProcInfo(info)) {
33  MsgStream log(msgSvc(), name());
34  log << MSG::INFO << msg << " " << caller << " " << evt <<
35  " virtual size = " << info.vsize << " MB" <<
36  " resident set size = " << info.rss << " MB" << endmsg;
37  }
38 }

Generated at Wed Jan 30 2013 17:13:38 for Gaudi Framework, version v23r6 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004