Bug 1380967 - Add a separate reason code for minor GC performed at the start of major GC r=sfink

This commit is contained in:
Jon Coppeard 2017-07-14 19:02:09 +01:00
Родитель 873e518ea8
Коммит 5e9163c32a
4 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -74,6 +74,9 @@ JoinParallelTasksPhaseKind = PhaseKind("JOIN_PARALLEL_TASKS", "Join Parallel Tas
PhaseKindGraphRoots = [
PhaseKind("MUTATOR", "Mutator Running", 0),
PhaseKind("GC_BEGIN", "Begin Callback", 1),
PhaseKind("EVICT_NURSERY_FOR_MAJOR_GC", "Evict Nursery For Major GC", 70, [
MarkRootsPhaseKind,
]),
PhaseKind("WAIT_BACKGROUND_THREAD", "Wait Background Thread", 2),
PhaseKind("PREPARE", "Prepare For Collection", 69, [
PhaseKind("UNMARK", "Unmark", 7),

Просмотреть файл

@ -45,12 +45,21 @@ using mozilla::TimeDuration;
*/
JS_STATIC_ASSERT(JS::gcreason::NUM_TELEMETRY_REASONS >= JS::gcreason::NUM_REASONS);
static inline decltype(mozilla::MakeEnumeratedRange(PhaseKind::FIRST, PhaseKind::LIMIT))
using PhaseKindRange = decltype(mozilla::MakeEnumeratedRange(PhaseKind::FIRST, PhaseKind::LIMIT));
static inline PhaseKindRange
AllPhaseKinds()
{
return mozilla::MakeEnumeratedRange(PhaseKind::FIRST, PhaseKind::LIMIT);
}
static inline PhaseKindRange
MajorGCPhaseKinds()
{
return mozilla::MakeEnumeratedRange(PhaseKind::GC_BEGIN,
PhaseKind(size_t(PhaseKind::GC_END) + 1));
}
const char*
js::gcstats::ExplainInvocationKind(JSGCInvocationKind gckind)
{
@ -796,7 +805,7 @@ CheckSelfTime(Phase parent,
}
static PhaseKind
LongestPhaseSelfTime(const Statistics::PhaseTimeTable& times)
LongestPhaseSelfTimeInMajorGC(const Statistics::PhaseTimeTable& times)
{
// Start with total times per expanded phase, including children's times.
Statistics::PhaseTimeTable selfTimes(times);
@ -820,7 +829,7 @@ LongestPhaseSelfTime(const Statistics::PhaseTimeTable& times)
// Loop over this table to find the longest phase.
TimeDuration longestTime = 0;
PhaseKind longestPhase = PhaseKind::NONE;
for (auto i : AllPhaseKinds()) {
for (auto i : MajorGCPhaseKinds()) {
if (phaseTimes[i] > longestTime) {
longestTime = phaseTimes[i];
longestPhase = i;
@ -973,12 +982,12 @@ Statistics::endSlice()
// Record any phase that goes more than 2x over its budget.
if (sliceTime.ToMilliseconds() > 2 * budget_ms) {
reportLongestPhase(slice.phaseTimes, JS_TELEMETRY_GC_SLOW_PHASE);
reportLongestPhaseInMajorGC(slice.phaseTimes, JS_TELEMETRY_GC_SLOW_PHASE);
// If we spend a significant length of time waiting for parallel
// tasks then report the longest task.
TimeDuration joinTime = SumPhase(PhaseKind::JOIN_PARALLEL_TASKS, slice.phaseTimes);
if (joinTime.ToMilliseconds() > budget_ms)
reportLongestPhase(slice.parallelTimes, JS_TELEMETRY_GC_SLOW_TASK);
reportLongestPhaseInMajorGC(slice.parallelTimes, JS_TELEMETRY_GC_SLOW_TASK);
}
}
@ -1027,9 +1036,9 @@ Statistics::endSlice()
}
void
Statistics::reportLongestPhase(const PhaseTimeTable& times, int telemetryId)
Statistics::reportLongestPhaseInMajorGC(const PhaseTimeTable& times, int telemetryId)
{
PhaseKind longest = LongestPhaseSelfTime(times);
PhaseKind longest = LongestPhaseSelfTimeInMajorGC(times);
if (longest == PhaseKind::NONE)
return;

Просмотреть файл

@ -371,7 +371,7 @@ FOR_EACH_GC_PROFILE_TIME(DEFINE_TIME_KEY)
void sccDurations(TimeDuration* total, TimeDuration* maxPause) const;
void printStats();
void reportLongestPhase(const PhaseTimeTable& times, int telemetryId);
void reportLongestPhaseInMajorGC(const PhaseTimeTable& times, int telemetryId);
UniqueChars formatCompactSlicePhaseTimes(const PhaseTimeTable& phaseTimes) const;

Просмотреть файл

@ -6779,7 +6779,7 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason::
AutoExposeLiveCrossZoneEdges aelcze(&foundBlackGrayEdges.ref());
EvictAllNurseries(rt, reason);
minorGC(reason, gcstats::PhaseKind::EVICT_NURSERY_FOR_MAJOR_GC);
AutoTraceSession session(rt, JS::HeapState::MajorCollecting);