diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 3699f6a5ce7d..b1dadc5759aa 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -741,7 +741,9 @@ Statistics::formatJsonDescription(uint64_t timestamp) const "\"nonincremental_reason\":\"%s\"," "\"allocated\":%u," "\"added_chunks\":%d," - "\"removed_chunks\":%d,"; + "\"removed_chunks\":%d," + "\"major_gc_number\":%llu," + "\"minor_gc_number\":%llu,"; char buffer[1024]; SprintfLiteral(buffer, format, (unsigned long long)timestamp, @@ -760,7 +762,9 @@ Statistics::formatJsonDescription(uint64_t timestamp) const ExplainAbortReason(nonincrementalReason_), unsigned(preBytes / 1024 / 1024), getCount(STAT_NEW_CHUNK), - getCount(STAT_DESTROY_CHUNK)); + getCount(STAT_DESTROY_CHUNK), + startingMajorGCNumber, + startingMinorGCNumber); return DuplicateString(buffer); } @@ -1072,6 +1076,7 @@ Statistics::beginGC(JSGCInvocationKind kind) nonincrementalReason_ = gc::AbortReason::None; preBytes = runtime->gc.usage.gcBytes(); + startingMajorGCNumber = runtime->gc.majorGCCount(); } void @@ -1125,6 +1130,7 @@ void Statistics::beginNurseryCollection(JS::gcreason::Reason reason) { count(STAT_MINOR_GC); + startingMinorGCNumber = runtime->gc.minorGCCount(); if (nurseryCollectionCallback) { (*nurseryCollectionCallback)(TlsContext.get(), JS::GCNurseryProgress::GC_NURSERY_COLLECTION_START, diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 2a134e54f366..31c8c0ecadff 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -386,6 +386,10 @@ struct Statistics /* Allocated space before the GC started. */ size_t preBytes; + /* GC numbers as of the beginning of the collection. */ + uint64_t startingMinorGCNumber; + uint64_t startingMajorGCNumber; + /* Records the maximum GC pause in an API-controlled interval (in us). */ mutable TimeDuration maxPauseInInterval;