BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MemorySnooper Class Reference

#include <MemorySnooper.h>

Public Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ MemorySnooper() [1/2]

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

Definition at line 13 of file InstallArea/include/SimHelpers/SimHelpers/MemorySnooper.h.

14 {
15 int pid=getpid();
16 std::ostringstream is;
17 is<<pid;
18 std::string spid=is.str();
19 std::string temp="cat /proc/"+spid+"/status | grep VmSize > mem.txt";
20 system(temp.c_str());
21 std::ifstream in("mem.txt");
22 std::string text,mem,text1;
23 in>>text>>mem>>text1;
24 system("rm -f mem.txt");
25 float memsize=atof(mem.c_str());
26 imem=int(memsize);
27 std::cout<<"*****************************************************"<<std::endl
28 <<"* *"<<std::endl
29 <<" Memory snooper called here "<<where<<std::endl
30 <<" process size at this point (VmMem): "<<imem<<" kBytes"<<std::endl
31 <<"* *"<<std::endl
32 <<"*****************************************************"<<std::endl;
33 }

◆ MemorySnooper() [2/2]

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

Definition at line 13 of file Simulation/SimHelpers/SimHelpers-00-00-01/SimHelpers/MemorySnooper.h.

14 {
15 int pid=getpid();
16 std::ostringstream is;
17 is<<pid;
18 std::string spid=is.str();
19 std::string temp="cat /proc/"+spid+"/status | grep VmSize > mem.txt";
20 system(temp.c_str());
21 std::ifstream in("mem.txt");
22 std::string text,mem,text1;
23 in>>text>>mem>>text1;
24 system("rm -f mem.txt");
25 float memsize=atof(mem.c_str());
26 imem=int(memsize);
27 std::cout<<"*****************************************************"<<std::endl
28 <<"* *"<<std::endl
29 <<" Memory snooper called here "<<where<<std::endl
30 <<" process size at this point (VmMem): "<<imem<<" kBytes"<<std::endl
31 <<"* *"<<std::endl
32 <<"*****************************************************"<<std::endl;
33 }

Member Function Documentation

◆ GetMemorySize() [1/2]

int MemorySnooper::GetMemorySize ( ) const
inline

Definition at line 34 of file InstallArea/include/SimHelpers/SimHelpers/MemorySnooper.h.

34{return imem;}

◆ GetMemorySize() [2/2]

int MemorySnooper::GetMemorySize ( ) const
inline

Definition at line 34 of file Simulation/SimHelpers/SimHelpers-00-00-01/SimHelpers/MemorySnooper.h.

34{return imem;}

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