How do I interpret the output of Mac's 'sample' tool I have a process that is running on OS X which has some problems and the 'sample' tool on the Mac seems like the best way to debug the problem. Unfortunately, the only documentation I can find for it is the man page which says nothing about how to interpret the results.

Are there any good places that document the output and how to interpret it? If not, can someone give me a very basic tutorial?
I just checked the Man page on sample
and it looks to me like a half-decent call-stack sampler.
It claims that its output is the call-tree, so that should not be too hard to comprehend.

I say half-decent because collecting call-stack samples is a good thing. The criticisms are:


It doesn't say if it collects samples when the process is in a system call, like waiting for I/O. It is important to do so, unless you want to be blind to needless I/O.
It falls for the fiction that what matters is accuracy of timing and you don't want to miss any functions, so samples have to be really frequent. It's a fiction because the goal is to find big stuff, not to measure little stuff. Any function that doesn't appear certainly doesn't cost enough to care about.
The consequence of this fiction is there are too many samples for you to look at, so it has to try to find a way to summarize them, so it chooses a call-tree. The fact is, if you are allowed to actually examine a small number of the samples (like 10 or 20) you will see exactly the reason(s) for the slowness. The summarization is the problem. It smears out and hides the information.


So, the long-and-short is, it appears to be a good tool for collecting call-stack samples.
If you can figure out how to actually see a selection of them, it will tell you what the problem is.