Re: Shark failing to get entire stack

Jonathan Watt <[email protected]> Sat, 13 Nov 2010 21:24:48 +0000
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
On 13/11/2010 20:28, Mike Shaver wrote:
> On Sat, Nov 13, 2010 at 12:13 PM, Jonathan Watt <[email protected]> wrote:
>> I'm using Shark to try to profile a bug in the official FF4 beta 7 Mac build
>> which is causing Firefox to sit at 100% CPU, while minimized, with no tabs of
>> interest (as far as I can tell) open.
>>
>>        0.0%    54.6%   XUL     nsCanvasRenderingContext2D::
>>                                  DrawImage(nsIDOMElement*, float, float,
>>                                    float, float, float, float, float,
>>                                    float, unsigned char)
> 
> Are you compiling with frame pointer use enabled, such as via
> --enable-profiling? 

I didn't create this build - when I say "official" b7, I mean:

ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/4.0b7/mac/en-US/Firefox%204.0%20Beta%207.dmg

for which I'm obtaining symbols by using fetch-symbols.py:

http://hg.mozilla.org/users/jwatt_jwatt.org/fetch-symbols

The problem doesn't seem to reproduce in a build I've spun myself, and I don't
want to restart my instance of official b7 in case I have trouble reproducing
the problem again.

> Without that the profiler can't look farther
> back, and by default we omit the frame pointer on x86 in order to have
> an extra register for our code.

Last time I tried this sort of stuff on Windows I seem to remember that the
symbol and source servers allowed me to get full stacks when running release
builds. Maybe this isn't currently possible on Mac? But doesn't crash reporter
somehow figure out full stacks for mac crash reports?

>> I'm also seeing a lot of "Unknown Library" entries without symbols. For example:
>>
>>        0.0%    0.3%    XUL     js::mjit::JaegerShot(JSContext*)
>>        0.1%    0.1%    Unknown Library  0x1145ee000 [621.5KB]
>>        0.0%    0.0%    XUL      js::mjit::stubs::ValueToBoolean(js::VMFrame&)
>>        0.0%    0.0%    XUL      js::mjit::stubs::UncachedCallHelper(
>>                                   js::VMFrame&, unsigned int,
>>                                   js::mjit::stubs::UncachedCallResult*)
>>        0.0%    0.0%    Unknown Library  0x1327b3eb8 [unknown]
>>        0.0%    0.0%    Unknown Library  0x1269e61c9 [unknown]
>>        0.0%    0.0%    Unknown Library  0x1264fa228 [unknown]
>>        0.0%    0.0%    Unknown Library  0x1264f4460 [unknown]
>>        0.0%    0.0%    Unknown Library  0x1224fe2e4 [unknown]
>>        0.0%    0.0%    Unknown Library  0x11d067c9e [unknown]
>>        0.0%    0.0%    Unknown Library  0x11477febc [unknown]
>>
>> This is with KernelDebugKit mounted. Does anyone know how I can get Shark to
>> identify these libraries and find the symbols for these things too?
> 
> Those are almost certainly the code generated by the JS JITs, so there
> are no symbols to be loaded.  Are they consuming a meaningful portion
> of the time?

About a third of the total time seems to be scattered across hundreds of these,
although each one in itself is typically around 0.1%.

This is also happening for stacks where the code hasn't been generated by JIT.
Some examples are:

0.0%   0.1%   Unknown Library  0x102153000 [unknown]
0.1%   0.1%   XUL                nsDisplayItem::RecomputeVisibility
0.0%   0.0%   XUL                  mozilla::FrameLayerBuilder::DrawThebesLayer
0.0%   0.0%   XUL                    nsRegion::SetToElements(unsigned int)


0.0%   0.1%   Unknown Library	0x11f639610 [unknown]
0.0%   0.0%   XUL	          nsChildView::Invalidate
0.0%   0.0%   libobjc.A.dylib	    objc_msgSend
0.0%   0.0%   XUL	              0x1005a31b8 [209.1KB]


0.0%   0.0%   Unknown Library   0x6d656c6500000001 [unreadable]
0.0%   0.0%   XUL                 nsCanvasRenderingContext2D::DrawImage


0.0%   0.0%   Unknown Library   0x5a0000143ac [unreadable]
0.0%   0.0%   XUL                 nsIFrame::ComputeBorderRadii


0.0%   0.0%   Unknown Library   0x1341df7e9 [unknown]
0.0%   0.0%   XUL                 nsGenericElement::SetAttrAndNotify
0.0%   0.0%   XUL                   nsGenericElement::FindAttributeDependence

Jonathan