{"id":208,"date":"2013-04-30T19:04:19","date_gmt":"2013-04-30T18:04:19","guid":{"rendered":"http:\/\/blog.mozilla.org\/jseward\/?p=208"},"modified":"2013-04-30T19:04:19","modified_gmt":"2013-04-30T18:04:19","slug":"profiler-backend-news-30-april-2013","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/jseward\/2013\/04\/30\/profiler-backend-news-30-april-2013\/","title":{"rendered":"Profiler backend news, 30 April 2013"},"content":{"rendered":"<p>There has been a lot of activity since the previous report, mostly along three lines of development: multithreaded profiling, getting profiling working for Android nightlies, and improving the quality of the stack traces.<\/p>\n<p>We now have native unwinds working out-of-the-box for 32- and 64-bit Linux nightlies, and very nearly working for Android nightlies.<\/p>\n<p>Multithreaded profiling:<\/p>\n<ul>\n<li>Benoit landed a big change (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=734691\">734691<\/a>) to the profiler backend, that makes it able to profile multiple threads.\u00a0 Work is in progress (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=861863\">861863<\/a>) to update the Cleopatra GUI to match, but it has not yet landed.\u00a0 Early adopters are welcome to try out this new functionality.<\/li>\n<\/ul>\n<ul>\n<li>Benoit also landed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=788022\">788022<\/a>, which adds support for profiling Java code running on the Dalvik VM on Android.<\/li>\n<\/ul>\n<p>Getting profiling working for Android nightlies:<\/p>\n<ul>\n<li>On Android, we landed plumbing code that allows Breakpad to read debug info direct out of APK files, by interfacing with faulty.lib (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=802240\">802240<\/a>, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=861141\">861141<\/a>).<\/li>\n<\/ul>\n<ul>\n<li>On Android, we landed a 1-liner that enabled profiling on nightlies (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=863264\">863264<\/a>, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=863375\">863375<\/a>).\u00a0 Then the fun started.\u00a0 A few reftests started failing, so the patch was backed out.\u00a0 After quite some digging, it turns out that this change had the effect of changing the compile flags from &#8220;-O2&#8221; to &#8220;-O2 -fno-omit-frame-pointer&#8221;, and gcc-4.6.2 wound up miscompiling gfxFont::RunMetrics::RunMetrics() in such a way as to copy 16 bytes of uninitialised stack-allocated garbage to the start of the object it is initialising.\u00a0 Nathan Froyd suggested and landed a workaround.<\/li>\n<\/ul>\n<p>Improving the quality of native stack traces:<\/p>\n<ul>\n<li>I made a simple change that periodically shows counts of how many frames were recovered by CFI data, how many by following frame pointers, and how many by stack scanning (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=863705\">863705<\/a>).\u00a0 Using this, it is finally possible to get some idea of how well Breakpad is doing and why it sometimes produces results that are poorer than we expect.<\/li>\n<\/ul>\n<ul>\n<li>Using the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=863705\">863705<\/a> patch, I investigated unwinding behaviour on both 32- and 64-bit Linux, and concluded that we are doing well there.\u00a0 In particular, Breakpad is able to unwind using frame pointers on 32-bit Linux, which had up to that point been somewhat in doubt. Any incomplete stack traces on that platform are due to system libraries which have been compiled without frame pointers and for which there is no CFI available.\u00a0 There&#8217;s nothing we can do about them, except for resorting to stack scanning.\u00a0 As discussed in the previous posting, stack scanning gives poor results and is disabled by default.<\/li>\n<\/ul>\n<ul>\n<li>Also on the theme of diagnosing unwind problenms, I modified SPS so as to produce CFI coverage statistics (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=859775\">859775<\/a>).\u00a0 This prints extra information at debug info load time, indicating how much CFI was read and how much address range it covers.\u00a0 I had hoped to also be able to get the size of the relevant .text segment, so as to enable printing messages of the form &#8220;available CFI covers 85.7% of the text segment&#8221;.\u00a0 This unfortunately didn&#8217;t work out due to the difficulties of getting the segment size.<\/li>\n<\/ul>\n<ul>\n<li>The idea of enhancing Breakpad to use EXIDX unwind info on ARM came back to life and was generally well received.\u00a0 TedM refreshed his patch (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=863475\">863475<\/a>) and it is now waiting for further resync with our local Breakpad changes.<\/li>\n<\/ul>\n<p>Misc other fixes:<\/p>\n<ul>\n<li>A problem causing Firefox to livelock when starting any external program while the profiler is running (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=837390\">837390<\/a>) was fixed.<\/li>\n<\/ul>\n<ul>\n<li>As it stands, SPS\/breakpad will unwind up to 1024 stack frames before stopping.\u00a0 That can happen if the stack is corrupted.\u00a0 In the worst case this can potentially waste a lot of unwinder time, so we installed a 256 frame limit (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=859745\">859745<\/a>).<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There has been a lot of activity since the previous report, mostly along three lines of development: multithreaded profiling, getting profiling working for Android nightlies, and improving the quality of the stack traces. We now have native unwinds working out-of-the-box &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/jseward\/2013\/04\/30\/profiler-backend-news-30-april-2013\/\">Continue reading<\/a><\/p>\n","protected":false},"author":240,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts\/208"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}