mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1306249 - Report phase with longest self time, not longest total time, r=jonco
--HG-- extra : rebase_source : 54eb82d2849cf93d8a85e9e575d72ba26321cd93
This commit is contained in:
parent
3360de184b
commit
2fbae55abc
@ -917,17 +917,42 @@ SumPhase(Phase phase, const Statistics::PhaseTimeTable times)
|
||||
}
|
||||
|
||||
static Phase
|
||||
LongestPhase(const Statistics::PhaseTimeTable times)
|
||||
LongestPhaseSelfTime(const Statistics::PhaseTimeTable times)
|
||||
{
|
||||
int64_t selfTimes[PHASE_LIMIT];
|
||||
|
||||
// Start with total times, including children's times.
|
||||
for (size_t i = 0; i < PHASE_LIMIT; ++i)
|
||||
selfTimes[i] = SumPhase(Phase(i), times);
|
||||
|
||||
// Subtract out the children's times.
|
||||
for (size_t i = 0; i < PHASE_LIMIT; ++i) {
|
||||
Phase parent = phases[i].parent;
|
||||
if (parent == PHASE_MULTI_PARENTS) {
|
||||
// Subtract out only the time for the children specific to this
|
||||
// parent.
|
||||
for (auto edge : dagChildEdges) {
|
||||
if (edge.parent == parent) {
|
||||
size_t dagSlot = phaseExtra[edge.parent].dagSlot;
|
||||
MOZ_ASSERT(selfTimes[parent] >= times[dagSlot][edge.child]);
|
||||
selfTimes[parent] -= times[dagSlot][edge.child];
|
||||
}
|
||||
}
|
||||
} else if (parent != PHASE_NO_PARENT) {
|
||||
MOZ_ASSERT(selfTimes[parent] >= selfTimes[i]);
|
||||
selfTimes[parent] -= selfTimes[i];
|
||||
}
|
||||
}
|
||||
|
||||
int64_t longestTime = 0;
|
||||
Phase longestPhase = PHASE_NONE;
|
||||
for (size_t i = 0; i < PHASE_LIMIT; ++i) {
|
||||
int64_t phaseTime = SumPhase(Phase(i), times);
|
||||
if (phaseTime > longestTime) {
|
||||
longestTime = phaseTime;
|
||||
if (selfTimes[i] > longestTime) {
|
||||
longestTime = selfTimes[i];
|
||||
longestPhase = Phase(i);
|
||||
}
|
||||
}
|
||||
|
||||
return longestPhase;
|
||||
}
|
||||
|
||||
@ -1078,7 +1103,7 @@ Statistics::endSlice()
|
||||
|
||||
// Record any phase that goes more than 2x over its budget.
|
||||
if (sliceTime > 2 * budget_ms * 1000) {
|
||||
Phase longest = LongestPhase(slices.back().phaseTimes);
|
||||
Phase longest = LongestPhaseSelfTime(slices.back().phaseTimes);
|
||||
runtime->addTelemetry(JS_TELEMETRY_GC_SLOW_PHASE, phases[longest].telemetryBucket);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user