Profiler backend news, 10 April 2013

Here is some news about work on Firefox’s built-in time profiler (SPS), and in particular the work being done to use native stack unwinding by using the in-tree copy of the Breakpad unwinding library.

There has been a lot of activity in the two and a half weeks since we got back from Paris.  Some of that has been fixing fallout from the initial patch (779291), which proved difficult to land.

The immediate goals are to have the new profiling backend available on nightly builds for desktop Linux, Android and B2G.  Currently 64- and 32-bit Linux work.  If you want to give it a try, grab one and follow the instructions shown here.

  • Benoit committed a patch (851748) to remove some of the worst code duplication resulting from the 779291 landing.  He also cleaned up some of the profiler headers (851611).
  • Currently the profiler backend is controlled by environment variables it reads at startup.  Benoit made a step towards making these configurable within the GUI (856331).
  • One current problem is that it’s difficult to establish why unwinding gives poor results.  Breakpad sometimes fails to find or read CFI information for a shared object.  But that’s difficult to diagnose because the profiler’s logging facilities are poor.  I improved Breakpad’s logging facilities somewhat (853851, 857242) so we can send diagnostic information to the Android log or Linux console.  An as-yet unactioned item is to extract CFI-coverage statistics from Breakpad (859775) so as to make it obvious where objects lack adequate CFI.
  • Another problem that quickly appeared is that, as a last-ditch measure, Breakpad will try to unwind using stack scanning.  This is inherently imprecise and often adds non-existent frames to the trace, which seriously confuses the profile results.  I added a patch (855977) to disable stack scanning by default, but allows it to be selectively re-enabled if required.
  • There was some evaluation of unwinding ability on desktop Linux (855466).  64-bit works well; 32-bit works, but not so well, for reasons that are not yet entirely clear.
  • There is ongoing work to allow the profiler to work well on Android nightlies.  The problem is that nightlies use Mike Hommey’s alternative runtime linker (faulty.lib) and that requires some plumbing work to allow Breakpad to read unwind information direct out of the APK file.  Currently we have a proof of concept patch (802240) that appears to work, but requires some revision before landing.
  • There was investigation of a problem causing Firefox to livelock when starting any external program (837390).  This seems to be a bad interaction between the fork() syscall and the profiler signals.  An initial patch was posted.

Ongoing activities include: finishing up support for faulty.lib on Android, fixing the hang-at-fork problem, and trying to get a handle on why Breakpad gives us poorer unwind results than we expect, especially when doing frame-pointer based unwinding.