Useful Sampling results with no Symbols?

148 views
Skip to first unread message

Jeffrey Weston

unread,
Mar 24, 2011, 6:12:15 PM3/24/11
to perfoptimi...@lists.apple.com
Hello,

We frequent will get customers who send us Sampler/SpinDump profiles when our apps are unresponsive.

However, in a released product which has no symbols, our understanding is that when Sampler aggregates the stacks it compresses all the non-symbolized functions together. Thus we loose valuable data about the path taken to a particular function. In most cases, the samples we then get are not very useful.

Is there anyway around this (either on developer side or on the user side)?

Below is an example of what we see using an example App:

Debug Build Sample (With Symbols):

Thread 910b000 DispatchQueue 1
User stack:
499 start + 52 (in PerfTestTool) [0x100000b34]
499 main + 133 (PerfTestTool.m:9 in PerfTestTool) [0x100000bc1]
499 -[LotsOfFunctions startPresidency] + 38 (LotsOfFunctions.m:17 in PerfTestTool) [0x100000bfe]
499 -[LotsOfFunctions GeorgeWashington] + 55 (LotsOfFunctions.m:24 in PerfTestTool) [0x100000c37]
499 -[LotsOfFunctions JohnAdams] + 55 (LotsOfFunctions.m:31 in PerfTestTool) [0x100000c70]
499 -[LotsOfFunctions ThomasJefferson] + 55 (LotsOfFunctions.m:37 in PerfTestTool) [0x100000ca9]
499 -[LotsOfFunctions JamesMadison] + 55 (LotsOfFunctions.m:43 in PerfTestTool) [0x100000ce2]
499 -[LotsOfFunctions JamesMonroe] + 52 (LotsOfFunctions.m:47 in PerfTestTool) [0x100000d18]
499 +[NSThread sleepForTimeInterval:] + 101 (in Foundation) [0x7fff870cfb08]
499 __semwait_signal + 10 (in libSystem.B.dylib) [0x7fff81aa3fca]

Release Build Sample (No Symbols):

Thread 13511000
User stack:
500 start + 52 (in PerfTestTool) [0x100000b94]
500 main + 106 (PerfTestTool.m:9 in PerfTestTool) [0x100000c06]
500 -[LotsOfFunctions JamesMonroe] + 31 (LotsOfFunctions.m:47 in PerfTestTool) [0x100000c55]
500 +[NSThread sleepForTimeInterval:] + 101 (in Foundation) [0x7fff870cfb08]
500 __semwait_signal + 10 (in libSystem.B.dylib) [0x7fff81aa3fca]

Thank You
Jeffrey Weston
Senior Software Development Engineering in Test
Macintosh Business Unit, Microsoft

_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (PerfOptimi...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/perfoptimization-dev-garchive-8409%40googlegroups.com

This email sent to perfoptimization-...@googlegroups.com

Ken Thomases

unread,
Mar 25, 2011, 12:48:46 AM3/25/11
to Jeffrey Weston, perfoptimi...@lists.apple.com
On Mar 24, 2011, at 5:12 PM, Jeffrey Weston wrote:

> However, in a released product which has no symbols, our understanding is that when Sampler aggregates the stacks it compresses all the non-symbolized functions together.

Logically, what it's doing is symbolizing the stack traces first and then aggregating them. For any given address, it searches for the nearest preceding symbol. When symbols have been stripped, huge swaths of your code may not have any symbols and the search goes back and back (across functions, but the search algorithm can't know that) and eventually finds something. So, all of those addresses get attributed to some unrelated symbol.

> Thus we loose valuable data about the path taken to a particular function. In most cases, the samples we then get are not very useful.

Yeah, that's a nuisance.


> Is there anyway around this (either on developer side or on the user side)?
>
> Below is an example of what we see using an example App:
>
> Debug Build Sample (With Symbols):

> Release Build Sample (No Symbols):

Note that there's a middle ground between a debug build with full debugging symbols and a stripped release build: an unstripped release build. That doesn't have debugging symbols, but does still have some symbols.

See the STRIP_INSTALLED_PRODUCT (Strip Linked Product) and STRIP_STYLE (Strip Style) build settings in Xcode. For frameworks that get copied into your app, see COPY_PHASE_STRIP (Strip Debug Symbols During Copy).

Another possible approach requires the user to have the developer tools installed. If they use either Shark or Instruments to collect a Time Profile, save that, and send it to you, I believe you can resymbolicate it. Of course, most users won't have or want the developer tools to be installed, so that's a stretch.


You either need a tool which records all of the stack traces non-symbolically, or you need your app to have symbols.

It may be possible to build a tool to collect the non-symbolic traces using DTrace and its profile provider. That's always installed, but would require the user to authenticate as an admin to run it. You'd also have to deal with shared library relocation/sliding/whatever. (I'm not thoroughly versed in that part.) (Hmm. Some experiments here with some well-documented DTrace one-liners yield no results. DTrace only encounters errors walking the stack. For reference, I was trying:

sudo dtrace -n 'profile-50 /pid==$target/ {@[ustack()]=count()}' -p <pid>

and variants.)

Good luck,
Ken

Reply all
Reply to author
Forward
0 new messages