Reiterating sampling profiling's limitations

As already stated at the beginning of this chapter (which you may have forgotten or just plain refused to read), there are some limitations as a consequence of statistic nature of the sampling data. Let's illustrate this with an example now, as it will then become more plausible than in a theoretic discussion. Let's have a look at the Call Graph tab of the CodeXL profiling results shown in the previous screenshot:

  • You could be tempted to say that the qMain() function called only the wasteCpuCycles() function, as shown in the Call Graph, but we just don't know that for certain. What we can say is that the stacks collected in the sampling process have never seen that function calling something different than wasteCpuCycles().
  • We cannot say how often function wasteCpuCycles() was called either. Was it called once, spending 21.34% of the time overall, or 10 times, taking 2.134% each time?

As we said already, if you want super-precise information, you will have to resort to instrumentation.