OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <IpplMemoryUsage.h>
Public Types | |
enum | Unit { BIT , B , KB , KiB , MB , MiB , GB , GiB } |
typedef IpplMemoryUsage * | IpplMemory_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... | |
Definition at line 51 of file IpplMemoryUsage.h.
Definition at line 55 of file IpplMemoryUsage.h.
typedef std::unique_ptr<IpplMemoryUsage> IpplMemoryUsage::IpplMemory_t |
Definition at line 56 of file IpplMemoryUsage.h.
Enumerator | |
---|---|
BIT | Bit. |
B | Byte. |
KB | KiloByte. |
KiB | KibiByte. |
MB | MegaByte. |
MiB | MebiByte. |
GB | GigaByte. |
GiB | GebiByte. |
Definition at line 58 of file IpplMemoryUsage.h.
|
private |
|
private |
Create an instance.
unit | we want to have |
reset | the memory to zero. The value at construction time is subtracted at every sampling. |
Definition at line 51 of file IpplMemoryUsage.cpp.
References conversion_factor_m, IpplInfo::getNodes(), globalMemPerCore_m, initial_memory_m, max_rss_m, sample_m(), and unit_m.
|
static |
Create / Get pointer to instance
unit | of memory |
reset | the memory to zero. (see constructor documentation) |
Definition at line 100 of file IpplMemoryUsage.cpp.
References instance_mp, and IpplMemoryUsage().
Referenced by Option::execute(), MemoryWriter::fillHeader(), and MemoryWriter::write().
double IpplMemoryUsage::getMemoryUsage | ( | int | core | ) | const |
Get the memory of a specific core (only valid call for root core 0)
core | we want memory of. |
Definition at line 108 of file IpplMemoryUsage.cpp.
References globalMemPerCore_m.
Referenced by MemoryWriter::write().
const std::string & IpplMemoryUsage::getUnit | ( | ) | const |
Definition at line 126 of file IpplMemoryUsage.cpp.
References unit_m.
Referenced by MemoryWriter::fillHeader().
void IpplMemoryUsage::sample | ( | ) |
Collect the memory data of all cores.
Definition at line 113 of file IpplMemoryUsage.cpp.
References gather(), IpplInfo::getNodes(), globalMemPerCore_m, max_rss_m, and sample_m().
Referenced by Option::execute(), and MemoryWriter::write().
|
private |
Obtain the memory consumption. It throws an exception if an error ocurred.
Definition at line 131 of file IpplMemoryUsage.cpp.
References conversion_factor_m, initial_memory_m, max_rss_m, and who_m.
Referenced by IpplMemoryUsage(), and sample().
|
private |
to various units. getrusage() returns in kB
Definition at line 120 of file IpplMemoryUsage.h.
Referenced by IpplMemoryUsage(), and sample_m().
|
private |
memory of all cores
Definition at line 116 of file IpplMemoryUsage.h.
Referenced by getMemoryUsage(), IpplMemoryUsage(), and sample().
|
private |
memory usage at construction time [GB] or [GiB]
Definition at line 118 of file IpplMemoryUsage.h.
Referenced by IpplMemoryUsage(), and sample_m().
|
staticprivate |
|
private |
max. resident set size [GB] or [GiB]
Definition at line 119 of file IpplMemoryUsage.h.
Referenced by IpplMemoryUsage(), sample(), and sample_m().
|
private |
what's the unit of the memory
Definition at line 117 of file IpplMemoryUsage.h.
Referenced by getUnit(), and IpplMemoryUsage().
|
private |
RUSAGE_SELF, RUSAGE_CHILDREN (, RUSAGE_THREAD)
Definition at line 121 of file IpplMemoryUsage.h.
Referenced by sample_m().