[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Profiling shared libraries
From: |
Simon Perreault |
Subject: |
Profiling shared libraries |
Date: |
Tue, 17 Jun 2003 10:43:48 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 |
I want to profile a shared library using ld.so's LD_PROFILE environment
variable. Here are the steps I follow:
1) Compile and link my shared library (lib3di.so.1) as usual, without
using -pg.
2) export LD_PROFILE=lib3di.so.1
3) Run a program (named "prewitt") that uses that library.
4) The file lib3di.so.1.profile is created. It's 203k big, but
inspection revealed that except for the 56 first bytes, the file only
contains zeroes.
5) The command "file lib3di.so.1.profile" prints: "lib3di.so.1.profile:
GNU prof performance data - version 131071". I think the version is wrong.
6) I couldn't figure out the correct order of arguments to give to gprof
to analyze that file. "gprof lib3di.so.1.profile" gives "gprof:
lib3di.so.1.profile: not in a.out format". "gprof prewitt
lib3di.so.1.profile" gives "gprof: file `lib3di.so.1.profile' has
unsupported version 131071".
I also tried with using "-pg" in step 1, although I believe it should
not be used. I am running glibc 2.3.2 and binutils 2.13.90.0.18 as
provided in Red Hat 9.
What did I do incorrectly? Or is there a bug somewhere?
I will pay for a helpful answer with a contribution to either ld.so's or
gprof's manual, where instructions should be clearer. Thank you in advance.
- Profiling shared libraries,
Simon Perreault <=