Re: Stupid Instruments questions
Re: Stupid Instruments questions
- Subject: Re: Stupid Instruments questions
- From: Wade Tregaskis <email@hidden>
- Date: Wed, 19 Oct 2011 00:34:17 -0400
> (2) What’s the difference between Time Profiler and Sampler? The descriptions use different wording but seem to say the same thing; the only difference seems to be that the former can sample multiple processes. Provided I only care about one process, is there any benefit to one vs the other? I actually just tried adding both of them, but the results are bizarre: the CPU loads shown in their graphs are completely different, almost inverses of each other, so I’m assuming that they interfere with each other and shouldn’t be used at the same time.
They don't really interfere so much as, well, Sampler just doesn't give very good data. It tends to under-report usage, and insert big gaps, due to its own overhead. I don't think I'd ever recommend using it. But then I'm biased, as I wrote a large portion of the Time Profiler functionality. :)
Sampler is entirely user-space; it's just pausing the target process, taking a snapshot of all threads, and resuming it. You could actually implement [the core sampling portion of] it yourself using public APIs, I believe. It has relatively high overhead, and rarely any advantages.
Time Profiler records data via the kernel, which gives it a lot of advantages:
1) It's much faster.
2) It can see into everything except [most] interrupts. Sampler has to wait for the target's threads to formally pause, which is waaaaaay more unreliable than Time Profiler's approach.
3) It can see into the kernel, and kexts.
4) In Deferred mode it's even more way faster (I'm not even sure Sampler supports Deferred mode..?).
5) It can profile multiple processes concurrently.
N) etc.
The only meaningful advantage Sampler has it that it can do a better job of collecting accurate backtraces, if the code under profile is compiled with -fomit-frame-pointers. At least, that used to be the case - Time Profiler could hypothetically be just as accurate, but it wasn't last I checked.
In a nutshell, it is very analogous to Shark's Time Profiler, though they don't share the same implementation; Instruments' is newer and Better. :D _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden