How can I profile code outside the functional level?

AFAIK profilers can only indicate how much time is spent on each function. But since C ++ compilers tend to aggressively embed code, and also some functions are not so short, it is often useful to know more detailed information - how much time each construct consumes.

How can this be achieved besides restructuring code for smaller functions?

+6
c ++ performance optimization profiling
source share
2 answers

If you use a sampling proxy (for example, Zoom or Shark ), and not an instrumental profiler (for example, gprof), then you can get much smaller profiles, down to the level of instructions and instructions.

+5
source share

If you can use callgrind , you can get a summary of which methods use most of the processing time. Then you can use kcachegrind to view the results. This gives a very good schedule, thanks to which you can easily browse and find bottlenecks.

+2
source share

All Articles