Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 653703 - Correlate C++ profiling with event loop non-responsiveness
: Correlate C++ profiling with event loop non-responsiveness
Product: Core
Classification: Components
Component: Gecko Profiler (show other bugs)
: unspecified
: All All
: -- normal with 2 votes (vote)
: ---
Assigned To: Benoit Girard (:BenWa)
Depends on: 677985 606574 700754
Blocks: 707391
  Show dependency treegraph
Reported: 2011-04-29 05:40 PDT by Ted Mielczarek [:ted.mielczarek]
Modified: 2013-06-05 09:13 PDT (History)
22 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Ted Mielczarek [:ted.mielczarek] 2011-04-29 05:40:32 PDT
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.
Comment 1 Ted Mielczarek [:ted.mielczarek] 2011-06-27 07:47:17 PDT
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.
Comment 2 Benoit Girard (:BenWa) 2011-07-26 08:14:13 PDT
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.
Comment 3 Steve Fink [:sfink] [:s:] 2011-08-25 00:10:45 PDT
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.
Comment 4 Benoit Girard (:BenWa) 2011-11-08 11:49:39 PST
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:
Comment 5 Justin Lebar (not reading bugmail) 2011-11-26 08:30:12 PST
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]."
Comment 6 Benoit Girard (:BenWa) 2011-11-28 07:21:17 PST
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.
Comment 7 Justin Lebar (not reading bugmail) 2011-11-28 07:26:43 PST
What work is left to do?

Even if this data were Linux-only, it would be *huge*.
Comment 8 Benoit Girard (:BenWa) 2011-11-28 10:36:13 PST
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.
Comment 9 Dietrich Ayala (:dietrich) 2012-02-01 07:43:15 PST
The new profiler (bug 713227 and friends) will fix this.
Comment 10 Benoit Girard (:BenWa) 2012-04-04 14:41:15 PDT
The profiler landed, and we've been sucessfully using this on all platforms.

Note You need to log in before you can comment on or make changes to this bug.