gprof : How to generate call graph for functions in shared library that is linked to main program

gprof won’t work, you need to use sprof instead. I found these links helpful: How to use sprof? http://greg-n-blog.blogspot.com/2010/01/profiling-shared-library-on-linux-using.html Summary from the 2nd link: Compile your shared library (libmylib.so) in debug (-g) mode. No -pg. export LD_PROFILE_OUTPUT=`pwd` export LD_PROFILE=libmylib.so rm -f $LD_PROFILE.profile execute your program that loads libmylib.so sprof PATH-TO-LIB/$LD_PROFILE $LD_PROFILE.profile -p >log See the … Read more