25 #include "pips_config.h"
77 #define ABS(x) ((x>0)?(x):-(x))
80 #define TailleDeMaPile 30
134 "Too many calls to mem_spy_begin(), non-empty stack reset\n");
203 double current_begin, current_end, cumul, diff, proper;
215 "Too many calls to mem_spy_end(), stack underflow\n");
222 "[%s] begin: %10.0f B end: %10.0f B diff: %10.0f B "
223 "proper: %10.0f B\n";
227 "[%s] begin: %10.3f KB end: %10.3f KB diff: %10.3f KB "
228 "proper: %10.3f KB\n";
232 "[%s] begin: %10.6f MB end: %10.6f MB diff: %10.6f MB "
233 "proper: %10.6f MB\n";
236 "MEM_SPY (unknown unit %d) "
237 "[%s] begin: %10.6f (?) end: %10.6f (?) diff: %10.6f (?) "
238 "proper: %10.6f (?)\n";
243 current_end = memory_size/(double)(1 <<
log_of_unit);
252 diff = current_end - current_begin;
253 proper = diff - cumul;
264 s, current_begin, current_end, diff, proper);
static MemSpyStack current_size_stack
To store the memory size at program section entry.
static int verbosity
To control verbosity: from 2, max, to -1, shut up.
void mem_spy_info()
To print mallinfo, for debugging memory leaks.
void mem_spy_end(char *s)
struct _MemSpyStack * MemSpyStack
static double granularity
To control granularity: threshold in MB for reporting changes in memory use.
static MemSpyStack cumul_size_stack
To store the cumulated memory size of inner guarded sections.
#define TailleDeMaPile
My own stack (do not rely on any package!)
struct _MemSpyStack _MemSpyStack
static measurement_type measurement
measurement chosen
#define ABS(x)
MEM_SPY : Package to track memory usage.
static int log_of_unit
log2 of unit chosen: 0 = Byte, 10 = KB, 20 = MB
static int MemSpyUsed
To print only wanted results (and be sure that stacks have been initialized :-)
static int current_memory_size()
void mem_spy_init(int v, double g, measurement_type t, int unit)
measurement_type
Measurement type for mem_spy.c.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
double elt[TailleDeMaPile]