Re: gprof with C and C++ not working

From: llewelly (llewelly.at_at_xmission.dot.com)
Date: 07/03/03


Date: Thu, 03 Jul 2003 10:39:48 -0600

abeylin@yahoo.com (Alex) writes:

> Hello,
> Need your help, second day can't get this working.
> I need to compile a program with gprof.
> Program compiles, but doesnt generate information I need.
>
> Program consists of C and C++ code, and is compiled on SunOS 2.6.
> For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
> For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
> The link stage we use the same C++ compiler (gcc).

>
> I am not compiling entire souce with gprof options. Only the major
> part of what I want to analize.
> For cc I used -xpg option
> and for gcc I used -pg option
> link line does: gcc -pg
> and links C and C++ code.

>
> To me it looks like only the C++ code gets profiled. I see some
> references to "main", but nothing I am interested in.
> The program creates children processes, so I figured to set PROFDIR.
> When I set it, no profile file gets generated at all (I tried a simple
> a.out, that generates a file exactly where I want it).

IIRC, the profiling info generated by using Sun cc -xpg is not
    readable by gprof. My only suggestion is to use gcc -pg to compile
    your C code instead of Sun cc.



Relevant Pages

  • trying to use gprof, program compiled with -pg dies immediately
    ... At work when we try to compile a program with -pg to use ... page for gprof. ... to a small test program I compiled on a Sparc machine, ... worked fine (Sun Solaris 9 Sparc on a Enterprise server), ...
    (comp.lang.cpp)
  • Re: gprof with C and C++ not working
    ... >> I am not compiling entire souce with gprof options. ... >> The program creates children processes, so I figured to set PROFDIR. ... My only suggestion is to use gcc -pg to compile ... > your C code instead of Sun cc. ...
    (comp.unix.programmer)
  • gprof with C and C++ not working
    ... I need to compile a program with gprof. ... The link stage we use the same C++ compiler (gcc). ... I am not compiling entire souce with gprof options. ... no profile file gets generated at all (I tried a simple ...
    (comp.unix.programmer)
  • Re: Any 3B1 alive?
    ... a Sun D-1000 JBOD full of SCA ... drives, and a Criiterion/EMC Fibre Channel JBOD full of FC drives where ... with blown power supply. ... It did compile on quite few obscure systems around ...
    (comp.sys.3b1)
  • Re: java.util.Properties extending from HashMap instead of HashMap
    ... If properties were of type, then this would generate a compile time warning, letting the programmer know they've done something in a way they are not supposed to. ... Given the simplicity of the code fix, plus the ability to compile using "-source 1.4" until the source can be corrected, I would bet that Sun would consider the benefit of additional error checking to outweigh the inconvenience of source changes during the developer's transition to Java 5. ... I think I've figured out the reason! ...
    (comp.lang.java.programmer)