Can 'gprof' show profile info on lib routines such as 'malloc'?

T

Terry

When I use gprof to profile a program, it seems never show me the
profile info on c lib routines such as malloc. But sometimes, profile
info on such c lib routines are also important.
I use 'gcc -g -pg' to compile the c source. Should I use other options
in order for gprof to show 'malloc'?

Any more suggestions on program profiling?

Thanks!
 
A

Antoninus Twink

When I use gprof to profile a program, it seems never show me the
profile info on c lib routines such as malloc. But sometimes, profile
info on such c lib routines are also important.
I use 'gcc -g -pg' to compile the c source. Should I use other options
in order for gprof to show 'malloc'?

You need to have the standard library compiled for profiling if you want
to get profiling information from standard library functions!

For example, Debian has a libc6-prof package that installs a static
version of the C library compiled for profiling. It's called libc_p.a,
so you need to pass -lc_p to the linker.
 
F

Flash Gordon

Terry wrote, On 05/04/08 12:35:
When I use gprof to profile a program, it seems never show me the
profile info on c lib routines such as malloc. But sometimes, profile
info on such c lib routines are also important.
I use 'gcc -g -pg' to compile the c source. Should I use other options
in order for gprof to show 'malloc'?

Any more suggestions on program profiling?

You need to ask on the Linux groups rather than here since this is about
tools not the language. There are various other profilers available
though including oprofile.
 
K

Kenny McCormack

Terry wrote, On 05/04/08 12:35:

You need to ask on the Linux groups rather than here since this is about
tools not the language. There are various other profilers available
though including oprofile.

Same old, same old. Blah, blah, blah.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top