Bug 1778014 - Handle perfstats/telemetry case where GC starts after its deadline has passed r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D152661
This commit is contained in:
Steve Fink 2022-08-08 17:28:25 +00:00
parent 194e762e3c
commit 860bbb00d6

View File

@ -249,10 +249,13 @@ void CCGCScheduler::NoteGCSliceEnd(TimeStamp aStart, TimeStamp aEnd) {
TimeDuration sliceDuration = aEnd - aStart;
PerfStats::RecordMeasurement(PerfStats::Metric::MajorGC, sliceDuration);
// Compute how much GC time was spent in predicted-to-be-idle time.
// Compute how much GC time was spent in predicted-to-be-idle time. In the
// unlikely event that the slice started after the deadline had already
// passed, treat the entire slice as non-idle.
TimeDuration nonIdleDuration;
bool startedIdle =
mTriggeredGCDeadline.isSome() && !mTriggeredGCDeadline->IsNull();
bool startedIdle = mTriggeredGCDeadline.isSome() &&
!mTriggeredGCDeadline->IsNull() &&
*mTriggeredGCDeadline > aStart;
if (!startedIdle) {
nonIdleDuration = sliceDuration;
} else {