| The Gaudi Framework v32r1 (f65d50dc)

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
13 DECLARE_COMPONENT( MemoryAuditor )
14
15 void MemoryAuditor::i_before( CustomEventTypeRef evt, const std::string& caller ) {
16 i_printinfo( "Memory usage before", evt, caller );
17 }
18
19 void MemoryAuditor::i_after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& ) {
20 i_printinfo( "Memory usage has changed after", evt, caller );
21 }
22
23 void MemoryAuditor::i_printinfo( const std::string& msg, CustomEventTypeRef evt, const std::string& caller ) {
24 procInfo pInfo;
25 // The fetch method returns true if memory usage has changed...
26 if ( getProcInfo( pInfo ) ) {
27 info() << msg << " " << caller << " " << evt << " virtual size = " << pInfo.vsize << " MB"
28 << " resident set size = " << pInfo.rss << " MB" << endmsg;
29 }
30 }
MemoryAuditor.h
MsgStream.h
MemoryAuditor::i_after
void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc) override
Default (catch-all) "after" Auditor hook.
Definition: MemoryAuditor.cpp:19
MemoryAuditor::i_printinfo
virtual void i_printinfo(const std::string &msg, CustomEventTypeRef evt, const std::string &caller)
Report the memory usage.
Definition: MemoryAuditor.cpp:23
std
STL namespace.
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
std::string
STL class.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
procInfo::rss
double rss
Definition: ProcStats.h:38
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
MemoryAuditor::getProcInfo
static bool getProcInfo(procInfo &info)
Get the process informations.
Definition: MemoryAuditor.h:27
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:113
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
MemoryAuditor
Monitors the memory use of each algorithm.
Definition: MemoryAuditor.h:11
procInfo::vsize
double vsize
Definition: ProcStats.h:37
procInfo
Definition: ProcStats.h:17
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
IOTest.evt
evt
Definition: IOTest.py:94