Geophysical Inversion and Modelling Library  v1.5.2-5-g042d7f36
GIMLI::MemWatch Class Reference

Memory watch. More...

+ Inheritance diagram for GIMLI::MemWatch:
+ Collaboration diagram for GIMLI::MemWatch:

Public Member Functions

double inUse ()
 
double current ()
 
void info (const std::string &str="")
 

Protected Attributes

double last_
 

Friends

class Singleton< MemWatch >
 

Additional Inherited Members

- Static Public Member Functions inherited from GIMLI::Singleton< MemWatch >
static MemWatchpInstance ()
 
static MemWatchinstance ()
 
- Protected Member Functions inherited from GIMLI::Singleton< MemWatch >
 Singleton ()
 
 Singleton (const Singleton &)
 

Detailed Description

Memory watch.

Class that might help debugging memory usage. Informations are taken from /proc system, so only available for linux systems. This is a singleton class to ensure a single instance. To call it use e.g.: MemWatch::instance().info(WHERE);

Member Function Documentation

◆ current()

double GIMLI::MemWatch::current ( )

Return the current memory usage relative to the last call of this method. Values are in MByte.

References inUse().

Referenced by info().

◆ info()

void GIMLI::MemWatch::info ( const std::string &  str = "")

Shows the current and the relative (to the last call) memory usage.

References current(), GIMLI::Stopwatch::duration(), and inUse().

◆ inUse()

double GIMLI::MemWatch::inUse ( )

Return the current memory usage of the process. Values are in MByte.

References GIMLI::MByte().

Referenced by current(), info(), and GIMLI::memoryInUse().