Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling in g++ for gprof

I do not understand the documentation for gprof regarding how to compile your program for profiling with gprof. In g++, is it required to compile with the -g option (debugging information) in a 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, not in debug mode, where many optimizations are left out by the compiler (e.g. inlining)

like image 504
myahya Avatar asked May 03 '10 19:05

myahya


1 Answers

The documentation shows that you can do either, noting that you need -g for line by line profiling. So if you want to profile under release conditions, and can accept not doing line-by-line, you should be able to compile without -g.

like image 150
Matthew Flaschen Avatar answered Sep 30 '22 10:09

Matthew Flaschen