ATLAS Offline Software
Loading...
Searching...
No Matches
MemorySnooper Class Reference

#include <MemorySnooper.h>

Collaboration diagram for MemorySnooper:

Public Member Functions

 MemorySnooper (std::string where)
int GetMemorySize () const

Private Attributes

int imem

Detailed Description

Definition at line 16 of file MemorySnooper.h.

Constructor & Destructor Documentation

◆ MemorySnooper()

MemorySnooper::MemorySnooper ( std::string where)
inline

Definition at line 19 of file MemorySnooper.h.

20 {
21 int pid=getpid();
22 std::ostringstream is;
23 is<<pid;
24 std::string spid=is.str();
25 std::string filename="mem"+spid+".txt";
26 std::string temp="cat /proc/"+spid+"/status | grep VmSize >"+filename;
27 system(temp.c_str());
28 std::ifstream in(filename.c_str());
29 std::string text,mem,text1;
30 in>>text>>mem>>text1;
31 temp="rm -f "+filename;
32 system(temp.c_str());
33 float memsize=atof(mem.c_str());
34 imem=int(memsize);
35 std::cout << "* Memory snooper called at " << where
36 << " with VMEM: " << imem << "kB" << std::endl;
37 //std::cout<<"*****************************************************"<<std::endl
38 // <<"* *"<<std::endl
39 // <<" Memory snooper called here "<<where<<std::endl
40 // <<" process size at this point (VmMem): "<<imem<<" kBytes"<<std::endl
41 // <<"* *"<<std::endl
42 // <<"*****************************************************"<<std::endl;
43 }
double atof(std::string_view str)
Converts a string into a double / float.
where(filename, prepath=[])
"which" for python files -------------------------------------------------—
Definition unixtools.py:53

Member Function Documentation

◆ GetMemorySize()

int MemorySnooper::GetMemorySize ( ) const
inline

Definition at line 44 of file MemorySnooper.h.

44{return imem;}

Member Data Documentation

◆ imem

int MemorySnooper::imem
private

Definition at line 46 of file MemorySnooper.h.


The documentation for this class was generated from the following file: