ATLAS Offline Software
Loading...
Searching...
No Matches
PSUtils Namespace Reference

Classes

struct  DiodeCacheCounter
struct  HitCacheCounter
struct  MemStruct

Typedefs

typedef std::map< IdentifierHash, SiChargedDiodeCollection * > DiodeCache
typedef std::map< IdentifierHash, std::vector< HitIndexAndTime > > HitCache

Functions

MemStruct getMemUsage ()
std::ostream & operator<< (std::ostream &os, const MemStruct &s)
std::istream & operator>> (std::istream &is, MemStruct &s)
std::string memPrint (const DiodeCache &cache)
std::string memPrint (const HitCache &cache)

Typedef Documentation

◆ DiodeCache

Definition at line 17 of file memPrint.h.

◆ HitCache

typedef std::map< IdentifierHash, std::vector<HitIndexAndTime> > PSUtils::HitCache

Definition at line 18 of file memPrint.h.

Function Documentation

◆ getMemUsage()

MemStruct PSUtils::getMemUsage ( )

Definition at line 13 of file getMemUsage.cxx.

14 {
15 int pid = getpid();
16 const std::string ost="/proc/"+std::to_string(pid)+"/statm";
17 std::ifstream ifile( ost.c_str(), std::ifstream::in );
18
19 MemStruct ms;
20 ifile>>ms;
21 ifile.close();
22 return ms;
23 }

◆ memPrint() [1/2]

std::string PSUtils::memPrint ( const DiodeCache & cache)

Definition at line 43 of file memPrint.h.

43 {
44 std::size_t nWafers = cache.size();
45 std::size_t nDiodes = (std::for_each(cache.begin(), cache.end(), DiodeCacheCounter() ) ).m_count;
46 std::ostringstream sstream;
47 sstream<<getMemUsage()<<" n wafers "<< nWafers<<" n diodes "<<nDiodes<<'\n';
48 return sstream.str();
49 }
MemStruct getMemUsage()

◆ memPrint() [2/2]

std::string PSUtils::memPrint ( const HitCache & cache)

Definition at line 51 of file memPrint.h.

51 {
52 std::size_t nWafers = cache.size();
53 std::size_t nDiodes = (std::for_each(cache.begin(), cache.end(), HitCacheCounter() ) ).m_count;
54 std::ostringstream sstream;
55 sstream<<getMemUsage()<<" n wafers "<< nWafers<<" n hits "<<nDiodes<<'\n';
56 return sstream.str();
57 }

◆ operator<<()

std::ostream & PSUtils::operator<< ( std::ostream & os,
const MemStruct & s )

Definition at line 25 of file getMemUsage.cxx.

26 {
27 // sizes in pages
28
29 os <<
30 " totalSize " <<s.totalSize<<
31 " physicalMemSize "<<s.physicalMemSize<<
32 " sharedMemSize " <<s.sharedMemSize<<
33 " stackSize " <<s.stackSize;
34 return os;
35 }

◆ operator>>()

std::istream & PSUtils::operator>> ( std::istream & is,
MemStruct & s )

Definition at line 36 of file getMemUsage.cxx.

37 {
38 is
39 >>s.totalSize
40 >>s.physicalMemSize
41 >>s.sharedMemSize
42 >>s.textSize
43 >>s.sharedLibSize
44 >>s.stackSize
45 >>s.nDirtyPages;
46 return is;
47 }