Bug 716619 - Simplify GC probes (r=sfink)

This commit is contained in:
Bill McCloskey 2012-01-27 17:01:04 -08:00
parent 09943f80b9
commit 4ad13c19a0
3 changed files with 46 additions and 59 deletions

View File

@ -79,29 +79,29 @@
<!-- GC --> <!-- GC -->
<event symbol="EvtGCStart" value="1012" version="1" <event symbol="EvtGCStart" value="1012" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCStart" template="VoidTemplate" task="Allocation" opcode="GCStart"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtGCEnd" value="1013" version="1" <event symbol="EvtGCEnd" value="1013" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCEnd" template="VoidTemplate" task="Allocation" opcode="GCEnd"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtGCStartMarkPhase" value="1014" version="1" <event symbol="EvtGCStartMarkPhase" value="1014" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCMarkStart" template="VoidTemplate" task="Allocation" opcode="GCMarkStart"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtGCEndMarkPhase" value="1015" version="1" <event symbol="EvtGCEndMarkPhase" value="1015" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCMarkEnd" template="VoidTemplate" task="Allocation" opcode="GCMarkEnd"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtGCStartSweepPhase" value="1016" version="1" <event symbol="EvtGCStartSweepPhase" value="1016" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCSweepStart" template="VoidTemplate" task="Allocation" opcode="GCSweepStart"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtGCEndSweepPhase" value="1017" version="1" <event symbol="EvtGCEndSweepPhase" value="1017" version="1"
channel="MozillaChannel" level="win:Informational" channel="MozillaChannel" level="win:Informational"
template="CompartmentTemplate" task="Allocation" opcode="GCSweepEnd" template="VoidTemplate" task="Allocation" opcode="GCSweepEnd"
keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/> keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
<event symbol="EvtMemoryAcquire" value="1018" version="1" <event symbol="EvtMemoryAcquire" value="1018" version="1"
@ -231,10 +231,6 @@
<data name="Size" inType="win:Int64" outType="xs:long"/> <data name="Size" inType="win:Int64" outType="xs:long"/>
</template> </template>
<template tid="CompartmentTemplate">
<data name="Compartment" inType="win:Int64" outType="xs:long"/>
</template>
<template tid="MemoryLocationTemplate"> <template tid="MemoryLocationTemplate">
<data name="Compartment" inType="win:Int64" outType="xs:long"/> <data name="Compartment" inType="win:Int64" outType="xs:long"/>
<data name="Address" inType="win:Int64" outType="xs:long"/> <data name="Address" inType="win:Int64" outType="xs:long"/>
@ -259,6 +255,9 @@
<data name="Int" inType="win:Int32" outType="xs:int"/> <data name="Int" inType="win:Int32" outType="xs:int"/>
</template> </template>
<template tid="VoidTemplate">
</template>
</templates> </templates>
</provider> </provider>
</events> </events>

View File

@ -206,7 +206,7 @@ Statistics::beginGC(JSCompartment *comp, gcreason::Reason reason)
triggerReason = reason; triggerReason = reason;
beginPhase(PHASE_GC); beginPhase(PHASE_GC);
Probes::GCStart(compartment); Probes::GCStart();
GCCrashData crashData; GCCrashData crashData;
crashData.isCompartment = !!compartment; crashData.isCompartment = !!compartment;
@ -283,7 +283,7 @@ Statistics::printStats()
void void
Statistics::endGC() Statistics::endGC()
{ {
Probes::GCEnd(compartment); Probes::GCEnd();
endPhase(PHASE_GC); endPhase(PHASE_GC);
crash::SnapshotGCStack(); crash::SnapshotGCStack();
@ -315,16 +315,10 @@ Statistics::beginPhase(Phase phase)
{ {
phaseStarts[phase] = PRMJ_Now(); phaseStarts[phase] = PRMJ_Now();
if (phase == gcstats::PHASE_SWEEP) { if (phase == gcstats::PHASE_MARK)
Probes::GCStartSweepPhase(NULL); Probes::GCStartMarkPhase();
if (!compartment) { else if (phase == gcstats::PHASE_SWEEP)
for (JSCompartment **c = runtime->compartments.begin(); Probes::GCStartSweepPhase();
c != runtime->compartments.end(); ++c)
{
Probes::GCStartSweepPhase(*c);
}
}
}
} }
void void
@ -333,16 +327,10 @@ Statistics::endPhase(Phase phase)
phaseEnds[phase] = PRMJ_Now(); phaseEnds[phase] = PRMJ_Now();
phaseTimes[phase] += phaseEnds[phase] - phaseStarts[phase]; phaseTimes[phase] += phaseEnds[phase] - phaseStarts[phase];
if (phase == gcstats::PHASE_SWEEP) { if (phase == gcstats::PHASE_MARK)
if (!compartment) { Probes::GCEndMarkPhase();
for (JSCompartment **c = runtime->compartments.begin(); else if (phase == gcstats::PHASE_SWEEP)
c != runtime->compartments.end(); ++c) Probes::GCEndSweepPhase();
{
Probes::GCEndSweepPhase(*c);
}
}
Probes::GCEndSweepPhase(NULL);
}
} }
} /* namespace gcstats */ } /* namespace gcstats */

View File

@ -190,21 +190,21 @@ bool releaseMemory(JSContext *cx, void *address, size_t nbytes);
* Garbage collection probes * Garbage collection probes
* *
* GC timing is tricky and at the time of this writing is changing frequently. * GC timing is tricky and at the time of this writing is changing frequently.
* GCStart(NULL)/GCEnd(NULL) are intended to bracket the entire garbage * GCStart/GCEnd are intended to bracket the entire garbage collection (either
* collection (either global or single-compartment), but a separate thread may * global or single-compartment), but a separate thread may continue doing work
* continue doing work after GCEnd. * after GCEnd.
* *
* Multiple compartments' GC will be interleaved during a global collection * Multiple compartments' GC will be interleaved during a global collection
* (eg, compartment 1 starts, compartment 2 starts, compartment 1 ends, ...) * (eg, compartment 1 starts, compartment 2 starts, compartment 1 ends, ...)
*/ */
bool GCStart(JSCompartment *compartment); bool GCStart();
bool GCEnd(JSCompartment *compartment); bool GCEnd();
bool GCStartMarkPhase(JSCompartment *compartment); bool GCStartMarkPhase();
bool GCEndMarkPhase(JSCompartment *compartment); bool GCEndMarkPhase();
bool GCStartSweepPhase(JSCompartment *compartment); bool GCStartSweepPhase();
bool GCEndSweepPhase(JSCompartment *compartment); bool GCEndSweepPhase();
/* /*
* Various APIs for inserting custom probe points. These might be used to mark * Various APIs for inserting custom probe points. These might be used to mark
@ -363,12 +363,12 @@ bool ETWCalloutBegin(JSContext *cx, JSFunction *fun);
bool ETWCalloutEnd(JSContext *cx, JSFunction *fun); bool ETWCalloutEnd(JSContext *cx, JSFunction *fun);
bool ETWAcquireMemory(JSContext *cx, void *address, size_t nbytes); bool ETWAcquireMemory(JSContext *cx, void *address, size_t nbytes);
bool ETWReleaseMemory(JSContext *cx, void *address, size_t nbytes); bool ETWReleaseMemory(JSContext *cx, void *address, size_t nbytes);
bool ETWGCStart(JSCompartment *compartment); bool ETWGCStart();
bool ETWGCEnd(JSCompartment *compartment); bool ETWGCEnd();
bool ETWGCStartMarkPhase(JSCompartment *compartment); bool ETWGCStartMarkPhase();
bool ETWGCEndMarkPhase(JSCompartment *compartment); bool ETWGCEndMarkPhase();
bool ETWGCStartSweepPhase(JSCompartment *compartment); bool ETWGCStartSweepPhase();
bool ETWGCEndSweepPhase(JSCompartment *compartment); bool ETWGCEndSweepPhase();
bool ETWCustomMark(JSString *string); bool ETWCustomMark(JSString *string);
bool ETWCustomMark(const char *string); bool ETWCustomMark(const char *string);
bool ETWCustomMark(int marker); bool ETWCustomMark(int marker);
@ -644,12 +644,12 @@ Probes::releaseMemory(JSContext *cx, void *address, size_t nbytes)
} }
inline bool inline bool
Probes::GCStart(JSCompartment *compartment) Probes::GCStart()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCStart(compartment)) if (ProfilingActive && !ETWGCStart())
ok = false; ok = false;
#endif #endif
@ -657,12 +657,12 @@ Probes::GCStart(JSCompartment *compartment)
} }
inline bool inline bool
Probes::GCEnd(JSCompartment *compartment) Probes::GCEnd()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCEnd(compartment)) if (ProfilingActive && !ETWGCEnd())
ok = false; ok = false;
#endif #endif
@ -670,12 +670,12 @@ Probes::GCEnd(JSCompartment *compartment)
} }
inline bool inline bool
Probes::GCStartMarkPhase(JSCompartment *compartment) Probes::GCStartMarkPhase()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCStartMarkPhase(compartment)) if (ProfilingActive && !ETWGCStartMarkPhase())
ok = false; ok = false;
#endif #endif
@ -683,12 +683,12 @@ Probes::GCStartMarkPhase(JSCompartment *compartment)
} }
inline bool inline bool
Probes::GCEndMarkPhase(JSCompartment *compartment) Probes::GCEndMarkPhase()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCEndMarkPhase(compartment)) if (ProfilingActive && !ETWGCEndMarkPhase())
ok = false; ok = false;
#endif #endif
@ -696,12 +696,12 @@ Probes::GCEndMarkPhase(JSCompartment *compartment)
} }
inline bool inline bool
Probes::GCStartSweepPhase(JSCompartment *compartment) Probes::GCStartSweepPhase()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCStartSweepPhase(compartment)) if (ProfilingActive && !ETWGCStartSweepPhase())
ok = false; ok = false;
#endif #endif
@ -709,12 +709,12 @@ Probes::GCStartSweepPhase(JSCompartment *compartment)
} }
inline bool inline bool
Probes::GCEndSweepPhase(JSCompartment *compartment) Probes::GCEndSweepPhase()
{ {
bool ok = true; bool ok = true;
#ifdef MOZ_ETW #ifdef MOZ_ETW
if (ProfilingActive && !ETWGCEndSweepPhase(compartment)) if (ProfilingActive && !ETWGCEndSweepPhase())
ok = false; ok = false;
#endif #endif