Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

profile shared libraries with gcc and gprof

1,268 views
Skip to first unread message

xukg

unread,
Dec 15, 2001, 12:42:27 AM12/15/01
to
Hi,

I use gcc (with option -p) to compile my program which uses shared
libraries. But i cannot find calls of dynamic libraries in my profile.
I generate my shared libraries (xxx.so) with the option -p too.

Is it possible to profile shared libraries?

Thanks

Axel Kittenberger

unread,
Dec 19, 2001, 11:58:12 PM12/19/01
to
xukg wrote:
> I use gcc (with option -p) to compile my program which uses shared
> libraries. But i cannot find calls of dynamic libraries in my profile.
> I generate my shared libraries (xxx.so) with the option -p too.

One cheap option is to simply link the libraries static into your
application with the ld option --static.

If you're using glibc as your c library you can export the
variable LD_PROFILE=[libraryname] to tell the dynamic linker to profile the
shared library with this name...

Best see the ld.so man pages, like i.e.
http://www.cs.princeton.edu/cgi-bin/man2html?ld.so.1:1

- Axel Kittenberger

Vincent Stehlé

unread,
Dec 20, 2001, 12:38:34 AM12/20/01
to
xukg wrote:
[snip]

[snip]

Dear "xukg",

Did you try to compile with "-pg" rather than "-p" ? This is what is
specified in gprofs documentation [1].

Is it possible that the time spent in your shared libraries functions
be much less than the profile tick (something like 1/100th of second) ?
In that case, you should either perform many runs (see [2]) and/or try
to force static call graph discovery with gprofs "-c" option (see [3]).

Good luck anyway !

[1] http://www.gnu.org/manual/gprof-2.9.1/html_node/gprof_2.html#SEC2
[2] http://www.gnu.org/manual/gprof-2.9.1/html_node/gprof_22.html#SEC22
[3] http://www.gnu.org/manual/gprof-2.9.1/html_node/gprof_6.html#SEC6

--
Vincent Stehlé StepMind S.A.
DSP system engineer Central Buro, Avenue de Campon
06110 Le Cannet, France

0 new messages