Mps br/diag: pass why reason down to tracestart.

Also: DIAG-out TraceStart reason, and -- if a non-monor collection -- 
 DIAG-out an ArenaDescribe.

Copied from Perforce
 Change: 162213
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Kistruck 2007-04-27 15:04:08 +01:00
parent 2be43e7a67
commit 1a9477b2cf
2 changed files with 14 additions and 5 deletions

View file

@ -358,7 +358,8 @@ extern void TraceDestroy(Trace trace);
extern Res TraceAddWhite(Trace trace, Seg seg);
extern Res TraceCondemnZones(Trace trace, ZoneSet condemnedSet);
extern void TraceStart(Trace trace, double mortality, double finishingTime);
extern void TraceStart(Trace trace, double mortality,
double finishingTime, int why);
extern Size TracePoll(Globals globals);
extern void TraceSegAccess(Arena arena, Seg seg, AccessSet mode);

View file

@ -1553,7 +1553,8 @@ static Res rootGrey(Root root, void *p)
return ResOK;
}
void TraceStart(Trace trace, double mortality, double finishingTime)
void TraceStart(Trace trace, double mortality,
double finishingTime, int why)
{
Arena arena;
Message message;
@ -1569,6 +1570,12 @@ void TraceStart(Trace trace, double mortality, double finishingTime)
arena = trace->arena;
DIAG_WRITEF(( DIAG_STREAM, "\n** TraceStart: $S\n", (WriteFS)trace->startMessage.why, NULL ));
if (why != TraceStartWhyCHAIN_GEN0CAP) {
/* a non-minor collection */
DIAG( ArenaDescribe(arena, DIAG_STREAM); );
}
message = TraceStartMessageMessage(&trace->startMessage);
/* Attempt to re-use message.
* @@@@ This is not done safely, because we fail to record
@ -1726,7 +1733,7 @@ static Res traceStartCollectAll(Trace *traceReturn, Arena arena, int why)
/* Run out of time, should really try a smaller collection. @@@@ */
finishingTime = 0.0;
}
TraceStart(trace, TraceTopGenMortality, finishingTime);
TraceStart(trace, TraceTopGenMortality, finishingTime, why);
*traceReturn = trace;
return ResOK;
@ -1791,16 +1798,17 @@ Size TracePoll(Globals globals)
/* If one was found, start collection on that chain. */
if (firstTime < 0) {
int why = TraceStartWhyCHAIN_GEN0CAP;
double mortality;
res = TraceCreate(&trace, arena, TraceStartWhyCHAIN_GEN0CAP);
res = TraceCreate(&trace, arena, why);
AVER(res == ResOK);
res = ChainCondemnAuto(&mortality, firstChain, trace);
if (res != ResOK) /* should try some other trace, really @@@@ */
goto failCondemn;
trace->chain = firstChain;
ChainStartGC(firstChain, trace);
TraceStart(trace, mortality, trace->condemned * TraceWorkFactor);
TraceStart(trace, mortality, trace->condemned * TraceWorkFactor, why);
scannedSize = traceWorkClock(trace);
}
} /* (dynamicDeferral > 0.0) */