зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557789 - Expose subcategory information in the profile JSON. r=njn
This was reviewed before in bug 1500692. Differential Revision: https://phabricator.services.mozilla.com/D11338 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b92a191709
Коммит
053b6b369b
|
@ -326,7 +326,8 @@ void UniqueStacks::StreamNonJITFrame(const FrameKey& aFrame) {
|
|||
OPTIMIZATIONS = 3,
|
||||
LINE = 4,
|
||||
COLUMN = 5,
|
||||
CATEGORY = 6
|
||||
CATEGORY = 6,
|
||||
SUBCATEGORY = 7
|
||||
};
|
||||
|
||||
AutoArraySchemaWriter writer(mFrameTableWriter, *mUniqueStrings);
|
||||
|
@ -344,6 +345,7 @@ void UniqueStacks::StreamNonJITFrame(const FrameKey& aFrame) {
|
|||
const ProfilingCategoryPairInfo& info =
|
||||
GetProfilingCategoryPairInfo(*data.mCategoryPair);
|
||||
writer.IntElement(CATEGORY, uint32_t(info.mCategory));
|
||||
writer.IntElement(SUBCATEGORY, info.mSubcategoryIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -344,11 +344,14 @@ class UniqueStacks {
|
|||
// "schema":
|
||||
// {
|
||||
// "location": 0, /* index into stringTable */
|
||||
// "implementation": 1, /* index into stringTable */
|
||||
// "optimizations": 2, /* arbitrary JSON */
|
||||
// "line": 3, /* number */
|
||||
// "column": 4, /* number */
|
||||
// "category": 5 /* number */
|
||||
// "relevantForJS": 1, /* bool */
|
||||
// "implementation": 2, /* index into stringTable */
|
||||
// "optimizations": 3, /* arbitrary JSON */
|
||||
// "line": 4, /* number */
|
||||
// "column": 5, /* number */
|
||||
// "category": 6 /* index into profile.meta.categories */
|
||||
// "subcategory": 7 /* index into
|
||||
// profile.meta.categories[category].subcategories */
|
||||
// },
|
||||
// "data":
|
||||
// [
|
||||
|
|
|
@ -64,6 +64,7 @@ void ProfiledThreadData::StreamJSON(const ProfileBuffer& aBuffer,
|
|||
schema.WriteField("line");
|
||||
schema.WriteField("column");
|
||||
schema.WriteField("category");
|
||||
schema.WriteField("subcategory");
|
||||
}
|
||||
|
||||
aWriter.StartArrayProperty("data");
|
||||
|
|
|
@ -1497,14 +1497,35 @@ void AppendSharedLibraries(JSONWriter& aWriter) {
|
|||
}
|
||||
|
||||
static void StreamCategories(SpliceableJSONWriter& aWriter) {
|
||||
// Same order as ProfilingCategory.
|
||||
// Same order as ProfilingCategory. Format:
|
||||
// [
|
||||
// {
|
||||
// name: "Idle",
|
||||
// color: "transparent",
|
||||
// subcategories: ["Other"],
|
||||
// },
|
||||
// {
|
||||
// name: "Other",
|
||||
// color: "grey",
|
||||
// subcategories: [
|
||||
// "JSM loading",
|
||||
// "Subprocess launching",
|
||||
// "DLL loading"
|
||||
// ]
|
||||
// },
|
||||
// ...
|
||||
// ]
|
||||
|
||||
# define CATEGORY_JSON_BEGIN_CATEGORY(name, labelAsString, color) \
|
||||
aWriter.Start(); \
|
||||
aWriter.StringProperty("name", labelAsString); \
|
||||
aWriter.StringProperty("color", color);
|
||||
# define CATEGORY_JSON_SUBCATEGORY(category, name, labelAsString)
|
||||
# define CATEGORY_JSON_END_CATEGORY aWriter.EndObject();
|
||||
aWriter.StringProperty("color", color); \
|
||||
aWriter.StartArrayProperty("subcategories");
|
||||
# define CATEGORY_JSON_SUBCATEGORY(supercategory, name, labelAsString) \
|
||||
aWriter.StringElement(labelAsString);
|
||||
# define CATEGORY_JSON_END_CATEGORY \
|
||||
aWriter.EndArray(); \
|
||||
aWriter.EndObject();
|
||||
|
||||
BASE_PROFILING_CATEGORY_LIST(CATEGORY_JSON_BEGIN_CATEGORY,
|
||||
CATEGORY_JSON_SUBCATEGORY,
|
||||
|
@ -1522,7 +1543,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
|
|||
bool aIsShuttingDown) {
|
||||
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
||||
|
||||
aWriter.IntProperty("version", 15);
|
||||
aWriter.IntProperty("version", 16);
|
||||
|
||||
// The "startTime" field holds the number of milliseconds since midnight
|
||||
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
||||
|
|
|
@ -484,7 +484,8 @@ void UniqueStacks::StreamNonJITFrame(const FrameKey& aFrame) {
|
|||
OPTIMIZATIONS = 3,
|
||||
LINE = 4,
|
||||
COLUMN = 5,
|
||||
CATEGORY = 6
|
||||
CATEGORY = 6,
|
||||
SUBCATEGORY = 7
|
||||
};
|
||||
|
||||
AutoArraySchemaWriter writer(mFrameTableWriter, *mUniqueStrings);
|
||||
|
@ -502,6 +503,7 @@ void UniqueStacks::StreamNonJITFrame(const FrameKey& aFrame) {
|
|||
const JS::ProfilingCategoryPairInfo& info =
|
||||
JS::GetProfilingCategoryPairInfo(*data.mCategoryPair);
|
||||
writer.IntElement(CATEGORY, uint32_t(info.mCategory));
|
||||
writer.IntElement(SUBCATEGORY, info.mSubcategoryIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,7 +605,8 @@ static void StreamJITFrame(JSContext* aContext, SpliceableJSONWriter& aWriter,
|
|||
OPTIMIZATIONS = 3,
|
||||
LINE = 4,
|
||||
COLUMN = 5,
|
||||
CATEGORY = 6
|
||||
CATEGORY = 6,
|
||||
SUBCATEGORY = 7
|
||||
};
|
||||
|
||||
AutoArraySchemaWriter writer(aWriter, aUniqueStrings);
|
||||
|
@ -626,6 +629,11 @@ static void StreamJITFrame(JSContext* aContext, SpliceableJSONWriter& aWriter,
|
|||
aJITFrame);
|
||||
});
|
||||
}
|
||||
|
||||
const JS::ProfilingCategoryPairInfo& info =
|
||||
JS::GetProfilingCategoryPairInfo(JS::ProfilingCategoryPair::JS);
|
||||
writer.IntElement(CATEGORY, uint32_t(info.mCategory));
|
||||
writer.IntElement(SUBCATEGORY, info.mSubcategoryIndex);
|
||||
}
|
||||
|
||||
struct CStringWriteFunc : public JSONWriteFunc {
|
||||
|
|
|
@ -469,11 +469,14 @@ class UniqueStacks {
|
|||
// "schema":
|
||||
// {
|
||||
// "location": 0, /* index into stringTable */
|
||||
// "implementation": 1, /* index into stringTable */
|
||||
// "optimizations": 2, /* arbitrary JSON */
|
||||
// "line": 3, /* number */
|
||||
// "column": 4, /* number */
|
||||
// "category": 5 /* number */
|
||||
// "relevantForJS": 1, /* bool */
|
||||
// "implementation": 2, /* index into stringTable */
|
||||
// "optimizations": 3, /* arbitrary JSON */
|
||||
// "line": 4, /* number */
|
||||
// "column": 5, /* number */
|
||||
// "category": 6 /* index into profile.meta.categories */
|
||||
// "subcategory": 7 /* index into
|
||||
// profile.meta.categories[category].subcategories */
|
||||
// },
|
||||
// "data":
|
||||
// [
|
||||
|
|
|
@ -87,6 +87,7 @@ void ProfiledThreadData::StreamJSON(const ProfileBuffer& aBuffer,
|
|||
schema.WriteField("line");
|
||||
schema.WriteField("column");
|
||||
schema.WriteField("category");
|
||||
schema.WriteField("subcategory");
|
||||
}
|
||||
|
||||
aWriter.StartArrayProperty("data");
|
||||
|
|
|
@ -1842,14 +1842,35 @@ static void StreamTaskTracer(PSLockRef aLock, SpliceableJSONWriter& aWriter) {
|
|||
}
|
||||
|
||||
static void StreamCategories(SpliceableJSONWriter& aWriter) {
|
||||
// Same order as ProfilingCategory.
|
||||
// Same order as ProfilingCategory. Format:
|
||||
// [
|
||||
// {
|
||||
// name: "Idle",
|
||||
// color: "transparent",
|
||||
// subcategories: ["Other"],
|
||||
// },
|
||||
// {
|
||||
// name: "Other",
|
||||
// color: "grey",
|
||||
// subcategories: [
|
||||
// "JSM loading",
|
||||
// "Subprocess launching",
|
||||
// "DLL loading"
|
||||
// ]
|
||||
// },
|
||||
// ...
|
||||
// ]
|
||||
|
||||
#define CATEGORY_JSON_BEGIN_CATEGORY(name, labelAsString, color) \
|
||||
aWriter.Start(); \
|
||||
aWriter.StringProperty("name", labelAsString); \
|
||||
aWriter.StringProperty("color", color);
|
||||
#define CATEGORY_JSON_SUBCATEGORY(category, name, labelAsString)
|
||||
#define CATEGORY_JSON_END_CATEGORY aWriter.EndObject();
|
||||
aWriter.StringProperty("color", color); \
|
||||
aWriter.StartArrayProperty("subcategories");
|
||||
#define CATEGORY_JSON_SUBCATEGORY(supercategory, name, labelAsString) \
|
||||
aWriter.StringElement(labelAsString);
|
||||
#define CATEGORY_JSON_END_CATEGORY \
|
||||
aWriter.EndArray(); \
|
||||
aWriter.EndObject();
|
||||
|
||||
PROFILING_CATEGORY_LIST(CATEGORY_JSON_BEGIN_CATEGORY,
|
||||
CATEGORY_JSON_SUBCATEGORY, CATEGORY_JSON_END_CATEGORY)
|
||||
|
@ -1864,7 +1885,7 @@ static void StreamMetaJSCustomObject(PSLockRef aLock,
|
|||
bool aIsShuttingDown) {
|
||||
MOZ_RELEASE_ASSERT(CorePS::Exists() && ActivePS::Exists(aLock));
|
||||
|
||||
aWriter.IntProperty("version", 15);
|
||||
aWriter.IntProperty("version", 16);
|
||||
|
||||
// The "startTime" field holds the number of milliseconds since midnight
|
||||
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
|
||||
|
|
Загрузка…
Ссылка в новой задаче