comp.lang.ada
 help / color / mirror / Atom feed
* Profiling GNAT programs with gprof
@ 2005-06-07 16:12 Alfred Hilscher
  2005-06-07 17:00 ` Alex R. Mosteo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alfred Hilscher @ 2005-06-07 16:12 UTC (permalink / raw)


Has someone experience with gprof and GNAT? It seem to work when I
profile sequential programs, but if I have tasks in my code then the
result of gprof seem invalid. E.g. a procedure called only three times
at all is listed as about 10000 calls. And while the over all runtime of
the prog is about 2 sec, gprof shows the consumed time for this
procedure with a few thousands seconds. 
It looks like as if the statistik counters were not initialized. What
have I to do, to get correct results?
I use GNAT 3.15p and Windows 2000.

-- 
-----------------------------------------------------
To send me mail, please replace "Spam" by "Jedermann"
-----------------------------------------------------



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

* Re: Profiling GNAT programs with gprof
  2005-06-07 16:12 Profiling GNAT programs with gprof Alfred Hilscher
@ 2005-06-07 17:00 ` Alex R. Mosteo
  2005-06-07 17:18 ` Marius Amado Alves
  2005-06-10  9:49 ` Alfred Hilscher
  2 siblings, 0 replies; 6+ messages in thread
From: Alex R. Mosteo @ 2005-06-07 17:00 UTC (permalink / raw)


Alfred Hilscher wrote:
> Has someone experience with gprof and GNAT? It seem to work when I
> profile sequential programs, but if I have tasks in my code then the
> result of gprof seem invalid. E.g. a procedure called only three times
> at all is listed as about 10000 calls. And while the over all runtime of
> the prog is about 2 sec, gprof shows the consumed time for this
> procedure with a few thousands seconds. 
> It looks like as if the statistik counters were not initialized. What
> have I to do, to get correct results?
> I use GNAT 3.15p and Windows 2000.

I did this in the past in the same platform as you, also with a 
multitasking program. I don't remember seeing unexpected counter values. 
   Have you a simple test program to highligth this problem? I could try 
to run it and compare results.

If I'm not mistaken, the timing problem can arise from the way gprof 
computes time: each call is given a fixed diferential duration. So that 
can artificially inflate the times reported. But you should check this 
in the documentation, I may be confused about this behavior.



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

* Re: Profiling GNAT programs with gprof
  2005-06-07 16:12 Profiling GNAT programs with gprof Alfred Hilscher
  2005-06-07 17:00 ` Alex R. Mosteo
@ 2005-06-07 17:18 ` Marius Amado Alves
  2005-06-08  7:22   ` Jean-Pierre Rosen
  2005-06-10  9:49 ` Alfred Hilscher
  2 siblings, 1 reply; 6+ messages in thread
From: Marius Amado Alves @ 2005-06-07 17:18 UTC (permalink / raw)
  To: comp.lang.ada

I also have experienced erroneous Gprof results. Functions *never* 
called listed as called. I gave up on Gprof. Sorry not being of help. 
Just telling my experience. Next time I need profiling I think I'll try 
another tool e.g. RootCause, or instrument my code. Good luck to you 
with Gprof.




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

* Re: Profiling GNAT programs with gprof
  2005-06-07 17:18 ` Marius Amado Alves
@ 2005-06-08  7:22   ` Jean-Pierre Rosen
  2005-06-08 11:31     ` Jeff Creem
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Pierre Rosen @ 2005-06-08  7:22 UTC (permalink / raw)


Marius Amado Alves a �crit :
> I also have experienced erroneous Gprof results. Functions *never* 
> called listed as called. I gave up on Gprof. Sorry not being of help. 
> Just telling my experience. Next time I need profiling I think I'll try 
> another tool e.g. RootCause, or instrument my code. Good luck to you 
> with Gprof.
> 
I had obviously wrong results with gprof both with tasking and 
non-tasking programs, and I gave up using it.

<PLUG>
Note that if you just want to time some procedure calls (not full 
profiling), you can use the facilities from Debug.Timing package, 
available as part of Adalog's Debug package.
See http://www.adalog.fr/compo2.htm
</PLUG>

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



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

* Re: Profiling GNAT programs with gprof
  2005-06-08  7:22   ` Jean-Pierre Rosen
@ 2005-06-08 11:31     ` Jeff Creem
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Creem @ 2005-06-08 11:31 UTC (permalink / raw)


Jean-Pierre Rosen wrote:
> Marius Amado Alves a �crit :
> 
>> I also have experienced erroneous Gprof results. Functions *never* 
>> called listed as called. I gave up on Gprof. Sorry not being of help. 
>> Just telling my experience. Next time I need profiling I think I'll 
>> try another tool e.g. RootCause, or instrument my code. Good luck to 
>> you with Gprof.
>>
> I had obviously wrong results with gprof both with tasking and 
> non-tasking programs, and I gave up using it.
> 
> <PLUG>
> Note that if you just want to time some procedure calls (not full 
> profiling), you can use the facilities from Debug.Timing package, 
> available as part of Adalog's Debug package.
> See http://www.adalog.fr/compo2.htm
> </PLUG>
> 

I have had good luck with gprof on non-tasking programs though in most 
cases I ended up either having to increase the systems default interrupt 
clock rate to get good results or wrapping the main code I cared about 
in a loop to get good results (this was needed even for non-trival 
programs that were not all that fast to complete).

Also to get reasonable results I often have to revert to using the -F 
option (better when possible) or a series of -f options (still ok but 
not great when -F is really neeeded)

As for tasking programs...There is a lot of info on the web about gprof 
failing with threads/forks/etc and a few platform specific workarounds 
appear to exist.

The failure mechanisms also seem somewhat platform specific as well.

http://sam.zoy.org/writings/programming/gprof.html



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

* Re: Profiling GNAT programs with gprof
  2005-06-07 16:12 Profiling GNAT programs with gprof Alfred Hilscher
  2005-06-07 17:00 ` Alex R. Mosteo
  2005-06-07 17:18 ` Marius Amado Alves
@ 2005-06-10  9:49 ` Alfred Hilscher
  2 siblings, 0 replies; 6+ messages in thread
From: Alfred Hilscher @ 2005-06-10  9:49 UTC (permalink / raw)


Thanks to all.
It seems to me that profiling with gprof is not the best way, so I will
look for other method to optimize my algorithms.


Alfred Hilscher schrieb:
> 
> Has someone experience with gprof and GNAT? It seem to work when I
> profile sequential programs, but if I have tasks in my code then the
> result of gprof seem invalid. E.g. a procedure called only three times
> at all is listed as about 10000 calls. And while the over all runtime of
> the prog is about 2 sec, gprof shows the consumed time for this
> procedure with a few thousands seconds.
> It looks like as if the statistik counters were not initialized. What
> have I to do, to get correct results?
> I use GNAT 3.15p and Windows 2000.
> 

-- 
-----------------------------------------------------
To send me mail, please replace "Spam" by "Jedermann"
-----------------------------------------------------



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

end of thread, other threads:[~2005-06-10  9:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-07 16:12 Profiling GNAT programs with gprof Alfred Hilscher
2005-06-07 17:00 ` Alex R. Mosteo
2005-06-07 17:18 ` Marius Amado Alves
2005-06-08  7:22   ` Jean-Pierre Rosen
2005-06-08 11:31     ` Jeff Creem
2005-06-10  9:49 ` Alfred Hilscher

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