gprof reports no time accumulated
c++, gprof, macos, unix
Solution
I thought I might share this Apple mailing list discussion which I recently ran across.
The behaviour described here is exactly what I am experiencing. It looks like gprof has been broken on OSX for quite some time.
I've resorted to Shark which has been helpfully suggested by Dave Rigby.
Thanks!
Problem
I'm trying to profile a C++ application with gprof on a machine running OSX 10.5.7. I compile with g++ in the usual way, but using -pg flags, run the application and try to view the call graph with gprof. Unfortunately my call graph contains all zeroes for all time columns. The values in the "called" columns have reasonable values so it looks like something was profiled but I'm mystified about the lack of other data. All my source files are compiled in a similar way: ``` g++ -pg -O2 -DNDEBUG -I./ -ansi -c -o ScenarioLoader.o ScenarioLoader.cpp ``` I then run 'ar' to bundle all the object files into a library. Later, I link and run gprof as so: ``` g++ -pg -lm -o vrpalone vrpalone.o ../src/atomicprof.a lastbuild.o ./vrpalone gprof gmon.out | less ``` Any ideas?