comp.lang.ada
 help / color / mirror / Atom feed
* GNAT and profiling!
@ 2001-11-14  8:40 Michael Andersson
  2001-11-14 14:21 ` Mark Johnson
  2001-11-15 20:32 ` Simon Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Andersson @ 2001-11-14  8:40 UTC (permalink / raw)


Hi!
I want to use gcov to profile my code. The problem is that I want to
compare one version of a program with a new version of the program to
see weather or not I gained some performace. But from what I can se gcov
counts how many times each line of code was executed. This would mean
that each version would have to be executed an equal amount of time. I
could use a counter for each function an print the contents of the
counter each frame and then compare it the output from the other version
of the program. This could become quite an effort since there are a lot
of functions to compare.

Could I in some way use gcov to do this?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAT and profiling!
  2001-11-14  8:40 GNAT and profiling! Michael Andersson
@ 2001-11-14 14:21 ` Mark Johnson
  2001-11-15 14:08   ` a98mican
  2001-11-15 20:32 ` Simon Wright
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Johnson @ 2001-11-14 14:21 UTC (permalink / raw)


Michael Andersson wrote:

> Hi!
> I want to use gcov to profile my code. The problem is that I want to
> compare one version of a program with a new version of the program to
> see weather or not I gained some performace. But from what I can se gcov
> counts how many times each line of code was executed. This would mean
> that each version would have to be executed an equal amount of time. I
> could use a counter for each function an print the contents of the
> counter each frame and then compare it the output from the other version
> of the program. This could become quite an effort since there are a lot
> of functions to compare.
>
> Could I in some way use gcov to do this?

I am not sure why you would want to do that. Can you describe what problem
you are trying to solve?

For example, if you want to reduce run time or CPU time for the "same"
amount of work, why not measure that? You can give each version the same
amount of work and check it externally. That would be the measure of
improvement. Then you use gcov to figure out the hot spots in your code -
fix them, and rerun the measurements.

Another note on gcov and similar coverage tools - turn off code inlining
until the very end of your analysis. We had an application that used a
linear search through an unordered list to look up tokens. OK for small jobs
- very inefficient on anything sizable. The original author had inlined the
look up function, so there were hot spots all over the application. It
wasn't until we got rid of that inlining to find our real problem - fix the
algorithm, and then the application ran MUCH faster.
  --Mark







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAT and profiling!
  2001-11-14 14:21 ` Mark Johnson
@ 2001-11-15 14:08   ` a98mican
  0 siblings, 0 replies; 4+ messages in thread
From: a98mican @ 2001-11-15 14:08 UTC (permalink / raw)


Mark Johnson wrote:

> Michael Andersson wrote:
>
> > Hi!
> > I want to use gcov to profile my code. The problem is that I want to
> > compare one version of a program with a new version of the program to
> > see weather or not I gained some performace. But from what I can se gcov
> > counts how many times each line of code was executed. This would mean
> > that each version would have to be executed an equal amount of time. I
> > could use a counter for each function an print the contents of the
> > counter each frame and then compare it the output from the other version
> > of the program. This could become quite an effort since there are a lot
> > of functions to compare.
> >
> > Could I in some way use gcov to do this?
>
> I am not sure why you would want to do that. Can you describe what problem
> you are trying to solve?
>
> For example, if you want to reduce run time or CPU time for the "same"
> amount of work, why not measure that? You can give each version the same
> amount of work and check it externally. That would be the measure of
> improvement. Then you use gcov to figure out the hot spots in your code -
> fix them, and rerun the measurements.
>
> Another note on gcov and similar coverage tools - turn off code inlining
> until the very end of your analysis. We had an application that used a
> linear search through an unordered list to look up tokens. OK for small jobs
> - very inefficient on anything sizable. The original author had inlined the
> look up function, so there were hot spots all over the application. It
> wasn't until we got rid of that inlining to find our real problem - fix the
> algorithm, and then the application ran MUCH faster.
>   --Mark

Hi!
What I want to do is to compare two different versions of my Ada terrain
engine. This is because the new version of the engine ran slower the the old
one which it shouldn't. If I could compare how many times each function were
called in each version it would be easier to find out were the problem is
located.

Thanks in advance!
/Michael Andersson




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAT and profiling!
  2001-11-14  8:40 GNAT and profiling! Michael Andersson
  2001-11-14 14:21 ` Mark Johnson
@ 2001-11-15 20:32 ` Simon Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Wright @ 2001-11-15 20:32 UTC (permalink / raw)


Michael Andersson <michael@ida.his.se> writes:

> Hi!
> I want to use gcov to profile my code. The problem is that I want to
> compare one version of a program with a new version of the program to
> see weather or not I gained some performace. But from what I can se gcov
> counts how many times each line of code was executed. This would mean
> that each version would have to be executed an equal amount of time. I
> could use a counter for each function an print the contents of the
> counter each frame and then compare it the output from the other version
> of the program. This could become quite an effort since there are a lot
> of functions to compare.
> 
> Could I in some way use gcov to do this?

I would have thought gprof would do better?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-11-15 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-14  8:40 GNAT and profiling! Michael Andersson
2001-11-14 14:21 ` Mark Johnson
2001-11-15 14:08   ` a98mican
2001-11-15 20:32 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox