Bug 1517409 - (part 4) Add a postCapacity measurement r=jonco

Alternative version of part 4 which does not add new telemetry.

--HG--
extra : rebase_source : fa733a8d1394e1eca4c9f43e0c8ee1c250e736a3
extra : histedit_source : fa838e0cdbaf9c287a9997a2d85f2aa773920987%2Ccbc0208c43057dc5f8424281d90a08d9265d9fbe
This commit is contained in:
Paul Bone 2019-01-17 16:29:10 +11:00
Родитель 01b779d015
Коммит 7cace07078
2 изменённых файлов: 13 добавлений и 5 удалений

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

@ -606,7 +606,7 @@ UniqueChars Statistics::renderJsonMessage(uint64_t timestamp, Statistics::JSONUs
json.beginObject();
json.property("status", "completed"); // JSON Key #1
formatJsonDescription(timestamp, json); // #2-22
formatJsonDescription(timestamp, json, use); // #2-22
if (use == Statistics::JSONUse::TELEMETRY) {
json.beginListProperty("slices_list"); // #23
@ -626,7 +626,8 @@ UniqueChars Statistics::renderJsonMessage(uint64_t timestamp, Statistics::JSONUs
}
void Statistics::formatJsonDescription(uint64_t timestamp,
JSONPrinter& json) const {
JSONPrinter& json,
JSONUse use) const {
// If you change JSON properties here, please update:
// Telemetry ping code:
// toolkit/components/telemetry/other/GCTelemetry.jsm
@ -676,6 +677,10 @@ void Statistics::formatJsonDescription(uint64_t timestamp,
ExplainAbortReason(nonincrementalReason_)); // #16
}
json.property("allocated_bytes", preHeapSize); // #17
if (use == Statistics::JSONUse::PROFILER) {
json.property("post_heap_size", postHeapSize);
}
uint32_t addedChunks = getCount(COUNT_NEW_CHUNK);
if (addedChunks) {
json.property("added_chunks", addedChunks); // #18
@ -742,6 +747,7 @@ Statistics::Statistics(JSRuntime* rt)
nonincrementalReason_(gc::AbortReason::None),
allocsSinceMinorGC({0, 0}),
preHeapSize(0),
postHeapSize(0),
thresholdTriggered(false),
triggerAmount(0.0),
triggerThreshold(0.0),
@ -978,6 +984,7 @@ void Statistics::beginGC(JSGCInvocationKind kind) {
void Statistics::endGC() {
TimeDuration sccTotal, sccLongest;
sccDurations(&sccTotal, &sccLongest);
postHeapSize = runtime->gc.heapSize.gcBytes();
runtime->addTelemetry(JS_TELEMETRY_GC_IS_ZONE_GC,
!zoneStats.isFullCollection());

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

@ -292,7 +292,7 @@ struct Statistics {
};
// Return JSON for a whole major GC. If use == PROFILER then
// detailed per-slice data will be included.
// detailed per-slice data and some other fields will be included.
UniqueChars renderJsonMessage(uint64_t timestamp, JSONUse use) const;
// Return JSON for the timings of just the given slice.
@ -360,8 +360,9 @@ struct Statistics {
uint32_t tenured;
} allocsSinceMinorGC;
/* Heap size before the GC started. */
/* Heap size before and after the GC ran. */
size_t preHeapSize;
size_t postHeapSize;
/* If the GC was triggered by exceeding some threshold, record the
* threshold and the value that exceeded it. */
@ -443,7 +444,7 @@ struct Statistics {
UniqueChars formatDetailedPhaseTimes(const PhaseTimeTable& phaseTimes) const;
UniqueChars formatDetailedTotals() const;
void formatJsonDescription(uint64_t timestamp, JSONPrinter&) const;
void formatJsonDescription(uint64_t timestamp, JSONPrinter&, JSONUse) const;
void formatJsonSliceDescription(unsigned i, const SliceData& slice,
JSONPrinter&) const;
void formatJsonPhaseTimes(const PhaseTimeTable& phaseTimes,