Bug 1165385 - Remove the rarely used !fullFormat mode of MOZ_GCTIMER; r=sfink

This commit is contained in:
Terrence Cole 2015-05-20 09:14:29 -07:00
parent d6be2c71b2
commit e8b2e18054
2 changed files with 21 additions and 43 deletions

View File

@ -775,7 +775,6 @@ Statistics::Statistics(JSRuntime* rt)
: runtime(rt), : runtime(rt),
startupTime(PRMJ_Now()), startupTime(PRMJ_Now()),
fp(nullptr), fp(nullptr),
fullFormat(false),
gcDepth(0), gcDepth(0),
nonincrementalReason_(nullptr), nonincrementalReason_(nullptr),
timedGCStart(0), timedGCStart(0),
@ -840,36 +839,30 @@ Statistics::Statistics(JSRuntime* rt)
} }
char* env = getenv("MOZ_GCTIMER"); char* env = getenv("MOZ_GCTIMER");
if (!env || strcmp(env, "none") == 0) { if (env) {
fp = nullptr; if (strcmp(env, "none") == 0) {
return; fp = nullptr;
} } else if (strcmp(env, "stdout") == 0) {
fp = stdout;
if (strcmp(env, "stdout") == 0) { } else if (strcmp(env, "stderr") == 0) {
fullFormat = false; fp = stderr;
fp = stdout; } else {
} else if (strcmp(env, "stderr") == 0) { fp = fopen(env, "a");
fullFormat = false; if (!fp)
fp = stderr; MOZ_CRASH("Failed to open MOZ_GCTIMER log file.");
} else { }
fullFormat = true;
fp = fopen(env, "a");
MOZ_ASSERT(fp);
} }
} }
Statistics::~Statistics() Statistics::~Statistics()
{ {
if (fp) { if (fp) {
if (fullFormat) { StatisticsSerializer ss(StatisticsSerializer::AsText);
StatisticsSerializer ss(StatisticsSerializer::AsText); FormatPhaseTimes(ss, "", phaseTotals);
FormatPhaseTimes(ss, "", phaseTotals); char* msg = ss.finishCString();
char* msg = ss.finishCString(); if (msg) {
if (msg) { fprintf(fp, "TOTALS\n%s\n\n-------\n", msg);
fprintf(fp, "TOTALS\n%s\n\n-------\n", msg); js_free(msg);
js_free(msg);
}
} }
if (fp != stdout && fp != stderr) if (fp != stdout && fp != stderr)
@ -912,26 +905,11 @@ void
Statistics::printStats() Statistics::printStats()
{ {
if (aborted) { if (aborted) {
if (fullFormat) fprintf(fp, "OOM during GC statistics collection. The report is unavailable for this GC.\n");
fprintf(fp, "OOM during GC statistics collection. The report is unavailable for this GC.\n"); } else {
fflush(fp);
return;
}
if (fullFormat) {
UniqueChars msg = formatDetailedMessage(); UniqueChars msg = formatDetailedMessage();
if (msg) if (msg)
fprintf(fp, "GC(T+%.3fs) %s\n", t(slices[0].start - startupTime) / 1000.0, msg.get()); fprintf(fp, "GC(T+%.3fs) %s\n", t(slices[0].start - startupTime) / 1000.0, msg.get());
} else {
int64_t total, longest;
gcDuration(&total, &longest);
int64_t markTotal = SumPhase(PHASE_MARK, phaseTimes);
fprintf(fp, "%f %f %f\n",
t(total),
t(markTotal),
t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP]));
MOZ_ASSERT(phaseExtra[PHASE_SWEEP].dagSlot == PHASE_DAG_NONE);
} }
fflush(fp); fflush(fp);
} }

View File

@ -240,8 +240,8 @@ struct Statistics
int64_t startupTime; int64_t startupTime;
/* File pointer used for MOZ_GCTIMER output. */
FILE* fp; FILE* fp;
bool fullFormat;
/* /*
* GCs can't really nest, but a second GC can be triggered from within the * GCs can't really nest, but a second GC can be triggered from within the