MADNESS  version 0.9
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
madness::WorldMemInfo Class Reference

Used to output memory statistics and control tracing, etc. More...

#include <worldmem.h>

Public Member Functions

void print () const
 Prints memory use statistics to std::cout. More...
 
void reset ()
 Resets all counters to zero. More...
 
void set_trace (bool trace)
 If trace is set true a message is printed for every new and delete. More...
 
void set_max_mem_limit (unsigned long max_mem_limit)
 Set the maximum memory limit (trying to allocate more will throw MadnessException) More...
 

Public Attributes

unsigned long num_new_calls
 If you add new stats be sure that the initialization in worldmem.cc is OK. More...
 
unsigned long num_del_calls
 Counts calls to delete. More...
 
unsigned long cur_num_frags
 Current number of allocated fragments. More...
 
unsigned long max_num_frags
 Lifetime maximum number of allocated fragments. More...
 
unsigned long cur_num_bytes
 Current amount of allocated memory in bytes. More...
 
unsigned long max_num_bytes
 Lifetime maximum number of allocated bytes. More...
 
unsigned long max_mem_limit
 if size+cur_num_bytes>max_mem_limit new will throw MadnessException More...
 
bool trace
 

Static Public Attributes

static const unsigned long overhead = 4*sizeof(long) + 16
 

Detailed Description

Used to output memory statistics and control tracing, etc.

There is currently only one instance of this class in worldmem.cc that is used by special versions of global new+delete enabled by compliling with WORLD_GATHER_MEM_STATS enabled.

Default for max_mem_limit is unlimited.

Member Function Documentation

void madness::WorldMemInfo::print ( ) const

Prints memory use statistics to std::cout.

References cur_num_bytes, cur_num_frags, max_num_bytes, max_num_frags, num_del_calls, num_new_calls, and overhead.

Referenced by main(), and madness::print_stats().

void madness::WorldMemInfo::reset ( )

Resets all counters to zero.

References cur_num_bytes, cur_num_frags, max_num_bytes, max_num_frags, num_del_calls, and num_new_calls.

void madness::WorldMemInfo::set_max_mem_limit ( unsigned long  max_mem_limit)
inline

Set the maximum memory limit (trying to allocate more will throw MadnessException)

References max_mem_limit.

void madness::WorldMemInfo::set_trace ( bool  trace)
inline

If trace is set true a message is printed for every new and delete.

References trace.

Member Data Documentation

unsigned long madness::WorldMemInfo::cur_num_bytes

Current amount of allocated memory in bytes.

Referenced by print(), and reset().

unsigned long madness::WorldMemInfo::cur_num_frags

Current number of allocated fragments.

Referenced by print(), and reset().

unsigned long madness::WorldMemInfo::max_mem_limit

if size+cur_num_bytes>max_mem_limit new will throw MadnessException

Referenced by set_max_mem_limit().

unsigned long madness::WorldMemInfo::max_num_bytes

Lifetime maximum number of allocated bytes.

Referenced by print(), and reset().

unsigned long madness::WorldMemInfo::max_num_frags

Lifetime maximum number of allocated fragments.

Referenced by print(), and reset().

unsigned long madness::WorldMemInfo::num_del_calls

Counts calls to delete.

Referenced by print(), and reset().

unsigned long madness::WorldMemInfo::num_new_calls

If you add new stats be sure that the initialization in worldmem.cc is OK.

Counts calls to new

Referenced by print(), and reset().

const unsigned long madness::WorldMemInfo::overhead = 4*sizeof(long) + 16
static

Referenced by print().

bool madness::WorldMemInfo::trace

Referenced by set_trace().


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