Public Member Functions | Friends | List of all members
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 good () const noexcept
 True if the memory information appears valid. More...
 
void clear () noexcept
 Reset to zero. More...
 
const memInfoupdate ()
 Update according to /proc/PID/status and /proc/memory contents. More...
 
int peak () const noexcept
 Peak memory (VmPeak in /proc/PID/status) at last update() More...
 
int size () const noexcept
 Memory size (VmSize in /proc/PID/status) at last update() More...
 
int rss () const noexcept
 Resident set size (VmRSS in /proc/PID/status) at last update() More...
 
int free () const noexcept
 System memory free (MemFree in /proc/meminfo) More...
 
void write (Ostream &os) const
 Write content as dictionary entries. More...
 
bool valid () const noexcept
 True if the memory information appears valid. 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...
 

Detailed Description

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

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

Definition at line 58 of file memInfo.H.

Constructor & Destructor Documentation

◆ memInfo()

memInfo ( )

Construct and populate with values.

Definition at line 31 of file memInfo.C.

References memInfo::update().

Here is the call graph for this function:

◆ ~memInfo()

~memInfo ( )
default

Destructor.

Member Function Documentation

◆ good()

bool good ( ) const
noexcept

True if the memory information appears valid.

Definition at line 44 of file memInfo.C.

Referenced by memInfo::valid().

Here is the caller graph for this function:

◆ clear()

void clear ( )
noexcept

Reset to zero.

Definition at line 50 of file memInfo.C.

◆ update()

const Foam::memInfo & update ( )

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

Definition at line 57 of file memInfo.C.

References clear(), Foam::glTF::key(), and Foam::pid().

Referenced by memInfo::memInfo().

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

◆ peak()

int peak ( ) const
inlinenoexcept

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

Definition at line 119 of file memInfo.H.

◆ size()

int size ( ) const
inlinenoexcept

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

Definition at line 124 of file memInfo.H.

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

Here is the caller graph for this function:

◆ rss()

int rss ( ) const
inlinenoexcept

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

Definition at line 129 of file memInfo.H.

◆ free()

int free ( ) const
inlinenoexcept

System memory free (MemFree in /proc/meminfo)

Definition at line 134 of file memInfo.H.

◆ write()

void write ( Ostream os) const

Write content as dictionary entries.

Definition at line 154 of file memInfo.C.

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

Here is the call graph for this function:

◆ valid()

bool valid ( ) const
inlinenoexcept

True if the memory information appears valid.

Definition at line 163 of file memInfo.H.

References memInfo::good().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

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

Read peak/size/rss from stream.

◆ operator<<

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: