Bug 1774651 - Add a MajorGC PerfStats metric r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D149554
This commit is contained in:
Steve Fink 2022-06-30 17:36:31 +00:00
Родитель 1ae6fdb86e
Коммит f60593707d
3 изменённых файлов: 21 добавлений и 15 удалений

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

@ -9,6 +9,7 @@
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/ProfilerMarkers.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/PerfStats.h"
#include "nsRefreshDriver.h"
/*
@ -232,6 +233,22 @@ void CCGCScheduler::NoteGCEnd() {
}
}
void CCGCScheduler::NoteGCSliceEnd(TimeDuration aSliceDuration) {
if (mMajorGCReason == JS::GCReason::NO_REASON) {
// Internally-triggered GCs do not wait for the parent's permission to
// proceed. This flag won't be checked during an incremental GC anyway,
// but it better reflects reality.
mReadyForMajorGC = true;
}
// Subsequent slices should be INTER_SLICE_GC unless they are triggered by
// something else that provides its own reason.
mMajorGCReason = JS::GCReason::INTER_SLICE_GC;
mGCUnnotifiedTotalTime += aSliceDuration;
PerfStats::RecordMeasurement(PerfStats::Metric::MajorGC, aSliceDuration);
}
void CCGCScheduler::NoteCCBegin(CCReason aReason, TimeStamp aWhen,
uint32_t aNumForgetSkippables,
uint32_t aSuspected, uint32_t aRemovedPurples) {

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

@ -288,20 +288,8 @@ class CCGCScheduler {
void NoteCCEnd(const CycleCollectorResults& aResults, TimeStamp aWhen,
mozilla::TimeDuration aMaxSliceTime);
void NoteGCSliceEnd(TimeDuration aSliceDuration) {
if (mMajorGCReason == JS::GCReason::NO_REASON) {
// Internally-triggered GCs do not wait for the parent's permission to
// proceed. This flag won't be checked during an incremental GC anyway,
// but it better reflects reality.
mReadyForMajorGC = true;
}
// Subsequent slices should be INTER_SLICE_GC unless they are triggered by
// something else that provides its own reason.
mMajorGCReason = JS::GCReason::INTER_SLICE_GC;
mGCUnnotifiedTotalTime += aSliceDuration;
}
// A single slice has completed.
void NoteGCSliceEnd(TimeDuration aSliceDuration);
bool GCRunnerFired(TimeStamp aDeadline);
bool GCRunnerFiredDoGC(TimeStamp aDeadline, const GCRunnerStep& aStep);

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

@ -47,7 +47,8 @@
MACRO(JSBC_Compression) \
MACRO(JSBC_Decompression) \
MACRO(JSBC_IO_Read) \
MACRO(JSBC_IO_Write)
MACRO(JSBC_IO_Write) \
MACRO(MajorGC)
namespace mozilla {