OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
IpplMemoryUsage Class Reference

#include <IpplMemoryUsage.h>

Public Types

enum  Unit {
  BIT, B, KB, KiB,
  MB, MiB, GB, GiB
}
 
typedef IpplMemoryUsageIpplMemory_p
 
typedef std::unique_ptr
< IpplMemoryUsage
IpplMemory_t
 

Public Member Functions

double getMemoryUsage (int core) const
 
void sample ()
 
const std::string & getUnit () const
 

Static Public Member Functions

static IpplMemory_p getInstance (Unit unit=Unit::GB, bool reset=true)
 

Private Member Functions

 IpplMemoryUsage ()
 
 IpplMemoryUsage (Unit unit=Unit::GB, bool reset=true)
 
void sample_m ()
 

Private Attributes

std::unique_ptr< double[]> globalMemPerCore_m
 memory of all cores More...
 
std::string unit_m
 what's the unit of the memory More...
 
double initial_memory_m
 memory usage at construction time [GB] or [GiB] More...
 
double max_rss_m
 max. resident set size [GB] or [GiB] More...
 
double conversion_factor_m
 to various units. getrusage() returns in kB More...
 
double who_m
 RUSAGE_SELF, RUSAGE_CHILDREN (, RUSAGE_THREAD) More...
 

Static Private Attributes

static IpplMemory_t instance_mp
 *this More...
 

Detailed Description

Definition at line 48 of file IpplMemoryUsage.h.

Member Typedef Documentation

Definition at line 52 of file IpplMemoryUsage.h.

Definition at line 53 of file IpplMemoryUsage.h.

Member Enumeration Documentation

Enumerator
BIT 

Bit.

B 

Byte.

KB 

KiloByte.

KiB 

KibiByte.

MB 

MegaByte.

MiB 

MebiByte.

GB 

GigaByte.

GiB 

GebiByte.

Definition at line 55 of file IpplMemoryUsage.h.

Constructor & Destructor Documentation

IpplMemoryUsage::IpplMemoryUsage ( )
private

Does nothing.

Definition at line 30 of file IpplMemoryUsage.cpp.

Referenced by getInstance().

IpplMemoryUsage::IpplMemoryUsage ( Unit  unit = Unit::GB,
bool  reset = true 
)
private

Create an instance.

Parameters
unitwe want to have
resetthe memory to zero. The value at construction time is subtracted at every sampling.

Definition at line 34 of file IpplMemoryUsage.cpp.

References conversion_factor_m, IpplInfo::getNodes(), globalMemPerCore_m, initial_memory_m, max_rss_m, sample_m(), and unit_m.

Here is the call graph for this function:

Member Function Documentation

IpplMemoryUsage::IpplMemory_p IpplMemoryUsage::getInstance ( Unit  unit = Unit::GB,
bool  reset = true 
)
static

Create / Get pointer to instance

Parameters
unitof memory
resetthe memory to zero. (see constructor documentation)

Definition at line 83 of file IpplMemoryUsage.cpp.

References instance_mp, and IpplMemoryUsage().

Referenced by Option::execute(), MemoryWriter::fillHeader(), and MemoryWriter::write().

Here is the call graph for this function:

double IpplMemoryUsage::getMemoryUsage ( int  core) const

Get the memory of a specific core (only valid call for root core 0)

Parameters
corewe want memory of.
Returns
the max. resident set size

Definition at line 91 of file IpplMemoryUsage.cpp.

References globalMemPerCore_m.

Referenced by MemoryWriter::write().

const std::string & IpplMemoryUsage::getUnit ( ) const
Returns
the unit string.

Definition at line 109 of file IpplMemoryUsage.cpp.

References unit_m.

Referenced by MemoryWriter::fillHeader().

void IpplMemoryUsage::sample ( )

Collect the memory data of all cores.

Definition at line 96 of file IpplMemoryUsage.cpp.

References gather(), IpplInfo::getNodes(), globalMemPerCore_m, max_rss_m, and sample_m().

Referenced by Option::execute(), and MemoryWriter::write().

Here is the call graph for this function:

void IpplMemoryUsage::sample_m ( )
private

Obtain the memory consumption. It throws an exception if an error ocurred.

Definition at line 114 of file IpplMemoryUsage.cpp.

References conversion_factor_m, initial_memory_m, max_rss_m, and who_m.

Referenced by IpplMemoryUsage(), and sample().

Member Data Documentation

double IpplMemoryUsage::conversion_factor_m
private

to various units. getrusage() returns in kB

Definition at line 117 of file IpplMemoryUsage.h.

Referenced by IpplMemoryUsage(), and sample_m().

std::unique_ptr<double[]> IpplMemoryUsage::globalMemPerCore_m
private

memory of all cores

Definition at line 113 of file IpplMemoryUsage.h.

Referenced by getMemoryUsage(), IpplMemoryUsage(), and sample().

double IpplMemoryUsage::initial_memory_m
private

memory usage at construction time [GB] or [GiB]

Definition at line 115 of file IpplMemoryUsage.h.

Referenced by IpplMemoryUsage(), and sample_m().

IpplMemory_t IpplMemoryUsage::instance_mp
staticprivate

*this

Definition at line 112 of file IpplMemoryUsage.h.

Referenced by getInstance().

double IpplMemoryUsage::max_rss_m
private

max. resident set size [GB] or [GiB]

Definition at line 116 of file IpplMemoryUsage.h.

Referenced by IpplMemoryUsage(), sample(), and sample_m().

std::string IpplMemoryUsage::unit_m
private

what's the unit of the memory

Definition at line 114 of file IpplMemoryUsage.h.

Referenced by getUnit(), and IpplMemoryUsage().

double IpplMemoryUsage::who_m
private

RUSAGE_SELF, RUSAGE_CHILDREN (, RUSAGE_THREAD)

Definition at line 118 of file IpplMemoryUsage.h.

Referenced by sample_m().


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