This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GPROF -pg C++ and library
- From: "J.C. Pizarro" <jcpiza at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 2 Nov 2007 15:56:43 +0100
- Subject: Re: GPROF -pg C++ and library
2007/11/02, "Olivier Delannoy" wrote:
> Hi all,
> I hope it's the correct place for this question.
>
> I am trying to profile my application which is organized in several
> libraries. I would like to know what I need to do to get a profile
> which actually represent my application and not only a part of it. The
> program is composed of dynamic libraries and I am interesting in
> getting profile from the dynamic libraries functions as well.
> Libraries have been compiled using -pg -g3 -O0 as well as the main
> program but I can't find any statistics on the usage of functions
> defined in libraries. The application is written in C++ and makes use
> of a few C libraries (which I am not interested in for profiling).
>
> What is the common way to gather these information using -pg and gprof.
For shared libraries, i use -pg -fno-omit-frame-pointer -fPIC -ggdb2 -O2
The option -fno-omit-frame-pointer is obligatory for -pg or -ggdb2,
and -fPIC for shared libraries.
And i use gprof --brief
For more information, to see
ld -o myprog /lib/gcrt0.o myprog.o utils.o -lc_p (info gcc, Ctrl-S -lc_p)
I never probed running a profiled program with profiled shared C++ libraries,
i only probed it with profiled static C++ libraries.
J.C. Pizarro