help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Makefile and gprof problem


From: RS
Subject: Re: Makefile and gprof problem
Date: Wed, 27 Dec 2006 11:57:26 -0500
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)

Paul Pluzhnikov wrote:
RS <rsina_no.ssppaamm@comcast.net> writes:

So my question is 1) why the program compiles,links and runs
correctly, but the name of the functions look so weired?

They only look weird because you dont't understand a pretty
fundamental concept: name mangling. Read about it here:

http://en.wikipedia.org/wiki/Name_mangling


Thanks very much for the pointer

2) why the total and self times show to be 0.00?
The program takes 15 minutes

The 15 minutes are probably spent in system (dynamic) libraries,
or waiting for the OS. What does "time ./a.out" say?


In the abbreviated version of the code, the output of "time ./program" is

real    0m57.768s
user    0m40.878s
sys     0m7.812s

For the same abbreviated code, gprof claims that both the total time and self time of all the functions (including main) are 0.0. So I guess I don't understand the fundamental thing about gprof, because I thought I could get some idea of how much time is spent in each function


If the program mostly waits for the OS (system and user time low,
wall clock time high), then you can study output of 'strace -T
./a.out' (or whatever its equivalent on OSX is).

If user time is high, then your program spends most of its time in
system libraries, and you need to find -pg versions of them. Best
to ask on Apple-specific groups about profiling such libraries.


The (static) library, libfoo.a, that I link with, is my own defined library, which I have put all the functions in. It is not a system library. Are you saying that gprof can not go into the libraries? I tried to link the object files directly to mt main function instead of using a library. But I still get the same result (e.g. the total time spent in main function is still 0.0).

Happy Holidays,
RS


reply via email to

[Prev in Thread] Current Thread [Next in Thread]