Profiling dynamically loaded libraries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Profiling dynamically loaded libraries

Domagoj Babic
Hi,

Standard approach to profiling dynamically loaded libraries with
gprof doesn't seem to work with LLVM:

export LD_PROFILE=Mylib.so
export LD_PROFILE_OUTPUT=.
make ENABLE_PROFILING=1  // compiling my project

opt -load Profile/Mylib.so -options...

but no Mylib.so.profile (or gmon.out) is produced. Profiling
libc.so.6 usage by "ls -l", however, works fine.

Could anyone explain me what am I doing wrong?

Thx.
      Domagoj


Other possibly relevant info:
Makefile contains:
LIBRARYNAME=Mylib
SHARED_LIBRARY=1
LOADABLE_MODULE=1

Platform: Suse Linux
gprof 2.15.94.0.2.2
gcc  3.3.5 20050117

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Profiling dynamically loaded libraries

Chris Lattner
On Thu, 8 Jun 2006, Domagoj Babic wrote:
> Standard approach to profiling dynamically loaded libraries with
> gprof doesn't seem to work with LLVM:
>
> export LD_PROFILE=Mylib.so
> export LD_PROFILE_OUTPUT=.

I've never used these before.

> make ENABLE_PROFILING=1  // compiling my project

This *should* work, but hasn't been tested for a very long time.  You
could try passing VERBOSE=1 to make to see if it is compiling LLVM right.
Also, make sure that both LLVM and your project are compiled with that.

> opt -load Profile/Mylib.so -options...
>
> but no Mylib.so.profile (or gmon.out) is produced. Profiling
> libc.so.6 usage by "ls -l", however, works fine.
>
> Could anyone explain me what am I doing wrong?

I don't know, other than you should make sure that LLVM is compiled with
profile info too.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev