Correlate C++ profiling with event loop non-responsiveness

RESOLVED FIXED

Status

()

Core
Gecko Profiler
RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: ted, Assigned: BenWa)

Tracking

(Depends on: 1 bug, Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
We'd like to be able to determine what is causing the slowdown when the event loop is non-responsive. bug 606574 added some instrumentation that gives us this data, but we should be able to tie into a profiler to see what C++ is executing at those times. I have two possibilities here:

1) Post-processing, run a profiler over the entire session + the responsiveness logging, and correlate the results. I'm not sure if this is possible with the profilers we have to deal with.
2) Modify the instrumentation code to only wait 50ms for a response, and trigger the profiler start/stop internally, so we only sample the non-responsive portions of the app.
Blocks: 651580
(Reporter)

Comment 1

6 years ago
I tried working with my existing code + the JS_StopProfiling API here to get Shark samples, but I didn't have any luck. I wanted to use Shark in "WTF" mode, where it constantly records and the "stop profiling" command signals it to save the last N samples, but I couldn't seem to get that to work. I'm guessing I'll have to take the #2 approach I described above and actually modify the instrumentation to wait no more than 50ms and then start profiling.
(Assignee)

Comment 2

6 years ago
DTPerformanceSession on OS X should allow us to programmatic start/stop a profiling session and dump it to disk for it to be read in by instrument. Also see Bug 667036. I would like for this to be integrated to dump profiling sessions for each tp5 page load.
Related: see bug 677985. It adds an API for tracking all native functions called from JS. It's a companion to bug 507012, which tracks all calls to JS (and at times pretended to give some info on native calls, but it was never correct nor complete.) Ted, bug 677985 should implement what you wanted when you sent me mail several months ago about missing many native calls.
Depends on: 677985
(Assignee)

Comment 4

6 years ago
I've had some success integrating the work from bug 606574 with the profiler from bug 683229. I'm going to take this bug in that direction. If you can think of an alternative let us know.

See my blog post for more details:
http://benoitgirard.wordpress.com/2011/11/08/firefox-built-in-profiler/
Assignee: nobody → bgirard
Status: NEW → ASSIGNED
(Assignee)

Updated

6 years ago
Depends on: 700754
If this helps guide this process: I'd like to take this data and display it in an about:responsiveness page, similar to about:memory.

When logging is enabled, you could say things like:

"Show me all event loop hangs from the past hour, limiting stacks to depth 4 and sorting by [sum over all delays [length of this delay] ^ 2]."
(Assignee)

Comment 6

6 years ago
That sounds great. We're waiting on the built in profiler to be ported to windows/mac before continuing on this work. We plan on having an extension that would reports hangs and show you profile information.
What work is left to do?

Even if this data were Linux-only, it would be *huge*.
(Assignee)

Comment 8

6 years ago
Once we finish the ports well be working on the html/js front end. Ideally we would have stack walking were possible but I think we will post pone that for now to get something usable.

Updated

5 years ago
Blocks: 707391
No longer blocks: 651580
The new profiler (bug 713227 and friends) will fix this.
(Assignee)

Comment 10

5 years ago
The profiler landed, and we've been sucessfully using this on all platforms.
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

4 years ago
Component: General → Gecko Profiler
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.