#ifndef MAPUTIL_H #define MAPUTIL_H #include #include using namespace std; struct MALLOC_STATS_BASE{ long sofar; // Current allocation level long total; // Amounted allocated long maxalloc; // Maximum allocation reached during execution long nbmalloc; // Allocation performed MALLOC_STATS_BASE(){ sofar = total = maxalloc = nbmalloc = 0; } void add (long size){ sofar += size; total += size; if (sofar > maxalloc) maxalloc = sofar; nbmalloc++; } void del (long size){ sofar -= size; } }; long long map_s2ll(const char *s); struct MALLOC_STATS_MSG: public MALLOC_STATS_BASE{ long long start,end; string msg; MALLOC_STATS_MSG(const char *_stamp, const char *_msg) { start = map_s2ll (_stamp); end = start; // end will be filled later msg = _msg; } bool operator < (const MALLOC_STATS_MSG &m) const { return start < m.start; } }; typedef vector MALLOC_STATS_MSGS; class SSTRINGS; #include "maputil.p" #endif