80 if (
f->total >
f->max)
90 return ((
char *)
d) +
sizeof(
pmdata);
99 fputs (
"*** MTRACE: ERROR!: corrupted free()",
stderr);
112 if (
f->total <
d->size) {
113 fprintf (
stderr,
"*** MTRACE: ERROR!: %ld < %ld: corrupted free()?\n",
120 fprintf (
stderr,
"*** MTRACE: ERROR!: %ld < %ld: corrupted free()?\n",
173 return p1->max <
p2->max;
179 return p1->total <
p2->total;
196 "*** MTRACE: max resident set size: %10ld bytes\n"
197 "*** MTRACE: max traced memory size: %10ld bytes"
198 " (tracing overhead %.1g%%)\n"
202 "max bytes",
"function",
"file");
207 p->max,
p->func,
p->file,
p->line);
214 fputs (
"load(\"`echo \f$BASILISK`/mtrace.plot\")\n",
pmtrace.fp);
216 "plot '%s' u 3:(\f$6-%g) w l t 'ru_maxrss - %.3g',"
217 "total(\"%s\") w l t 'total'",
225 ",func(\"%s\",%d) w l t '%s'",
229 "*** MTRACE: To get a graph use: tail -n 2 %s | gnuplot -persist\n",
242 p->file,
p->line,
p->total);
scalar f[]
The primary fields are:
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define func
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define file
static void * pcalloc(size_t nmemb, size_t size, const char *func, const char *file, int line)
static int pmfunc_index(const char *func, const char *file, int line)
static void pmfunc_trace(pmfunc *f, char c)
static int ptotalsort(const void *a, const void *b)
static int pmaxsort(const void *a, const void *b)
static void pfree(void *ptr, const char *func, const char *file, int line)
static void * pmalloc(size_t size, const char *func, const char *file, int line)
static void * pmfunc_alloc(pmdata *d, size_t size, const char *func, const char *file, int line, char c)
static char * pstrdup(const char *s, const char *func, const char *file, int line)
static void * pmfunc_free(void *ptr, char c)
static void pmfuncs_free()
static void * prealloc(void *ptr, size_t size, const char *func, const char *file, int line)