Bug 1322560 - Report GC major/minor numbers in JSON, r=jonco

--HG--
extra : rebase_source : 4b391860200c9c9b77dbc16e9de1cad6fdb60668
extra : source : 3b458dc06af44ee788cb86dee6611b66ce0ebe5b
This commit is contained in:
Steve Fink 2017-04-25 13:24:19 -07:00
Родитель 4b00aab714
Коммит 784adc799a
2 изменённых файлов: 12 добавлений и 2 удалений

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

@ -741,7 +741,9 @@ Statistics::formatJsonDescription(uint64_t timestamp) const
"\"nonincremental_reason\":\"%s\"," "\"nonincremental_reason\":\"%s\","
"\"allocated\":%u," "\"allocated\":%u,"
"\"added_chunks\":%d," "\"added_chunks\":%d,"
"\"removed_chunks\":%d,"; "\"removed_chunks\":%d,"
"\"major_gc_number\":%llu,"
"\"minor_gc_number\":%llu,";
char buffer[1024]; char buffer[1024];
SprintfLiteral(buffer, format, SprintfLiteral(buffer, format,
(unsigned long long)timestamp, (unsigned long long)timestamp,
@ -760,7 +762,9 @@ Statistics::formatJsonDescription(uint64_t timestamp) const
ExplainAbortReason(nonincrementalReason_), ExplainAbortReason(nonincrementalReason_),
unsigned(preBytes / 1024 / 1024), unsigned(preBytes / 1024 / 1024),
getCount(STAT_NEW_CHUNK), getCount(STAT_NEW_CHUNK),
getCount(STAT_DESTROY_CHUNK)); getCount(STAT_DESTROY_CHUNK),
startingMajorGCNumber,
startingMinorGCNumber);
return DuplicateString(buffer); return DuplicateString(buffer);
} }
@ -1072,6 +1076,7 @@ Statistics::beginGC(JSGCInvocationKind kind)
nonincrementalReason_ = gc::AbortReason::None; nonincrementalReason_ = gc::AbortReason::None;
preBytes = runtime->gc.usage.gcBytes(); preBytes = runtime->gc.usage.gcBytes();
startingMajorGCNumber = runtime->gc.majorGCCount();
} }
void void
@ -1125,6 +1130,7 @@ void
Statistics::beginNurseryCollection(JS::gcreason::Reason reason) Statistics::beginNurseryCollection(JS::gcreason::Reason reason)
{ {
count(STAT_MINOR_GC); count(STAT_MINOR_GC);
startingMinorGCNumber = runtime->gc.minorGCCount();
if (nurseryCollectionCallback) { if (nurseryCollectionCallback) {
(*nurseryCollectionCallback)(TlsContext.get(), (*nurseryCollectionCallback)(TlsContext.get(),
JS::GCNurseryProgress::GC_NURSERY_COLLECTION_START, JS::GCNurseryProgress::GC_NURSERY_COLLECTION_START,

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

@ -386,6 +386,10 @@ struct Statistics
/* Allocated space before the GC started. */ /* Allocated space before the GC started. */
size_t preBytes; 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). */ /* Records the maximum GC pause in an API-controlled interval (in us). */
mutable TimeDuration maxPauseInInterval; mutable TimeDuration maxPauseInInterval;