forked from mirrors/gecko-dev
Bug 1584190 - In JSON profile, counters' sample_groups should be an array of objects - r=canaltinova
profile.counters[n].sample_groups was mistakenly streamed as an object, which prevents having more than one, and goes against the published format documentation. The front-end was implemented to process the incorrect format, so it will need to be updated as well; hence the version change to 18. Differential Revision: https://phabricator.services.mozilla.com/D49867 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3846c79d32
commit
1824e6f651
4 changed files with 87 additions and 73 deletions
|
|
@ -1079,7 +1079,7 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
aWriter.StringProperty("category", base_counter->mCategory);
|
aWriter.StringProperty("category", base_counter->mCategory);
|
||||||
aWriter.StringProperty("description", base_counter->mDescription);
|
aWriter.StringProperty("description", base_counter->mDescription);
|
||||||
|
|
||||||
aWriter.StartObjectProperty("sample_groups");
|
aWriter.StartArrayProperty("sample_groups");
|
||||||
for (auto counter_iter = counter.iter(); !counter_iter.done();
|
for (auto counter_iter = counter.iter(); !counter_iter.done();
|
||||||
counter_iter.next()) {
|
counter_iter.next()) {
|
||||||
CounterKeyedSamples& samples = counter_iter.get().value();
|
CounterKeyedSamples& samples = counter_iter.get().value();
|
||||||
|
|
@ -1089,6 +1089,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aWriter.StartObjectElement();
|
||||||
|
{
|
||||||
aWriter.IntProperty("id", static_cast<int64_t>(key));
|
aWriter.IntProperty("id", static_cast<int64_t>(key));
|
||||||
aWriter.StartObjectProperty("samples");
|
aWriter.StartObjectProperty("samples");
|
||||||
{
|
{
|
||||||
|
|
@ -1103,7 +1106,8 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
uint64_t previousNumber = 0;
|
uint64_t previousNumber = 0;
|
||||||
int64_t previousCount = 0;
|
int64_t previousCount = 0;
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// Encode as deltas, and only encode if different than the last sample
|
// Encode as deltas, and only encode if different than the last
|
||||||
|
// sample
|
||||||
if (i == 0 || samples[i].mNumber != previousNumber ||
|
if (i == 0 || samples[i].mNumber != previousNumber ||
|
||||||
samples[i].mCount != previousCount) {
|
samples[i].mCount != previousCount) {
|
||||||
MOZ_ASSERT(i == 0 || samples[i].mTime >= samples[i - 1].mTime);
|
MOZ_ASSERT(i == 0 || samples[i].mTime >= samples[i - 1].mTime);
|
||||||
|
|
@ -1113,8 +1117,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
|
|
||||||
AutoArraySchemaWriter writer(aWriter);
|
AutoArraySchemaWriter writer(aWriter);
|
||||||
writer.DoubleElement(TIME, samples[i].mTime);
|
writer.DoubleElement(TIME, samples[i].mTime);
|
||||||
writer.IntElement(NUMBER, static_cast<int64_t>(samples[i].mNumber -
|
writer.IntElement(
|
||||||
previousNumber));
|
NUMBER,
|
||||||
|
static_cast<int64_t>(samples[i].mNumber - previousNumber));
|
||||||
writer.IntElement(COUNT, samples[i].mCount - previousCount);
|
writer.IntElement(COUNT, samples[i].mCount - previousCount);
|
||||||
previousNumber = samples[i].mNumber;
|
previousNumber = samples[i].mNumber;
|
||||||
previousCount = samples[i].mCount;
|
previousCount = samples[i].mCount;
|
||||||
|
|
@ -1123,7 +1128,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
aWriter.EndArray(); // data
|
aWriter.EndArray(); // data
|
||||||
aWriter.EndObject(); // samples
|
aWriter.EndObject(); // samples
|
||||||
}
|
}
|
||||||
aWriter.EndObject(); // sample groups
|
aWriter.EndObject(); // sample_groups item
|
||||||
|
}
|
||||||
|
aWriter.EndArray(); // sample groups
|
||||||
aWriter.End(); // for each counter
|
aWriter.End(); // for each counter
|
||||||
}
|
}
|
||||||
aWriter.EndArray(); // counters
|
aWriter.EndArray(); // counters
|
||||||
|
|
|
||||||
|
|
@ -1622,7 +1622,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
|
||||||
bool aIsShuttingDown) {
|
bool aIsShuttingDown) {
|
||||||
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
||||||
|
|
||||||
aWriter.IntProperty("version", 17);
|
aWriter.IntProperty("version", 18);
|
||||||
|
|
||||||
// The "startTime" field holds the number of milliseconds since midnight
|
// The "startTime" field holds the number of milliseconds since midnight
|
||||||
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
||||||
|
|
|
||||||
|
|
@ -1566,7 +1566,7 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
aWriter.StringProperty("category", base_counter->mCategory);
|
aWriter.StringProperty("category", base_counter->mCategory);
|
||||||
aWriter.StringProperty("description", base_counter->mDescription);
|
aWriter.StringProperty("description", base_counter->mDescription);
|
||||||
|
|
||||||
aWriter.StartObjectProperty("sample_groups");
|
aWriter.StartArrayProperty("sample_groups");
|
||||||
for (auto counter_iter = counter.iter(); !counter_iter.done();
|
for (auto counter_iter = counter.iter(); !counter_iter.done();
|
||||||
counter_iter.next()) {
|
counter_iter.next()) {
|
||||||
CounterKeyedSamples& samples = counter_iter.get().value();
|
CounterKeyedSamples& samples = counter_iter.get().value();
|
||||||
|
|
@ -1576,6 +1576,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aWriter.StartObjectElement();
|
||||||
|
{
|
||||||
aWriter.IntProperty("id", static_cast<int64_t>(key));
|
aWriter.IntProperty("id", static_cast<int64_t>(key));
|
||||||
aWriter.StartObjectProperty("samples");
|
aWriter.StartObjectProperty("samples");
|
||||||
{
|
{
|
||||||
|
|
@ -1590,7 +1593,8 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
uint64_t previousNumber = 0;
|
uint64_t previousNumber = 0;
|
||||||
int64_t previousCount = 0;
|
int64_t previousCount = 0;
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// Encode as deltas, and only encode if different than the last sample
|
// Encode as deltas, and only encode if different than the last
|
||||||
|
// sample
|
||||||
if (i == 0 || samples[i].mNumber != previousNumber ||
|
if (i == 0 || samples[i].mNumber != previousNumber ||
|
||||||
samples[i].mCount != previousCount) {
|
samples[i].mCount != previousCount) {
|
||||||
if (i != 0 && samples[i].mTime >= samples[i - 1].mTime) {
|
if (i != 0 && samples[i].mTime >= samples[i - 1].mTime) {
|
||||||
|
|
@ -1605,8 +1609,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
|
|
||||||
AutoArraySchemaWriter writer(aWriter);
|
AutoArraySchemaWriter writer(aWriter);
|
||||||
writer.DoubleElement(TIME, samples[i].mTime);
|
writer.DoubleElement(TIME, samples[i].mTime);
|
||||||
writer.IntElement(NUMBER, static_cast<int64_t>(samples[i].mNumber -
|
writer.IntElement(
|
||||||
previousNumber));
|
NUMBER,
|
||||||
|
static_cast<int64_t>(samples[i].mNumber - previousNumber));
|
||||||
writer.IntElement(COUNT, samples[i].mCount - previousCount);
|
writer.IntElement(COUNT, samples[i].mCount - previousCount);
|
||||||
previousNumber = samples[i].mNumber;
|
previousNumber = samples[i].mNumber;
|
||||||
previousCount = samples[i].mCount;
|
previousCount = samples[i].mCount;
|
||||||
|
|
@ -1615,7 +1620,9 @@ void ProfileBuffer::StreamCountersToJSON(SpliceableJSONWriter& aWriter,
|
||||||
aWriter.EndArray(); // data
|
aWriter.EndArray(); // data
|
||||||
aWriter.EndObject(); // samples
|
aWriter.EndObject(); // samples
|
||||||
}
|
}
|
||||||
aWriter.EndObject(); // sample groups
|
aWriter.EndObject(); // sample_groups item
|
||||||
|
}
|
||||||
|
aWriter.EndArray(); // sample groups
|
||||||
aWriter.End(); // for each counter
|
aWriter.End(); // for each counter
|
||||||
}
|
}
|
||||||
aWriter.EndArray(); // counters
|
aWriter.EndArray(); // counters
|
||||||
|
|
|
||||||
|
|
@ -2051,7 +2051,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
|
||||||
bool aIsShuttingDown) {
|
bool aIsShuttingDown) {
|
||||||
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
||||||
|
|
||||||
aWriter.IntProperty("version", 17);
|
aWriter.IntProperty("version", 18);
|
||||||
|
|
||||||
// The "startTime" field holds the number of milliseconds since midnight
|
// The "startTime" field holds the number of milliseconds since midnight
|
||||||
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue