Closed Bug 1500692 Opened Last year Closed 8 months ago

gecko profiler: Add subcategories

Categories

(Core :: Gecko Profiler, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(4 files, 1 obsolete file)

At the moment our profiling stack frame categories are fairly coarse-grained. There are many scenarios where having a more fine-grained list of categories would be useful.

Here's a strawman list of subcategories:

> #define SUBCATEGORY_LIST_IDLE(SUBCATEGORY) // No subcategories
> 
> #define SUBCATEGORY_LIST_OTHER(SUBCATEGORY)                                   \
>   SUBCATEGORY(OTHER_LoadJSM, "JSM loading")                                   \
>   SUBCATEGORY(OTHER_LaunchSubprocess, "Subprocess launching")                 \
>   SUBCATEGORY(OTHER_LoadDLL, "DLL loading")
> 
> #define SUBCATEGORY_LIST_LAYOUT(SUBCATEGORY)                                  \
>   SUBCATEGORY(LAYOUT_InitialLayout, "Initial layout")                         \
>   SUBCATEGORY(LAYOUT_RefreshTick, "Refresh tick")                             \
>   SUBCATEGORY(LAYOUT_ConstructFrames, "Frame construction")                   \
>   SUBCATEGORY(LAYOUT_Reflow, "Reflow")                                        \
>   SUBCATEGORY(LAYOUT_ParseCSS, "CSS parsing")                                 \
>   SUBCATEGORY(LAYOUT_MatchSelector, "Selector matching")                      \
>   SUBCATEGORY(LAYOUT_RecomputeStyle, "Style recomputation")
> 
> #define SUBCATEGORY_LIST_JS(SUBCATEGORY)                                      \
>   SUBCATEGORY(JS_ParseScript, "Script parsing")                               \
>   SUBCATEGORY(JS_EmitScript, "Script emit")                                   \
>   SUBCATEGORY(JS_RunInterpreter, "Interpreter execution")                     \
>   SUBCATEGORY(JS_RunVM, "JS VM")                                              \
>   SUBCATEGORY(JS_RunBuiltIn, "JS built-in")                                   \
>   SUBCATEGORY(JS_CompileBaseline, "Baseline script compilation")              \
>   SUBCATEGORY(JS_RunBaseline, "Baseline execution")                           \
>   SUBCATEGORY(JS_CompileIon, "Ion script compilation")                        \
>   SUBCATEGORY(JS_RunIon, "Ion execution")                                     \
>   SUBCATEGORY(JS_CompileRegExp, "RegExp compilation")
> 
> #define SUBCATEGORY_LIST_GCCC(SUBCATEGORY)                                    \
>   SUBCATEGORY(GCCC_GarbageCollection, "Garbage collection")                   \
>   SUBCATEGORY(GCCC_GCIncrementalMarking, "Incremental marking")               \
>   SUBCATEGORY(GCCC_CycleCollection, "Cycle collection")                       \
>   SUBCATEGORY(GCCC_CCForgetSkippable, "CCForgetSkippable")
> 
> #define SUBCATEGORY_LIST_NETWORK(SUBCATEGORY) // TBD
> 
> #define SUBCATEGORY_LIST_GRAPHICS(SUBCATEGORY)                                \
>   SUBCATEGORY(GRAPHICS_BuildDisplayList, "DisplayList building")              \
>   SUBCATEGORY(GRAPHICS_MergeDisplayLists, "DisplayList merging")              \
>   SUBCATEGORY(GRAPHICS_BuildLayers, "Layer building")                         \
>   SUBCATEGORY(GRAPHICS_CreateWebRenderCommands, "WR display list creation")   \
>   SUBCATEGORY(GRAPHICS_Rasterize, "Rasterization")                            \
>   SUBCATEGORY(GRAPHICS_ImageDecode, "Image decoding")
> 
> #define SUBCATEGORY_LIST_DOM(SUBCATEGORY)                                     \
>   SUBCATEGORY(DOM_IndexedDB, "IndexedDB")                                     \
>   SUBCATEGORY(DOM_Canvas2D, "Canvas 2D")                                      \
>   SUBCATEGORY(DOM_WebGL, "WebGL")

Proposed profile JSON format:

 1. Expand the list of categories in profile.meta.categories with a list of subcategories, per category:
 
> categories: [
>   {
>     name: 'Idle',
>     color: 'transparent',
>     subcategories: [],
>   },
>   {
>     name: 'Other',
>     color: 'grey',
>     subcategories: [
>       "JSM loading",
>       "Subprocess launching",
>       "DLL loading"
>     ]
>   },
>   {
>     name: 'JavaScript',
>     color: 'yellow',
>     subcategories: [
>       "Script parsing",
>       "Script emit",
>       "Interpreter execution",
>       "JS VM",
>       ...
>     ]
>   },
>   ...
> ]

 2. Add a subcategory column to the frameTable, which contains either null or the index of the subcategory, where 0 means "the first subcategory in the subcategy list of the frame's category".
Greg, do the proposed profile JSON changes sound good to you?
Flags: needinfo?(gtatum)
Summary: Add subcategories → gecko profiler: Add subcategories
Looks good to me.
Flags: needinfo?(gtatum)
I decided to only add LAYOUT and GRAPHICS subcategories in this bug, along with the profiler infrastructure for subcategories.

I'm going to file a new bug for the JS subcategories. For those, a lot more work is necessary to get the instrumentation in the right places.
Status: NEW → ASSIGNED
The actual subcategories will be added in later patches, so that there are no
unused categories.
This is similar to AUTO_PROFILER_LABEL, but with only one argument: the category.
This reduces duplication for label frames that want just the category name as
their label: Instead of AUTO_PROFILER_LABEL("Layer building", GRAPHICS_LayerBuilding),
you can now just write AUTO_PROFILER_LABEL_CATEGORY(GRAPHICS_LayerBuilding) and
the string will automatically be taken from the category.

Depends on D11338
r?njn only because this is the first example that adds any actual subcategories.

Depends on D11339
Depends on D11340
Priority: -- → P2

I'm planning to move the part "Expose subcategory information in the profile JSON." to a separate bug, because that part requires more work on the perf.html side before it can land, and I'd prefer to land the other patches first so that they can stop bitrotting.

Attachment #9023672 - Attachment is obsolete: true
Attachment #9023673 - Attachment description: Bug 1500692 - Add an AUTO_PROFILER_LABEL_CATEGORY macro. r?njn → Bug 1500692 - Add an AUTO_PROFILER_LABEL_CATEGORY_PAIR macro. r?njn
See Also: → 1547104
Blocks: 1557789
Attachment #9023672 - Attachment description: Bug 1500692 - Expose subcategory information in the profile JSON. r?njn → Bug 1557789 - Expose subcategory information in the profile JSON. r?njn
Attachment #9023672 - Attachment is obsolete: false

Comment on attachment 9023672 [details]
Bug 1557789 - Expose subcategory information in the profile JSON. r?njn

Revision D11338 was moved to bug 1557789. Setting attachment 9023672 [details] to obsolete.

Attachment #9023672 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.