Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gprof a library - question

I need to gprof a library in our system to examine the function calls and see if we can optimize it any more. Basically, what I have is

Executable A which uses a shared Library myLib.so

I want to gprof the myLib.so. When I compile myLib.so source using -pg option, it produces a .so file just fine.

But, recompiling the Executable A against that library is not producing the *.gmon file for some reason. What needs to be done? Should I link the myLib statically? If so, please tell me how. I am a newbie, so pardon my ignorance. I am learning everyday

thanks in advance.

like image 295
ramsci Avatar asked Nov 14 '22 12:11

ramsci


1 Answers

You can do better than gprof.

You could use a good sampling profiler like RotateRight/Zoom, or you could try this technique. Also lsstack serves well. pstack does too, but is more work for you.

like image 64
Mike Dunlavey Avatar answered Apr 27 '23 20:04

Mike Dunlavey