GPROF -pg C++ and library
J.C. Pizarro
jcpiza@gmail.com
Fri Nov 2 14:56:00 GMT 2007
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
More information about the Gcc-help
mailing list