🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3484

Re: Gprof not giving correct output as per man page option

#3484
From: jeniffer
Date: Thu, 06 Apr 2006 06:30
88 lines
3528 bytes
rmansfield@gmail.com wrote:
> Well -z does say "gprof will mention  all functions  in the  flat
> profile, even those that were never called"...
>
> Easy solution:
> gprof -b b >file1
> gprof -z -b b >file2
> diff -u file1 file2
>
> It would be almost trivial to modify gprof to have it print only the
> unused functions..
>
> Regards
>
> Ryan Mansfield


I did what you asked but its not giving the exact func names ..the
second command gprof -z -b b >file2 ,i think is creating problem ....I
also tried gprof for the follownig c program :
#include<stdio.h>

static void static_func()
        {
        printf(" inside static function ");
        }


void f_called()
        {
        printf(" in f_called ");
        }
void f_not_called()
        {
        printf(" in f_not_called ");
        }

void Func_calling_static()
        {
        printf("\n in Func_calling static");
        static_func();
        }



/*void extern_func()
        {
        printf("\nhello");
        }
*/


int main()
        {
        static_func();
//        extern_func();
        f_called();
        Func_calling_static();
        return 0;
        }
~

 gprof a1 |more
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  static_func
........
                     Call graph (explanation follows)


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

index % time    self  children    called     name
                0.00    0.00       1/1           Func_calling_static
[4]
[1]      0.0    0.00    0.00       1         static_func [1]
-----------------------------------------------
Index by function name

   [1] static_func
.........
Why f_called is not listed in the call graph ?
Technical Details
Message-ID: <1144305025.715962.14800@i39g2000cwa.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!i39g2000cwa.googlegroups.com!not-for-mail
References: <1144230702.550581.320150@i40g2000cwc.googlegroups.com> <1144236822.010521.167490@j33g2000cwa.googlegroups.com> <1144237223.367750.244560@g10g2000cwb.googlegroups.com> <1144240681.985483.126760@j33g2000cwa.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: fc89c,3622a474f750c276
X-Google-Thread: 1012a6,3622a474f750c276
X-Google-Thread: 11318c,3622a474f750c276
X-Google-Attributes: gidfc89c,gid1012a6,gid11318c,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!i39g2000cwa.googlegroups.com!not-for-mail
From: "jeniffer" <zenith.of.perfection@gmail.com>
Newsgroups: comp.unix.programmer,comp.unix.shell,gnu.gcc.help
Subject: Re: Gprof not giving correct output as per man page option
Date: 5 Apr 2006 23:30:25 -0700
Organization: http://groups.google.com
Lines: 89
Message-ID: <1144305025.715962.14800@i39g2000cwa.googlegroups.com>
References: <1144230702.550581.320150@i40g2000cwc.googlegroups.com>
   <1144236822.010521.167490@j33g2000cwa.googlegroups.com>
   <1144237223.367750.244560@g10g2000cwb.googlegroups.com>
   <1144240681.985483.126760@j33g2000cwa.googlegroups.com>
NNTP-Posting-Host: 59.145.174.201
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1144305031 13163 127.0.0.1 (6 Apr 2006 06:30:31 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 6 Apr 2006 06:30:31 +0000 (UTC)
In-Reply-To: <1144240681.985483.126760@j33g2000cwa.googlegroups.com>
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: i39g2000cwa.googlegroups.com; posting-host=59.145.174.201;
   posting-account=gJ3nIw0AAADwKGMg7MxnfGC07RoWvYYZ