diff --git a/mozilla/tools/trace-malloc/lib/nsTraceMalloc.c b/mozilla/tools/trace-malloc/lib/nsTraceMalloc.c index 5530556c8b1..47bd7aa4dc8 100644 --- a/mozilla/tools/trace-malloc/lib/nsTraceMalloc.c +++ b/mozilla/tools/trace-malloc/lib/nsTraceMalloc.c @@ -1323,7 +1323,7 @@ backtrace(int skip) site = calltree(skip); if (!site) { tmstats.backtrace_failures++; - PR_ASSERT(tmstats.backtrace_failures < 100); + /* PR_ASSERT(tmstats.backtrace_failures < 100); */ } suppress_tracing--; return site; diff --git a/mozilla/tools/trace-malloc/spacetrace.c b/mozilla/tools/trace-malloc/spacetrace.c index 110607ebefa..6065e48a972 100644 --- a/mozilla/tools/trace-malloc/spacetrace.c +++ b/mozilla/tools/trace-malloc/spacetrace.c @@ -1905,9 +1905,20 @@ trackEvent(PRUint32 aTimeval, char aType, PRUint32 aHeapRuntimeCost, ** Callback from the tmreader_eventloop function. ** Simply tries to sort out what we desire to know. */ + +static const char spinner_chars[] = { '/', '-', '\\', '|' }; + +#define SPINNER_UPDATE_FREQUENCY 4096 +#define SPINNER_CHAR_COUNT (sizeof(spinner_chars) / sizeof(spinner_chars[0])) +#define SPINNER_CHAR(_x) spinner_chars[(_x / SPINNER_UPDATE_FREQUENCY) % SPINNER_CHAR_COUNT] + void tmEventHandler(tmreader * aReader, tmevent * aEvent) { + static event_count = 0; /* for spinner */ + if ((event_count++ % SPINNER_UPDATE_FREQUENCY) == 0) + printf("\rReading... %c", SPINNER_CHAR(event_count)); + if (NULL != aReader && NULL != aEvent) { switch (aEvent->type) { /* @@ -5774,7 +5785,7 @@ handleClient(void *inArg) */ PR_fprintf(aFD, "HTTP/1.1 200 OK%s", crlf); PR_fprintf(aFD, "Server: %s%s", - "$Id: spacetrace.c,v 1.48 2003-06-18 02:13:42 alecf%flett.org Exp $", + "$Id: spacetrace.c,v 1.49 2004-01-13 16:35:45 alecf%flett.org Exp $", crlf); PR_fprintf(aFD, "Content-type: "); if (NULL != strstr(start, ".png")) { @@ -5888,16 +5899,24 @@ serverMode(void) REPORT_INFO(message); PR_fprintf(PR_STDOUT, "Peak memory used: %s bytes\n", FormatNumber(globals.mPeakMemoryUsed)); - PR_fprintf(PR_STDOUT, "Total calls : %s", + PR_fprintf(PR_STDOUT, "Allocations : %s total\n", FormatNumber(globals.mMallocCount + globals.mCallocCount + - globals.mReallocCount)); - PR_fprintf(PR_STDOUT, " [%s", + globals.mReallocCount), + FormatNumber(globals.mFreeCount)); + PR_fprintf(PR_STDOUT, "Breakdown : %s malloc\n", FormatNumber(globals.mMallocCount)); - PR_fprintf(PR_STDOUT, " + %s", + PR_fprintf(PR_STDOUT, " %s calloc\n", FormatNumber(globals.mCallocCount)); - PR_fprintf(PR_STDOUT, " + %s]\n", + PR_fprintf(PR_STDOUT, " %s realloc\n", FormatNumber(globals.mReallocCount)); + PR_fprintf(PR_STDOUT, " %s free\n", + FormatNumber(globals.mFreeCount)); + PR_fprintf(PR_STDOUT, "Leaks : %s\n", + FormatNumber((globals.mMallocCount + + globals.mCallocCount + + globals.mReallocCount) - + globals.mFreeCount)); /* ** Keep accepting until we know otherwise. ** @@ -6086,6 +6105,7 @@ doRun(void) tmreader_eventloop(globals.mTMR, globals.mCommandLineOptions.mFileName, tmEventHandler); + printf("\rReading... Done.\n"); #if defined(DEBUG_dp) fprintf(stderr, "DEBUG: reading tracemalloc data ends: %dms [%d allocations]\n",