views:

31

answers:

2

Hey,

I'm building a .so plugin and would like to profile it using gprof. At the moment, I don't have the ability to rebuild (with the -pg option) the executable that links to it. Is it possible to use gprof to profile just this .so file once it's loaded up and linked to?

+1  A: 

It's not possible with gprof (in my experience, gprof basically doesn't work unless you can statically link everything including libc, and the libc people really don't want you to do that these days) but you should be able to do this with kcachegrind. It'll give you details on the whole program, but with no symbols for the part you don't have source for, and you just ignore that part. Bonus: no need to recompile.

Zack
A: 

As Zack said, gprof won't do that.

But even if it did, you could be disappointed, because gprof only finds certain kinds of problems. If you find and fix those problems, you are left with performance being limited by the problems it didn't find.

Here's a list of issues, not just with gprof, but with many profilers.

Give Zoom a try.

Mike Dunlavey