memInfo Class Reference

Memory usage information for the current process, and the system memory that is free. More...

Public Member Functions

 memInfo ()
 Construct and populate with values. More...
 
 ~memInfo ()=default
 Destructor. More...
 
bool valid () const
 True if the memory information appears valid. More...
 
void clear ()
 Reset to zero. More...
 
const memInfoupdate ()
 Update according to /proc/PID/status and /proc/memory contents. More...
 
int peak () const
 Peak memory (VmPeak in /proc/PID/status) at last update() More...
 
int size () const
 Memory size (VmSize in /proc/PID/status) at last update() More...
 
int rss () const
 Resident set size (VmRSS in /proc/PID/status) at last update() More...
 
int free () const
 System memory free (MemFree in /proc/meminfo) More...
 
void write (Ostream &os) const
 Write content as dictionary entries. More...
 
 memInfo ()
 Construct and populate with values. More...
 
 ~memInfo ()=default
 Destructor. More...
 
bool valid () const
 True if the memory information appears valid. More...
 
void clear ()
 Reset to zero. More...
 
const memInfoupdate ()
 Update according to /proc/PID/status and /proc/memory contents. More...
 
int peak () const
 Peak memory (VmPeak in /proc/PID/status) at last update() More...
 
int size () const
 Memory size (VmSize in /proc/PID/status) at last update() More...
 
int rss () const
 Resident set size (VmRSS in /proc/PID/status) at last update() More...
 
int free () const
 System memory free (MemFree in /proc/meminfo) More...
 
void write (Ostream &os) const
 Write content as dictionary entries. More...
 

Friends

Istreamoperator>> (Istream &is, memInfo &m)
 Read peak/size/rss from stream. More...
 
Ostreamoperator<< (Ostream &os, const memInfo &m)
 Write peak/size/rss to stream. More...
 
Istreamoperator>> (Istream &is, memInfo &m)
 Read peak/size/rss from stream. More...
 
Ostreamoperator<< (Ostream &os, const memInfo &m)
 Write peak/size/rss to stream. More...
 

Detailed Description

Memory usage information for the current process, and the system memory that is free.

Note
Windows variant does nothing.
Source files

Note
Uses the information from /proc/PID/status and from /proc/meminfo
Source files

Definition at line 62 of file memInfo.H.

Constructor & Destructor Documentation

◆ memInfo() [1/2]

memInfo ( )

Construct and populate with values.

Definition at line 38 of file memInfo.C.

References memInfo::update().

Here is the call graph for this function:

◆ ~memInfo() [1/2]

~memInfo ( )
default

Destructor.

◆ memInfo() [2/2]

memInfo ( )

Construct and populate with values.

◆ ~memInfo() [2/2]

~memInfo ( )
default

Destructor.

Member Function Documentation

◆ valid() [1/2]

bool valid ( ) const

True if the memory information appears valid.

Definition at line 51 of file memInfo.C.

◆ clear() [1/2]

void clear ( )

Reset to zero.

Definition at line 57 of file memInfo.C.

◆ update() [1/2]

const Foam::memInfo & update ( )

Update according to /proc/PID/status and /proc/memory contents.

Definition at line 64 of file memInfo.C.

References clear().

Referenced by memInfo::memInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peak() [1/2]

int peak ( ) const
inline

Peak memory (VmPeak in /proc/PID/status) at last update()

Definition at line 103 of file memInfo.H.

◆ size() [1/2]

int size ( ) const
inline

Memory size (VmSize in /proc/PID/status) at last update()

Definition at line 109 of file memInfo.H.

Referenced by indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::indexedOctree().

Here is the caller graph for this function:

◆ rss() [1/2]

int rss ( ) const
inline

Resident set size (VmRSS in /proc/PID/status) at last update()

Definition at line 115 of file memInfo.H.

◆ free() [1/2]

int free ( ) const
inline

System memory free (MemFree in /proc/meminfo)

Definition at line 121 of file memInfo.H.

◆ write() [1/2]

void write ( Ostream os) const

Write content as dictionary entries.

Definition at line 74 of file memInfo.C.

References os(), and Ostream::writeEntry().

Here is the call graph for this function:

◆ valid() [2/2]

bool valid ( ) const

True if the memory information appears valid.

◆ clear() [2/2]

void clear ( )

Reset to zero.

◆ update() [2/2]

const memInfo& update ( )

Update according to /proc/PID/status and /proc/memory contents.

◆ peak() [2/2]

int peak ( ) const
inline

Peak memory (VmPeak in /proc/PID/status) at last update()

Definition at line 103 of file memInfo.H.

◆ size() [2/2]

int size ( ) const
inline

Memory size (VmSize in /proc/PID/status) at last update()

Definition at line 109 of file memInfo.H.

◆ rss() [2/2]

int rss ( ) const
inline

Resident set size (VmRSS in /proc/PID/status) at last update()

Definition at line 115 of file memInfo.H.

◆ free() [2/2]

int free ( ) const
inline

System memory free (MemFree in /proc/meminfo)

Definition at line 121 of file memInfo.H.

◆ write() [2/2]

void write ( Ostream os) const

Write content as dictionary entries.

Friends And Related Function Documentation

◆ operator>> [1/2]

Istream& operator>> ( Istream is,
memInfo m 
)
friend

Read peak/size/rss from stream.

◆ operator<< [1/2]

Ostream& operator<< ( Ostream os,
const memInfo m 
)
friend

Write peak/size/rss to stream.

◆ operator>> [2/2]

Istream& operator>> ( Istream is,
memInfo m 
)
friend

Read peak/size/rss from stream.

◆ operator<< [2/2]

Ostream& operator<< ( Ostream os,
const memInfo m 
)
friend

Write peak/size/rss to stream.


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