What exactly does the Instruments CPU Profiler measure?

95 views Asked by At

My understanding is that it is a sampling profiler, and its output is very similar to that of Time Profiler, but it reports "Gc/Mc" (which I guess are mega/giga cycles). The package documentation says

Profiles running threads on all cores based on Cycle PMI for one or all processes.

I believe PMI here means "performance monitoring interrupts", which makes sense in the context of a sampling profiler. So, I have the following questions:

  1. What is the difference between the measurement mechanisms for time profiler and CPU profiler? Or how can I learn more about this?
  2. When would I want to use the CPU Profiler over the time profiler?
  3. Does CPU profiler only do interrupt/suspend -> record callstack and context -> update counts, or is there also something else like dtrace/ktrace involved?

I am asking because have discovered a case where both time profiler and CPU profiler measurements have been very misleading, and I would like to understand why that might be happening and how can I diagnose this in general. Unfortunately I cannot really reproduce a minimum working example of that specific case at the moment. Perhaps I might address that in a separate question when I am able to.

0

There are 0 answers