Bug 1482089 - pt 3. Remove formatJsonTelemetry from GCAPI r=jonco

Also remove JSONUse since only one option is used now.

Differential Revision: https://phabricator.services.mozilla.com/D84165
This commit is contained in:
Paul Bone 2020-07-21 05:18:59 +00:00
Родитель 02be91a8b3
Коммит 6c246a3dc0
5 изменённых файлов: 16 добавлений и 43 удалений

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

@ -740,8 +740,6 @@ struct JS_PUBLIC_API GCDescription {
mozilla::TimeStamp lastSliceStart(JSContext* cx) const;
mozilla::TimeStamp lastSliceEnd(JSContext* cx) const;
char16_t* formatJSONTelemetry(JSContext* cx, uint64_t timestamp) const;
JS::UniqueChars sliceToJSONProfiler(JSContext* cx) const;
JS::UniqueChars formatJSONProfiler(JSContext* cx) const;

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

@ -8317,22 +8317,6 @@ JS::dbg::GarbageCollectionEvent::Ptr JS::GCDescription::toGCEvent(
cx->runtime()->gc.majorGCCount());
}
char16_t* JS::GCDescription::formatJSONTelemetry(JSContext* cx,
uint64_t timestamp) const {
UniqueChars cstr = cx->runtime()->gc.stats().renderJsonMessage(
timestamp, gcstats::Statistics::JSONUse::TELEMETRY);
size_t nchars = strlen(cstr.get());
UniqueTwoByteChars out(js_pod_malloc<char16_t>(nchars + 1));
if (!out) {
return nullptr;
}
out.get()[nchars] = 0;
CopyAndInflateChars(out.get(), cstr.get(), nchars);
return out.release();
}
TimeStamp JS::GCDescription::startTime(JSContext* cx) const {
return cx->runtime()->gc.stats().start();
}
@ -8356,8 +8340,7 @@ JS::UniqueChars JS::GCDescription::sliceToJSONProfiler(JSContext* cx) const {
}
JS::UniqueChars JS::GCDescription::formatJSONProfiler(JSContext* cx) const {
return cx->runtime()->gc.stats().renderJsonMessage(
0, js::gcstats::Statistics::JSONUse::PROFILER);
return cx->runtime()->gc.stats().renderJsonMessage();
}
JS_PUBLIC_API JS::UniqueChars JS::MinorGcToJSON(JSContext* cx) {

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

@ -617,8 +617,7 @@ void Statistics::writeLogMessage(const char* fmt, ...) {
}
#endif
UniqueChars Statistics::renderJsonMessage(uint64_t timestamp,
Statistics::JSONUse use) const {
UniqueChars Statistics::renderJsonMessage() const {
/*
* The format of the JSON message is specified by the GCMajorMarkerPayload
* type in profiler.firefox.com
@ -638,16 +637,10 @@ UniqueChars Statistics::renderJsonMessage(uint64_t timestamp,
JSONPrinter json(printer);
json.beginObject();
json.property("status", "completed"); // JSON Key #1
formatJsonDescription(timestamp, json, use); // #2-22
json.property("status", "completed"); // JSON Key #1
formatJsonDescription(json); // #2-22
if (use == Statistics::JSONUse::TELEMETRY) {
json.beginListProperty("slices_list"); // #23
for (unsigned i = 0; i < slices_.length(); i++) {
formatJsonSlice(i, json);
}
json.endList();
}
// Removed #23
json.beginObjectProperty("totals"); // #24
formatJsonPhaseTimes(phaseTimes, json);
@ -658,8 +651,7 @@ UniqueChars Statistics::renderJsonMessage(uint64_t timestamp,
return printer.release();
}
void Statistics::formatJsonDescription(uint64_t timestamp, JSONPrinter& json,
JSONUse use) const {
void Statistics::formatJsonDescription(JSONPrinter& json) const {
// If you change JSON properties here, please update:
// Telemetry ping code:
// toolkit/components/telemetry/other/GCTelemetry.jsm
@ -674,7 +666,10 @@ void Statistics::formatJsonDescription(uint64_t timestamp, JSONPrinter& json,
// Please also number each property to help correctly maintain the Telemetry
// ping code
json.property("timestamp", timestamp); // # JSON Key #2
// The timestamp used to be passed in by the telemetry code. The profiler
// doesn't use this field but its type system expects it. TODO: delete this
// field (https://bugzilla.mozilla.org/show_bug.cgi?id=1654155).
json.property("timestamp", 0); // # JSON Key #2
TimeDuration total, longest;
gcDuration(&total, &longest);
@ -709,9 +704,7 @@ void Statistics::formatJsonDescription(uint64_t timestamp, JSONPrinter& json,
ExplainAbortReason(nonincrementalReason_)); // #16
}
json.property("allocated_bytes", preTotalHeapBytes); // #17
if (use == Statistics::JSONUse::PROFILER) {
json.property("post_heap_size", postTotalHeapBytes);
}
json.property("post_heap_size", postTotalHeapBytes);
uint32_t addedChunks = getCount(COUNT_NEW_CHUNK);
if (addedChunks) {

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

@ -300,11 +300,11 @@ struct Statistics {
// Print total profile times on shutdown.
void printTotalProfileTimes();
enum JSONUse { TELEMETRY, PROFILER };
// These JSON strings are used by the firefox profiler to display the GC
// markers.
// Return JSON for a whole major GC. If use == PROFILER then
// detailed per-slice data and some other fields will be included.
UniqueChars renderJsonMessage(uint64_t timestamp, JSONUse use) const;
// Return JSON for a whole major GC
UniqueChars renderJsonMessage() const;
// Return JSON for the timings of just the given slice.
UniqueChars renderJsonSlice(size_t sliceNum) const;
@ -465,7 +465,7 @@ struct Statistics {
UniqueChars formatDetailedPhaseTimes(const PhaseTimeTable& phaseTimes) const;
UniqueChars formatDetailedTotals() const;
void formatJsonDescription(uint64_t timestamp, JSONPrinter&, JSONUse) const;
void formatJsonDescription(JSONPrinter&) const;
void formatJsonSliceDescription(unsigned i, const SliceData& slice,
JSONPrinter&) const;
void formatJsonPhaseTimes(const PhaseTimeTable& phaseTimes,

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

@ -24,7 +24,6 @@ static void NonIncrementalGCSliceCallback(JSContext* cx,
if (progress == GC_CYCLE_END) {
mozilla::UniquePtr<char16_t> summary(desc.formatSummaryMessage(cx));
mozilla::UniquePtr<char16_t> message(desc.formatSliceMessage(cx));
mozilla::UniquePtr<char16_t> json(desc.formatJSONTelemetry(cx, 0));
}
}