18 const IInterface*
p ) :
21 m_prevCallMemUsage(0),
22 m_accumulatedCallMemory(0.),
23 m_accumulatedIncrMemory(0.),
31 for (
auto &
p : m_table){
46 return StatusCode::SUCCESS;
55 return StatusCode::SUCCESS;
61 return double( computeCurMemoryUsage());
67 bool considerInSummary) {
70 int curMem = computeCurMemoryUsage();
73 int curDiff = curMem-m_prevCallMemUsage;
76 if (considerInSummary) {
77 m_accumulatedCallMemory += curMem;
78 m_accumulatedIncrMemory += curDiff;
83 <<
" (VmMem,diff-previous) kBytes: "
84 << curMem<<
" "<< curDiff );
86 m_prevCallMemUsage = curMem;
95 int curUsage = computeCurMemoryUsage();
97 << curUsage <<
" kBytes");
101 m_table.push_back( curInfoUsage);
110 ATH_MSG_INFO(
"*****************************************************\n"<<
111 "* (VmMem) MEMORY SUMMARY: (kBytes)");
114 InfoUsagePairVector::const_iterator
it = m_table.begin();
115 InfoUsagePairVector::const_iterator itEnd = m_table.end();
116 for ( ;
it != itEnd; ++
it) {
117 const char *curInfo = (*it)->first;
118 int curUsage = (*it)->second;
120 ATH_MSG_INFO(
"* Memory Usage " << curInfo <<
"\t\t: " << curUsage);
125 if (!
desc)
desc =
"MemoryMonitor call";
127 << (
int)(m_accumulatedCallMemory/m_numCalls) );
129 << (
int)(m_accumulatedIncrMemory/m_numCalls));
132 ATH_MSG_INFO(
"*****************************************************");
143 std::ostringstream is;
145 std::string spid=is.str();
146 std::string
filename=
"mem"+spid+
".txt";
147 std::string temp=
"cat /proc/"+spid+
"/status | grep VmSize >"+
filename;
148 system(temp.c_str());
150 std::string
text,mem,text1;
151 in>>
text>>mem>>text1;
153 system(temp.c_str());
154 float memsize=
atof(mem.c_str());