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

Discussion in 'C Programming' started by Terry, Apr 5, 2008.

  1. Terry

    Terry Guest

    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!
    Terry, Apr 5, 2008
    #1
    1. Advertising

  2. On 5 Apr 2008 at 11:35, Terry wrote:
    > 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.
    Antoninus Twink, Apr 5, 2008
    #2
    1. Advertising

  3. Terry

    Flash Gordon Guest

    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.
    --
    Flash Gordon
    Flash Gordon, Apr 5, 2008
    #3
  4. In article <-gordon.me.uk>,
    Flash Gordon <> wrote:
    >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.


    Same old, same old. Blah, blah, blah.
    Kenny McCormack, Apr 5, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brad
    Replies:
    1
    Views:
    1,134
    Roedy Green
    Jul 19, 2005
  2. takashi
    Replies:
    1
    Views:
    465
    =?iso-8859-1?Q?Andr=E9_P=F6nitz?=
    Aug 29, 2003
  3. Andy B
    Replies:
    0
    Views:
    518
    Andy B
    May 3, 2008
  4. Steven
    Replies:
    5
    Views:
    481
    Steven
    Oct 24, 2008
  5. Gene
    Replies:
    0
    Views:
    446
Loading...

Share This Page