VOOZH about

URL: https://bugzilla.mozilla.org/1895393

⇱ 1895393 - Populate the FireScrollEvent profiler marker with a stack trace of where scrolling was triggered


Closed Bug 1895393 Opened 2 years ago Closed 1 month ago

Populate the FireScrollEvent profiler marker with a stack trace of where scrolling was triggered

Populate the FireScrollEvent profiler marker with a stack trace of where scrolling was triggered
Core
Panning and Zooming
unspecified
Unspecified
Unspecified
task
Points:
---
RESOLVED FIXED
RESOLVED
FIXED
152 Branch
Iteration:
---
a11y-review
Accessibility Severity
Performance Impact
Size Estimate
Webcompat Priority
Webcompat Score
Tracking Status
firefox152 --- fixed
Tracking Status
relnote-firefox
thunderbird_esr115
thunderbird_esr140
firefox-esr115
firefox-esr140
firefox-esr153
firefox152
firefox153
firefox154
---
[lang=c++]
QA Whiteboard:
[qa-triage-done-c153/b152]
Has STR:
---
Change Request:
---
Bug Flags:
Signature:
None
This bug is publicly visible.

 

nsHTMLScrollFrame::FireScrollEvent creates a profiler marker here.

For better understanding the cause of scrolling seen in a profile, it would be helpful if this marker contained a stack trace showing where scrolling was triggered.

This would not be a stack trace for the FireScrollEvent call itself (which happens asynchronously with respect to the actual scrolling, on the next refresh driver tick), but a stack trace of the PostScrollEvent call that queued the scroll event that is fired.

Based on discussion with Markus, we should be able to collect the stack trace in PostScrollEvent and stash it for later attaching to the marker in FireScrollEvent.

An alternative approach could be to have PostScrollEvent produce its own profiler marker with a stack trace.

It would be nice to differentiate scroll anchoring.

Mentor: botond
Keywords: good-next-bug
Whiteboard: [lang=c++]
Assignee

Comment 2

1 month ago

Hi :botond, I'd like to work on this bug. The expected is to capture a stack trace in PostScrollEvent using profiler_capture_backtrace(), stash on scroll and attach using MarkerStack::TakeBacktrace() when a profiler is created in FireScrollEvent. Hope I'm in right direction.

Flags: needinfo?(botond)

(In reply to B Vignesh Sai Raghav [:vignesh-b] from comment #2)

Hi :botond, I'd like to work on this bug.

Hi, thanks for your interest!

The expected is to capture a stack trace in PostScrollEvent using profiler_capture_backtrace(), stash on scroll and attach using MarkerStack::TakeBacktrace() when a profiler is created in FireScrollEvent. Hope I'm in right direction.

Yep, I believe that's on the right track.

One detail to figure out is how to pass the backtrace into the AUTO_PROFILER_MARKER_DOCSHELL macro.

Looking at what this macro does, it constructs an object of type AutoProfilerTracing, currently using this constructor.

The constructor in question does not take a backtrace, but this one does.

So my suggestion would be to revise the AUTO_PROFILER_MARKER_DOCSHELL macro to take an additional parameter for the backtrace, and have the macro implementation forward that parameter to the AutoProfilerTracing constructor. There is no need to call MarkerStack::TakeBacktrace() directly, that's done by the constructor.

Let me know if that makes sense; I'm happy to answer any follow-up questions.

Flags: needinfo?(botond)
Assignee

Comment 4

1 month ago

Thank you for the very detailed explanation! That makes a lot of sense!

The final approach -

  1. PostScrollEvent(), capture the backtrace using profiler_capture_backtrace() and stash to ScrollEvent object.
  2. FireScrollEvent(), retrieve the backtrace from mScrollEvent.
  3. Modify AUTO_PROFILER_TRACING_MARKER_DOCSHELL to accept an additional backtrace parameter and forward it to the AutoProfilerTracing .
  4. Pass the retrieved backtrace when calling FireScrollEvent().

Happy to send a patch for review!

Flags: needinfo?(botond)

Your outline looks good to me, please go ahead.

Flags: needinfo?(botond)
Assignee: nobody → becomevsr
Status: NEW → ASSIGNED
Assignee

Updated

1 month ago
Attachment #9583824 - Attachment is patch: true
Attachment #9583824 - Attachment mime type: text/x-phabricator-request → text/plain
Attachment #9583824 - Flags: review?(botond)
Assignee

Updated

1 month ago
Attachment #9583824 - Attachment is patch: false
Attachment #9583824 - Attachment is obsolete: true
Attachment #9583824 - Flags: review?(botond)

Comment 8

1 month ago
Pushed by bballo@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8aeaf7359ed2 https://hg.mozilla.org/integration/autoland/rev/e80eebdbbe7c Populate the FireScrollEvent profiler marker with a stack trace of where scrolling was triggered r=mstange,botond

Comment 9

1 month ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.