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

#include <MemorySnooper.h>

Public Member Functions

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

Detailed Description

Definition at line 11 of file MemorySnooper.h.

Constructor & Destructor Documentation

◆ MemorySnooper()

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

Definition at line 13 of file MemorySnooper.h.

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

Member Function Documentation

◆ GetMemorySize()

int MemorySnooper::GetMemorySize ( ) const
inline

Definition at line 33 of file MemorySnooper.h.

33{ return imem; }

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