Compilation in g ++ for gprof

I do not understand the documentation for gprof regarding how to compile your profiling program with gprof. G ++ requires compilation with the -g option (debugging information) in addition to the -pg option or not. In each case, I get different results, and I would like to see where the bottlenecks in my application are in release mode, and not in debug mode, when many optimizations are not taken into account by the compiler (for example, inlining)

+7
profiling compilation g ++ gprof
source share
1 answer

The documentation shows that you can do this by noting that you need -g to profile lines . Therefore, if you want to profile under release conditions and can accept non-executable lines line by line, you must compile without -g.

+5
source share

All Articles