Home > Archive > Unix Programming > August 2006 > Problems with profiling
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problems with profiling
|
|
| Christian Chrismann 2006-08-12, 7:00 pm |
| Hi,
I'm using gprof to profile my application that consists of several
libraries. All libraries and the executable have been compiled
with the parameter "-pg". My problem is that the generated output
by gprof does not indicate functions that actually consume most
of the program execution time.
Before I started using gprof, I compiled my application (wihtout "-pg")
in two version. The first version contained the function I assume most
run-time was spent at. In the second version I commented out this
function. Then I run the binary executables using the program "time".
The results of time confirm my assumptions. The first version has a
substantially larger "user" and "sys" (time) values than the second
version (without the costly function). This indicates that more resources
are required in the user and kernel space to run the first binary.
Then I wanted to obtain more accurate information, so I decided to use
"gprof". However, the generated output of "gprof" together with my
first program version (with the expensive function) does not contain any
entry for that function. Why? It is apparent that this function is
responsible for the increased program execution time.
I also tries to run gprof with the option "-f functionname" (where
functionname is the function that increases the execution time) to
limit the call graph to this function. But even then, the name of that
function is missing in gprof's output.
Do you have any ideas what might be wrong?
Regards,
Chris
| |
| Soeren Sandmann 2006-08-12, 10:00 pm |
| Christian Chrismann <plfriko@yahoo.de> writes:
> Do you have any ideas what might be wrong?
gprof is an ancient program that doesn't support shared libraries. If
you insist on using it, you need to link your application statically,
ie., link with ".a" versions of the shared libraries, rather than the
".so" versions. Also, the libraries must be compiled with "-g -pg" for
gprof to work.
If you are using Linux, take a look at sysprof, at
http://www.daimi.au.dk/~sandmann/sysprof/
It supports shared libraries, and you don't have to recompile the
application. The downside is that it requires you to use a kernel
module.
Soren
|
|
|
|
|