On Solaris, I want to profile some C code that I've written for
AOLserver, because I know that one part of it is too slow.  My code is
in a .so, and I'm able to profile it basically like so:

  export LD_PROFILE=/pathto/mymodule.so
  # run AOLserver.  Stop AOLserver.
  gprof /pathto/mymodule.so /var/tmp/mymodule.so.profile

However, when I look at the gprof output, I see my slow function, but
since it's %time is high and it's self time is very low, it must be
its children that are realy taking up the time.  But, none of its
(presumably slow) children are listed!  Is this because all the
time-consuming functions it's calling are defined in OTHER shared
libraries, not in mymodule.so?  I'm pretty sure it is, but what can I
do about it?

It seems I can't simply link with -pg, because then AOLserver dies on
startup, I think because the -pg is turning off -fPIC.  E.g.:

  cc1: warning: -fPIC and profiling conflict: disabling -fPIC

  fatal: relocation error: ... symbol _mcount: referenced symbol not found

I guess I could build a completely staticly linked AOLserver, but that
sounds difficult.  Or is it easier than I think?

I think I should be able to use something like "truss -dD -u '*'" to
get the timing of all the function calls, but as far as I know there's
no ready made option to take all that raw timing data and assemble it
into something like gprof's output.  Presumably I could write a script
to do it but that sure doesn't sound appealing.

Any advice?  Thanks!

--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com

Reply via email to