I'm just starting out with gprof and am trying to generate a call graph. I'm using cmake for setting up my makefiles and I'm setting CMAKE_EXE_LINKER_FLAGS = -gp to enable profil开发者_StackOverflowing. The only cxx flags I have enabled is -g.
Then I simply call gprof on my gmon.out file.
The generated output file has only a flat profile within which the calls, self ts/call and total ts/call are all empty.
More importantly, it doesn't generate a call-graph. If I try to explicitly provide -q while running gprof to generate the call-graph it says 'File is missing call-graph data'.
I'm not sure what I'm doing wrong here and would appreciate pointers on getting this fixed.
Thanks.
The proper switch for profiling is -pg
, not -gp
. Is this what you're doing?
Possibly missing -pg when linking?
精彩评论