[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help-using gnu's gprof for getting profiling information
From: |
Rakesh M. Patel |
Subject: |
Re: help-using gnu's gprof for getting profiling information |
Date: |
Mon, 05 Apr 2004 20:34:07 -0500 |
Hey,
Thanks for your response....
But i am still facing problems while using the sequence you have described
in your mail. Also i make sure that i am using gcc 2.95 version.
But i want to let you know that i am using fsf's gnu on windows
platform...so does this make difference because in this case i can't implement
$ perl /usr/share/doc/binutils/gprof/bbconv.pl <bb.out >BB-DATA
command. So is there any other way to do the same thing. Because i tried the
same program you have attached in the reply to my previous question but the
ouput i am getting after implementing following sequece of commands
c:\> gcc -o test_prog test_prog.c -g -pg -a
c:\> rm bb.out
c:\> test_prog
c:\> gprof -A -l test_prog gmon.out BB-DATA
is:
int increment(int x)
1 -> {
int y = 0;
int i = 0;
for(i = 0; i < 100; i++)
x=x+1;
return x;
}
So can you help me to solve this problem....
Waiting for your reply
Rakesh Patel
----- Original Message -----
From: Stepan Kasal <address@hidden>
Date: Thursday, April 1, 2004 2:51 am
Subject: Re: help-using gnu's gprof for getting profiling information
> Hello,
>
> On Tue, Mar 30, 2004 at 08:11:00PM -0600, Rakesh M. Patel wrote:
> > I am using gnu's gprof ...
>
> OK, I tried it with a source file similar to your one:
>
> $ cat test_prog.c
> int increment(int x)
> {
> int y = 0;
> int i = 0;
> for(i = 0; i < 100; i++)
> x=x+1;
> return x;
> }
> main() {
> int d;
> increment(d);
> }
>
> Then I run these commands:
>
> $ gcc-2.95 -o test_prog test_prog.c -g -pg -a
> $ rm bb.out; ./test_prog
> $ perl /usr/share/doc/binutils/gprof/bbconv.pl <bb.out >BB-DATA
> $ gprof -A -l test_prog gmon.out BB-DATA
>
> And the output was as expected:
>
> *** File /home/kasal/test_prog.c:
> int increment(int x)
> 1,1 -> {
> int y = 0;
> int i = 0;
> 101,1 -> for(i = 0; i < 100; i++)
> 100 -> x=x+1;
> 1 -> return x;
> 1 -> }
>
> There are several pitfalls though:
> 1) It seems that new versions of gcc (3.2.3, 3.3, at least) don't
> support -a.
> 2) OTOH, when the gcc is too old, like mine gcc-2.95.4, it outputs
> the basic-block details into separate file bb.out; you have to
> transform it by bbconv.pl, as described in the gprof manual.
> 3) You have to remove the old copy of bb.out before running the
> test program;
> the results cumulate otherwise.
> 4) It might be better to use gprof without `-x', the output shows
> mor clearly
> which lines are ``merged together''.
>
> You might avoid the bb.out hassle by using a suitable version of
> compiler,perhaps gcc 3.0.x. I haven't tried this.
>
> Hope this helps,
> Stepan Kasal
>