πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3478

Gprof not giving correct output as per man page option

#3478
From: jeniffer
Date: Wed, 05 Apr 2006 09:51
81 lines
3749 bytes
cat b.c
------------------------
cat b.c
#include<stdio.h>

void F()
        {
       printf("ji");
        }

void Fnotcalled()
        {
        printf("not calld");
        }
int main()
        {
        F();
        return 0;
        }
--------------------------
$ gcc -pg b.c -o b
$ ./b
$ gprof -z -c -b b.o >file

cat file --->>
-----------------------------------------------------------------------------------------------------------
Flat profile:

Each sample counts as 0.01 seconds.
 no time accumulated

  %   cumulative   self              self     total
 time   seconds   seconds    calls  Ts/call  Ts/call  name
  0.00      0.00     0.00        1     0.00     0.00  main
  0.00      0.00     0.00                             F
  0.00      0.00     0.00                             Fnotcalled
^L
                        Call graph


granularity: each sample hit covers 4 byte(s) no time propagated

index % time    self  children    called     name
                0.00    0.00       1/1           <hicore> (2)
[1]      0.0    0.00    0.00       1         main [1]
-----------------------------------------------
                                                 <spontaneous>
[3]      0.0    0.00    0.00                 F [3]
-----------------------------------------------
                                                 <spontaneous>
[4]      0.0    0.00    0.00                 Fnotcalled [4]
-----------------------------------------------
^L
Index by function name

   (2) <hicore>                [4] Fnotcalled
   [3] F                       [1] main
~
-----------------------------------------------------------------------------------------------------------
but according to man page of gprof :
"-z"
       "--display-unused-functions"
           If you give the -z option, "gprof" will mention  all
functions  in
           the  flat  profile, even those that were never called, and
that had
           no time spent in them.  This is useful in conjunction with
the  -c
           option for discovering which routines were never called.

 "-b"
       "--brief"
           If the -b option is given, "gprof" doesnΓ’t print the
verbose blurbs
           that try to explain the meaning of all of the fields in the
tables.
           This  is useful if you intend to print out the output, or
are tired
           of seeing the blurbs.
Technical Details
Message-ID: <1144230702.550581.320150@i40g2000cwc.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!i40g2000cwc.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: fc89c,3622a474f750c276,start
X-Google-Thread: 1012a6,3622a474f750c276,start
X-Google-Thread: 11318c,3622a474f750c276,start
X-Google-Attributes: gidfc89c,gid1012a6,gid11318c,public
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!i40g2000cwc.googlegroups.com!not-for-mail
From: "jeniffer" <zenith.of.perfection@gmail.com>
Newsgroups: comp.unix.programmer,comp.unix.shell,gnu.gcc.help
Subject: Gprof not giving correct output as per man page option
Date: 5 Apr 2006 02:51:42 -0700
Organization: http://groups.google.com
Lines: 82
Message-ID: <1144230702.550581.320150@i40g2000cwc.googlegroups.com>
NNTP-Posting-Host: 59.145.174.201
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1144230707 13935 127.0.0.1 (5 Apr 2006 09:51:47 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 5 Apr 2006 09:51:47 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: i40g2000cwc.googlegroups.com; posting-host=59.145.174.201;
   posting-account=gJ3nIw0AAADwKGMg7MxnfGC07RoWvYYZ