|
MADNESS 0.10.1
|
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. | |
| void | reset () |
| Resets all counters to zero. | |
| void | set_max_mem_limit (unsigned long max_mem_limit) |
| Set the maximum memory limit (trying to allocate more will throw MadnessException) | |
| void | set_trace (bool trace) |
| If trace is set true a message is printed for every new and delete. | |
Public Attributes | |
| unsigned long | cur_num_bytes |
| Current amount of allocated memory in bytes. | |
| unsigned long | cur_num_frags |
| Current number of allocated fragments. | |
| unsigned long | max_mem_limit |
| if size+cur_num_bytes>max_mem_limit new will throw MadnessException | |
| unsigned long | max_num_bytes |
| Lifetime maximum number of allocated bytes. | |
| unsigned long | max_num_frags |
| Lifetime maximum number of allocated fragments. | |
| unsigned long | num_del_calls |
| Counts calls to delete. | |
| unsigned long | num_new_calls |
| If you add new stats be sure that the initialization in worldmem.cc is OK. | |
| bool | trace |
Static Public Attributes | |
| static const unsigned long | overhead = 4*sizeof(long) + 16 |
Private Member Functions | |
| void | do_del (void *p, std::size_t size) |
| Invoked when user pointer p is deleted with size bytes. | |
| void | do_new (void *p, std::size_t size) |
| Invoked when user pointer p is allocated with size bytes. | |
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 compiling with WORLD_GATHER_MEM_STATS enabled.
Default for max_mem_limit is unlimited.
Invoked when user pointer p is deleted with size bytes.
References cur_num_bytes, cur_num_frags, num_del_calls, p(), and trace.
Invoked when user pointer p is allocated with size bytes.
References cur_num_bytes, cur_num_frags, max_num_bytes, max_num_frags, num_new_calls, p(), and trace.
| 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 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.
Set the maximum memory limit (trying to allocate more will throw MadnessException)
References max_mem_limit.
If trace is set true a message is printed for every new and delete.
References trace.
if size+cur_num_bytes>max_mem_limit new will throw MadnessException
Referenced by set_max_mem_limit().
If you add new stats be sure that the initialization in worldmem.cc is OK.
Counts calls to new
Referenced by print().
| bool madness::WorldMemInfo::trace |
Referenced by do_del(), do_new(), and set_trace().