diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index bc10b073f669..5ec8cbb56637 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -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[] = { diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 1c9830138c91..85765348149b 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -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 diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 4ad22903be5b..f40c75ed8a21 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -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; diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 0fb894382fe4..e3c297f8d882 100755 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -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 -