firefox-devtools / profiler

Firefox Profiler — Web app for Firefox performance analysis
https://profiler.firefox.com
Mozilla Public License 2.0
1.14k stars 372 forks source link

Support the "stack-chart" option for a marker display location #5018

Open julienw opened 3 weeks ago

julienw commented 3 weeks ago

When implementing the marker schema, this display location "stack-chart" has been added in https://github.com/firefox-devtools/profiler/blob/a43a86c1c6fd14e26fe146eab4f2fb9b05920e92/src/types/markers.js#L100-L101. The goal is to make it possible to configure markers to be displayed in the stack-chart. Currently it's hardcoded for UserTiming only.

This shouldn't be too hard. Currently it's done this way:

The data for the stack chart is computed with this when the option "show user timing" is checked: https://github.com/firefox-devtools/profiler/blob/a43a86c1c6fd14e26fe146eab4f2fb9b05920e92/src/selectors/per-thread/composed.js#L101-L115

The markers to be displayed are computed with: https://github.com/firefox-devtools/profiler/blob/a43a86c1c6fd14e26fe146eab4f2fb9b05920e92/src/selectors/per-thread/markers.js#L540-L549 https://github.com/firefox-devtools/profiler/blob/a43a86c1c6fd14e26fe146eab4f2fb9b05920e92/src/selectors/per-thread/markers.js#L342-L346

Instead of isUserTimingMarker we should use something like: https://github.com/firefox-devtools/profiler/blob/a43a86c1c6fd14e26fe146eab4f2fb9b05920e92/src/selectors/per-thread/markers.js#L398-L413 With "stack-chart" instead of "marker-table".

And probably rename some of the functions for consistency.

Here is a profile with such a marker: https://share.firefox.dev/45a8ISC

julienw commented 3 weeks ago

see https://phabricator.services.mozilla.com/D212718 for the patch related to this on the devtools side.