2 Replies
      Latest reply: Oct 3, 2016 3:23 PM by codiform RSS
      codiform Level 1 Level 1 (0 points)

        So, I'm profilling an iOS application with the Time Profiler instrument for 10m, and I can see that somewhere around 35% of the samples show a particular method block. It's triggered frequently, but it shouldn't be particularly slow, so given that Time Profiler is a sampling profiler, and 35% of samples doesn't necessarily mean 35% of code execution, I was curious to dig a little further.

         

        With the new signposts API and the System Trace instrument, I thought I'd compare. In a 10s window, it looks like this same block runs 11 times, from 7-27ms.

         

        It seems odd to me that the Time Profiler would report 35% of samples contain this code tree when it seems to run about once a second for a very short time. Trying to reconcile those facts, and something that I don't know how it fits in is "idle time." If the CPU, when sampled, is doing nothing to speak of, or nothing in my app -- does that sample get discarded? Is the 35% actually 35% of "samples that contained something to do with your app"? If so, that might be enough to reconcile th diffrence, because the app shouldn't be working the system hard during either of these samples, something they both certainly show.

         

        Now that I've said that all "out loud", it actually seems like an extremely likely explanation, but ... I've already typed this all, and I'd be happy to have someone agree with me.