FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::MemoryUsage Class Reference

Memory usage info object. More...

#include <memory_usage.hpp>

Public Member Functions

std::size_t get_current_physical () const
 Returns current (last stamp call) physical memory. More...
 
std::size_t get_current_swap () const
 Returns current (last stamp call) swap memory. More...
 
std::size_t get_current_virtual () const
 Returns current (last stamp call) virtual memory. More...
 
String get_formatted_memory_usage () const
 Retrieve formatted memory usage string. More...
 
std::size_t get_peak_physical () const
 Returns peak physical memory. More...
 
std::size_t get_peak_virtual () const
 Returns peak virtual memory. More...
 
void stamp ()
 update the memory usage statistics with current data More...
 

Static Public Member Functions

static String format_peak_physical_usage (const Dist::Comm &comm)
 Returns the formatted peak physical memory usage over an entire communicator. More...
 

Private Attributes

std::size_t _current_physical
 
std::size_t _current_swap
 
std::size_t _current_virtual
 
std::size_t _peak_physical
 
std::size_t _peak_virtual
 

Detailed Description

Memory usage info object.

This class is used to store and report memory usage statistics.

Note
The values reported by the various getter methods are all related to the moment when the object was instantiated or the last time, the stamp method was called. The term 'current' in the variables names has historic reasons.
Platform dependend code branching:
linux, windows and bsd all have different memory statistic tools
Note
Backport from FEAT 1 feat1/feat/kernel/arch/sysextra.c 3ccb13f633 and http://stackoverflow.com/questions/1558402/memory-usage-of-current-process-in-c

Definition at line 42 of file memory_usage.hpp.

Constructor & Destructor Documentation

◆ MemoryUsage()

FEAT::MemoryUsage::MemoryUsage ( )
inline

Definition at line 52 of file memory_usage.hpp.

Member Function Documentation

◆ format_peak_physical_usage()

static String FEAT::MemoryUsage::format_peak_physical_usage ( const Dist::Comm comm)
inlinestatic

Returns the formatted peak physical memory usage over an entire communicator.

This function formats the sum of the peak memory usage over all ranks in the communicator as well as the maximum and the minimum peak memory usage.

Definition at line 227 of file memory_usage.hpp.

References FEAT::Dist::Comm::allreduce(), get_peak_physical(), FEAT::Dist::op_max, FEAT::Dist::op_min, FEAT::Dist::op_sum, and FEAT::stringify_bytes().

◆ get_current_physical()

std::size_t FEAT::MemoryUsage::get_current_physical ( ) const
inline

Returns current (last stamp call) physical memory.

Definition at line 179 of file memory_usage.hpp.

◆ get_current_swap()

std::size_t FEAT::MemoryUsage::get_current_swap ( ) const
inline

Returns current (last stamp call) swap memory.

Definition at line 203 of file memory_usage.hpp.

◆ get_current_virtual()

std::size_t FEAT::MemoryUsage::get_current_virtual ( ) const
inline

Returns current (last stamp call) virtual memory.

Definition at line 191 of file memory_usage.hpp.

◆ get_formatted_memory_usage()

String FEAT::MemoryUsage::get_formatted_memory_usage ( ) const
inline

Retrieve formatted memory usage string.

Definition at line 209 of file memory_usage.hpp.

References FEAT::String::pad_back(), and FEAT::stringify().

Referenced by FEAT::Control::Statistics::report().

◆ get_peak_physical()

std::size_t FEAT::MemoryUsage::get_peak_physical ( ) const
inline

Returns peak physical memory.

Definition at line 185 of file memory_usage.hpp.

Referenced by format_peak_physical_usage().

◆ get_peak_virtual()

std::size_t FEAT::MemoryUsage::get_peak_virtual ( ) const
inline

Returns peak virtual memory.

Definition at line 197 of file memory_usage.hpp.

◆ stamp()

void FEAT::MemoryUsage::stamp ( )
inline

update the memory usage statistics with current data

Definition at line 63 of file memory_usage.hpp.

References FEAT::Windows::query_memory_usage(), FEAT::String::split_by_whitespaces(), FEAT::String::starts_with(), XABORTM, and XASSERTM.

Member Data Documentation

◆ _current_physical

std::size_t FEAT::MemoryUsage::_current_physical
private

Definition at line 45 of file memory_usage.hpp.

◆ _current_swap

std::size_t FEAT::MemoryUsage::_current_swap
private

Definition at line 49 of file memory_usage.hpp.

◆ _current_virtual

std::size_t FEAT::MemoryUsage::_current_virtual
private

Definition at line 47 of file memory_usage.hpp.

◆ _peak_physical

std::size_t FEAT::MemoryUsage::_peak_physical
private

Definition at line 46 of file memory_usage.hpp.

◆ _peak_virtual

std::size_t FEAT::MemoryUsage::_peak_virtual
private

Definition at line 48 of file memory_usage.hpp.


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