Bug 1462784 - Add the list of categories into the profile JSON and bump the version to 11. r=njn

MozReview-Commit-ID: 1g4WqsWFFbg

--HG--
extra : rebase_source : 0db0496060d4d48deee52cb5eef582802cdaf708
This commit is contained in:
Markus Stange 2018-05-25 17:28:39 -04:00
Родитель f49ebb6920
Коммит 1b73b9762e
1 изменённых файлов: 45 добавлений и 1 удалений

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

@ -1558,13 +1558,53 @@ StreamTaskTracer(PSLockRef aLock, SpliceableJSONWriter& aWriter)
#endif
}
static void
StreamCategories(SpliceableJSONWriter& aWriter)
{
// Same order as ProfilingStackFrame::Category.
// The list of available color names is:
// transparent, grey, purple, yellow, orange, lightblue, green, blue, magenta
aWriter.Start();
aWriter.StringProperty("name", "Idle");
aWriter.StringProperty("color", "transparent");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "Other");
aWriter.StringProperty("color", "grey");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "Layout");
aWriter.StringProperty("color", "purple");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "JavaScript");
aWriter.StringProperty("color", "yellow");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "GC / CC");
aWriter.StringProperty("color", "orange");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "Network");
aWriter.StringProperty("color", "lightblue");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "Graphics");
aWriter.StringProperty("color", "green");
aWriter.EndObject();
aWriter.Start();
aWriter.StringProperty("name", "DOM");
aWriter.StringProperty("color", "blue");
aWriter.EndObject();
}
static void
StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
bool aIsShuttingDown)
{
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
aWriter.IntProperty("version", 10);
aWriter.IntProperty("version", 11);
// The "startTime" field holds the number of milliseconds since midnight
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
@ -1582,6 +1622,10 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
aWriter.NullProperty("shutdownTime");
}
aWriter.StartArrayProperty("categories");
StreamCategories(aWriter);
aWriter.EndArray();
if (!NS_IsMainThread()) {
// Leave the rest of the properties out if we're not on the main thread.
// At the moment, the only case in which this function is called on a