Bug 1386511 - Revise the format of the GC profiler markers. r=jonco

This commit is contained in:
Paul Bone 2017-08-23 14:58:44 +10:00
Родитель 7c69d69eb3
Коммит 7746cd0200
4 изменённых файлов: 23 добавлений и 8 удалений

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

@ -487,20 +487,22 @@ js::Nursery::renderProfileJSON(JSONPrinter& json) const
// requested. (And as a public API, this function should not crash in
// such a case.)
json.beginObject();
json.property("status", "no collection");
json.property("status", "nursery empty");
json.endObject();
return;
}
json.beginObject();
json.property("status", "complete");
json.property("reason", JS::gcreason::ExplainReason(previousGC.reason));
json.property("bytes_tenured", previousGC.tenuredBytes);
json.floatProperty("promotion_rate", calcPromotionRate(nullptr), 0);
json.property("nursery_bytes", previousGC.nurseryUsedBytes);
json.property("new_nursery_bytes", numChunks() * ChunkSize);
json.property("bytes_used", previousGC.nurseryUsedBytes);
json.property("cur_capacity", previousGC.nurseryCapacity);
json.property("new_capacity", spaceToEnd());
json.beginObjectProperty("timings");
json.beginObjectProperty("phase_times");
#define EXTRACT_NAME(name, text) #name,
static const char* names[] = {

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

@ -553,6 +553,14 @@ Statistics::renderNurseryJson(JSRuntime* rt) const
UniqueChars
Statistics::renderJsonMessage(uint64_t timestamp, bool includeSlices) const
{
/*
* The format of the JSON message is specified by the GCMajorMarkerPayload
* type in perf.html
* https://github.com/devtools-html/perf.html/blob/master/src/types/markers.js#L62
*
* All the properties listed here are created within the timings property
* of the GCMajor marker.
*/
if (aborted)
return DuplicateString("{status:\"aborted\"}"); // May return nullptr
@ -562,10 +570,11 @@ Statistics::renderJsonMessage(uint64_t timestamp, bool includeSlices) const
JSONPrinter json(printer);
json.beginObject();
json.property("status", "completed");
formatJsonDescription(timestamp, json);
if (includeSlices) {
json.beginListProperty("slices");
json.beginListProperty("slices_list");
for (unsigned i = 0; i < slices_.length(); i++)
formatJsonSlice(i, json);
json.endList();
@ -609,11 +618,13 @@ Statistics::formatJsonDescription(uint64_t timestamp, JSONPrinter& json) const
json.property("scc_sweep_max_pause", sccLongest, JSONPrinter::MILLISECONDS);
json.property("nonincremental_reason", ExplainAbortReason(nonincrementalReason_));
json.property("allocated", uint64_t(preBytes) / 1024 / 1024);
json.property("allocated", uint64_t(preBytes)/1024/1024);
json.property("allocated_bytes", preBytes);
json.property("added_chunks", getCount(STAT_NEW_CHUNK));
json.property("removed_chunks", getCount(STAT_DESTROY_CHUNK));
json.property("major_gc_number", startingMajorGCNumber);
json.property("minor_gc_number", startingMinorGCNumber);
json.property("slice_number", startingSliceNumber);
}
void
@ -879,6 +890,7 @@ Statistics::beginGC(JSGCInvocationKind kind)
preBytes = runtime->gc.usage.gcBytes();
startingMajorGCNumber = runtime->gc.majorGCCount();
startingSliceNumber = runtime->gc.gcNumber();
}
void

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

@ -314,6 +314,7 @@ struct Statistics
/* GC numbers as of the beginning of the collection. */
uint64_t startingMinorGCNumber;
uint64_t startingMajorGCNumber;
uint64_t startingSliceNumber;
/* Records the maximum GC pause in an API-controlled interval (in us). */
mutable TimeDuration maxPauseInInterval;

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

@ -1447,7 +1447,7 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
{
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
aWriter.IntProperty("version", 8);
aWriter.IntProperty("version", 9);
// The "startTime" field holds the number of milliseconds since midnight
// January 1, 1970 GMT. This grotty code computes (Now - (Now -