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...
 
bool good () const noexcept
 True if the memory information appears valid. More...
 
int64_t peak () const noexcept
 Peak memory at last update - (VmPeak in /proc/PID/status) More...
 
int64_t size () const noexcept
 Memory size at last update - (VmSize in /proc/PID/status) More...
 
int64_t rss () const noexcept
 Resident set size at last update - (VmRSS in /proc/PID/status) More...
 
int64_t free () const noexcept
 System memory free (MemFree in /proc/meminfo) More...
 
void clear () noexcept
 Reset to zero. More...
 
const memInfoupdate ()
 Update according to /proc/PID/status and /proc/memory contents. More...
 
void writeEntries (Ostream &os) const
 Write mem-info as dictionary entries. More...
 
void writeEntry (const word &keyword, Ostream &os) const
 Write mem-info as dictionary. More...
 

Friends

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 32 of file memInfo.C.

Member Function Documentation

◆ good()

bool good ( ) const
noexcept

True if the memory information appears valid.

Definition at line 45 of file memInfo.C.

◆ peak()

int64_t peak ( ) const
inlinenoexcept

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

Definition at line 113 of file memInfo.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

◆ size()

int64_t size ( ) const
inlinenoexcept

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

Definition at line 118 of file memInfo.H.

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

Here is the caller graph for this function:

◆ rss()

int64_t rss ( ) const
inlinenoexcept

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

Definition at line 123 of file memInfo.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

◆ free()

int64_t free ( ) const
inlinenoexcept

System memory free (MemFree in /proc/meminfo)

Definition at line 128 of file memInfo.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

◆ clear()

void clear ( )
noexcept

Reset to zero.

Definition at line 51 of file memInfo.C.

◆ update()

const Foam::memInfo & update ( )

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

Definition at line 153 of file memInfo.C.

References clear().

Here is the call graph for this function:

◆ writeEntries()

void writeEntries ( Ostream os) const

Write mem-info as dictionary entries.

Definition at line 161 of file memInfo.C.

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

Here is the call graph for this function:

◆ writeEntry()

void writeEntry ( const word keyword,
Ostream os 
) const

Write mem-info as dictionary.

Definition at line 171 of file memInfo.C.

References Ostream::beginBlock(), Ostream::endBlock(), and os().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ 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: