ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trk::MemoryLogger Class Reference

#include <MemoryLogger.h>

Collaboration diagram for Trk::MemoryLogger:

Public Member Functions

 MemoryLogger ()
 Default constructor. More...
 
void refresh (int pid) const
 update the memory logger More...
 
float vmSize () const
 vsize/rss returnal More...
 
float vmRss () const
 

Private Attributes

std::atomic< float > m_vsize
 virtual memory size More...
 
std::atomic< float > m_rss
 real memory size More...
 

Detailed Description

A small helper class looking at /proc/<PID>status

to monitor the memory usage of the Geometry objects

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 30 of file MemoryLogger.h.

Constructor & Destructor Documentation

◆ MemoryLogger()

Trk::MemoryLogger::MemoryLogger ( )

Default constructor.

Definition at line 13 of file MemoryLogger.cxx.

14  : m_vsize{ -1 }
15  , m_rss{ -1 }
16 {}

Member Function Documentation

◆ refresh()

void Trk::MemoryLogger::refresh ( int  pid) const

update the memory logger

Definition at line 19 of file MemoryLogger.cxx.

20 {
21 
22 #ifndef __APPLE__
23  // memory monitoring
24  std::ostringstream filename;
25  filename << "/proc/" << pid << "/status";
26 
27  std::ifstream status(filename.str().c_str());
28  std::string buff;
29  float vsize;
30  float rss;
31  // loop over the files in the input
32  while (!status.eof()) {
33  status >> buff;
34  if (buff == "VmSize:")
35  status >> vsize;
36  if (buff == "VmRSS:")
37  status >> rss;
38  }
39  // close the file again
40  status.close();
41  m_vsize.store(vsize);
42  m_rss.store(vsize);
43 #else
44 #warning MemoryLogger does not yet work on the mac.
45 #endif
46 }

◆ vmRss()

float Trk::MemoryLogger::vmRss ( ) const
inline

Definition at line 55 of file MemoryLogger.h.

56 {
57  return m_rss;
58 }

◆ vmSize()

float Trk::MemoryLogger::vmSize ( ) const
inline

vsize/rss returnal

Definition at line 49 of file MemoryLogger.h.

50 {
51  return m_vsize;
52 }

Member Data Documentation

◆ m_rss

std::atomic<float> Trk::MemoryLogger::m_rss
mutableprivate

real memory size

Definition at line 45 of file MemoryLogger.h.

◆ m_vsize

std::atomic<float> Trk::MemoryLogger::m_vsize
mutableprivate

virtual memory size

Definition at line 44 of file MemoryLogger.h.


The documentation for this class was generated from the following files:
get_hdefs.buff
buff
Definition: get_hdefs.py:61
Trk::MemoryLogger::m_vsize
std::atomic< float > m_vsize
virtual memory size
Definition: MemoryLogger.h:44
Trk::MemoryLogger::m_rss
std::atomic< float > m_rss
real memory size
Definition: MemoryLogger.h:45
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
merge.status
status
Definition: merge.py:17