Profiler backend news, 3 June 2013

Since the last report, work has focused on making multithreaded profiling more usable, using ARM EXIDX unwind data for Android nightlies, and more analysis of unwind failures.  The latter two lines of investigation happened concurrently because there was some doubt as to how good EXIDX is, so I wanted to find out to what extent unwind failures were caused by EXIDX limitations as opposed to other problems.

Multithreaded profiling:

  • Benoit worked on facilities to select threads to be profiled by name (873914) and improved the names of web worker threads (865885).
  • Benoit also improved controllability of the profiler using environment variables (873915), which might be important for profiling B2G.

Unwind quality:

  • I fixed a problem (872496) caused by the way threads register their stacks for profiling.  They need to do it earlier.  This problem affects not only EXIDX unwinding, but also CFI and frame-pointer too.  I also noticed that native unwinds for Linux nightlies had regressed recently, for the same reason.
  • The simple unwind-stats-gathering patch that landed a while back  (863705) proved very useful in figuring this out.

EXIDX:

  • There was investigation into whether EXIDX is a suitable replacement for the Dwarf CFI format on Android.  EXIDX is an ARM-specific unwind data format, and has the advantage of being compact.  Including complete EXIDX unwind information in Android nightlies  increases the .APK size from 28.8MB to only 30.7MB, which is an excellent result.

The concern with EXIDX is that it is designed for unwinding only at  points where C++ exceptions could possibly be thrown.  It is not designed for the “anywhere, anytime” unwinding that Dwarf CFI provides, and so is not a drop-in replacement for CFI.  In particular, EXIDX does not provide correct unwind data in function prologues and epilogues, so if the thread being sampled happens to be in either of those places, we’re out of luck.

Despite that, EXIDX unwinding does appear to work pretty well.

It might be possible to get around the prologue/epilogue problem by fiddling with the topmost frame’s PC so as to move it away from such areas.  I haven’t investigated this yet.

  • Breakpad doesn’t actually handle EXIDX right now.  I picked up an EDIDX-reading patch originally from Linaro, with an initial port into Breakpad (863475) by TedM.  The patch required some rework but is now close to being landable.
  • Turns out NSPR was not being built with EXIDX generation, so all stack traces stopped at the first NSPR frame.  872649 fixes this.