I am trying to understand linux perf
and hotspot to understand call stacks/trace of my c++ application.
Should the program compiled in debug mode or in release mode ? Assuming I have only one file inline.cpp
. I have seen in one of the example using
g++ -O2 -g inline.cpp -o inline
perf record --call-graph dwarf ./inline
I am wondering is it necessary to compile the program in debug (-g)
and optimization -O2
? What are flag that the executable is compiled in order make it useful to run with perf record ?
Does it make any difference if we compile the program with out compiler flags ?
g++ inline.cpp -o inline