Gnat and gprof support 
Author Message
 Gnat and gprof support

Hi

I am working with Gnat 3.12p on Windows NT 4.0.
I managed to get profiling with gcov working alright, however, as
I would need some more runtime information I would like to use gprof
instead. Did anybody manage to get gprof working under NT? I tried to
compile and link with the -pg option, compiling works well, however,
the linker complains about the unresolved symbol "mcount". Getting the
library libgmon.a from some other mingw32 distribution (maybe the wrong
distribution) did allow me to link and to execute the program, however,
no gmon.out file is being produced.
Are there any tricks to do this? Is it possible at all? As I've heard,
gprof is distributed with the Professional version of gnat, hence I
suppose it should be possible somehow.

I would appreciate any help on this topic!

Regards

Andreas Held
Gretag Imaging

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 02 Dec 2002 03:00:00 GMT  
 Gnat and gprof support



Quote:
> Hi

> I am working with Gnat 3.12p on Windows NT 4.0.
> I managed to get profiling with gcov working alright, however, as
> I would need some more runtime information I would like to use gprof
> instead. Did anybody manage to get gprof working under NT? I tried to

Under NT, GPROF is supported with GNAT 3.13 but not with GNAT 3.12.

Pascal.

--

--|------------------------------------------------------------
--| Pascal Obry                               Team-Ada Member |
--|                                                           |
--| EDF-DER-IPN-SID- T T I                                    |
--|                       Intranet: http://cln46gb            |

--| 1 Av Gnral de Gaulle  voice : +33-1-47.65.50.91         |
--| 92141 Clamart CEDEX     fax   : +33-1-47.65.50.07         |
--| FRANCE                                                    |
--|------------------------------------------------------------
--|
--|         http://perso.wanadoo.fr/pascal.obry
--|
--|   "The best way to travel is by means of imagination"



Mon, 02 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:

> I am working with Gnat 3.12p on Windows NT 4.0.
> I managed to get profiling with gcov working alright, however, as
> I would need some more runtime information I would like to use gprof
> instead. Did anybody manage to get gprof working under NT? I tried to
> compile and link with the -pg option, compiling works well, however,
> the linker complains about the unresolved symbol "mcount". Getting the

I looked into it about six months ago, and had similar luck. Cygnus
(now Red Hat) apparently has a version, but they don't distribute it
with the public version of Cygwin, so you'd probably have to purchase
GNUPro from them for $100 to get it (see
http://www.netsales.net/pk.wcgi/cygnus/home ). If it is also GPL'ed,
then theoreticaly you could just find someone else who has bought it.

I know Cygnus/Red Hat is well within their rights to put whatever they
want in their public distributions. But this is really annoying.
Whatever other complaints folks here may have about ACT, at least they
distribute all their stuff when they make a public distribution. I don't
see them holding back critical debugging tools in hopes of increasing
sales, at the expense of students and home hobbiests.

Of course the real solution to this problem is to move to Linux. :-)

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 02 Dec 2002 03:00:00 GMT  
 Gnat and gprof support


Quote:

> Under NT, GPROF is supported with GNAT 3.13 but not with GNAT 3.12.

> Pascal.

Thank you very much for the information. However, as I have seen several
references to GNAT 3.13 I wondered whether there is already a beta
version around somewhere? Is there any information on how 3.13 can be
expected? Is GNAT Professional actually 3.13 already?

Or on a more general note, what do people use if they need to profile
their Ada programs? To give you my background, I am a C/C++ programmer
(shame on me) who got the task to speed up somebody elses Ada program
by a factor of about 100! What tools would you use?

As always, I will be grateful for any tip or hint.

Regards

Andreas Held
Gretag Imaging

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 03 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:

> Thank you very much for the information. However, as I have seen several
> references to GNAT 3.13 I wondered whether there is already a beta
> version around somewhere? Is there any information on how 3.13 can be
> expected? Is GNAT Professional actually 3.13 already?

> Or on a more general note, what do people use if they need to profile
> their Ada programs? To give you my background, I am a C/C++ programmer
> (shame on me) who got the task to speed up somebody elses Ada program
> by a factor of about 100! What tools would you use?

> As always, I will be grateful for any tip or hint.

> Regards

> Andreas Held
> Gretag Imaging


Yipes..Factor of 100...I have pulled something like that off once but you
have to hope that the person who wrote the original code (probably in this
order):

1) I performing a lot of calculations that are not really needed at all.
2) Chose the wrong algorithms.
3) Wrote code in a very inefficient (approaching wrong) way
4) Strides through large multi-dimensional data in a cache unfriendly way
4) Put some delay statements in so that they could later be removed to speed
up code :)

In any case certainly a profiler is the first hope at an effort like this.
On certain embedded targets
where my vendor sold us a profiler that did not work on programs larger than
hello world, I have
attacked problems like this by instrumenting the code with calls to a high
accuracy timer around
various code blocks at the top level of the program execution (if practical
and if there is not much context
switching).

This works pretty well..It takes a little longer than a profiler but it is
not too bad.

Jeff Creem



Tue, 03 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:

> Or on a more general note, what do people use if they need to profile
> their Ada programs? To give you my background, I am a C/C++ programmer

I use whatever profiling tool is available for that platform. Currently
that means StethoScope for vxWorks, but that probably doesn't help you
out much. Ada programs typically integrate fairly well with profilers.
Probably that's becuase the compilers are designed to generate code that
works with the platforms' de{*filter*}, and profilers tend to be designed to
work off of the de{*filter*}'s interface.

Quote:
> (shame on me) who got the task to speed up somebody elses Ada program
> by a factor of about 100! What tools would you use?

I'd ask for a faster processor and more RAM.

--
T.E.D.

http://www.*-*-*.com/ ~dennison/Ted/TED.html

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 03 Dec 2002 03:00:00 GMT  
 Gnat and gprof support
Quote:

> Or on a more general note, what do people use if they need to profile
> their Ada programs? To give you my background, I am a C/C++ programmer
> (shame on me) who got the task to speed up somebody elses Ada program
> by a factor of about 100! What tools would you use?

This is going to depend a lot on your exact environment. For instance,
DEC (now Compaq) used to have a really spiffy runtime analysis tool that
worked with any of their compilers. However, if your target is some
embedded processor board, this will likely do you very little good. You
might want to come back with some specifics.

In general, a safe bet is that you are up against the 80/20 rule - 20%
of the code is consuming 80% of the time. So you want to identify what
that 20% is and then get creative about speeding it up. If the program
is not too huge, then analyzing it by reading the code may get you
there. For larger programs, that could take a while. Hence profiling
tools.

One thing you might be able to check is if the program is compute bound
or I/O bound. You probably can find that out with basic operating system
services that will tell you about wall time vs cpu time, etc. If it is
really heavy on I/Os, you might want to try to parallelize some of that
using tasks - find some computations you can do while waiting for I/O
and do both in separate tasks. This *may* help, depending on the
compiler and how it schedules tasks.

If you're compute bound, then you've got to find the subprograms that
are consuming all the cpu - you can bench check, you can instrument the
code or you can use a profiler of some sort. Instrumenting the code is a
good compromise if you can't find a profile tool. Of course, you need a
high resolution clock or you have to instrument only at the most gross
granularity to get results that will be helpful.

Post more detail - maybe more help will be available.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/

Visit my web site at:  http://www.mcondic.com/

"Some people think programming Windows is like nailing jello to the
ceiling... easy with the right kind of nails."

    --  Ivor Horton - Beginning Visual C++ 6
======================================================================



Tue, 03 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:

> Or on a more general note, what do people use if they need to profile
> their Ada programs? To give you my background, I am a C/C++ programmer
> (shame on me) who got the task to speed up somebody elses Ada program
> by a factor of about 100! What tools would you use?

2 OM! About the only way you can get that kind of a speed up is to use
better algorithms.

If a profiler is not available, and you're not already dealing with
times in the 10s of milliseconds (or faster) range, calls to
Ada.Real_Time.Clock will do the trick on most systems.

I once got a 3 OM speed-up on some Ada code, but that was a very
specific combination of factors.

--
Jeff Carter
"Perfidious English mouse-dropping hoarders."
Monty python & the Holy Grail



Tue, 03 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:
> Or on a more general note, what do people use if they need to profile
> their Ada programs? To give you my background, I am a C/C++ programmer
> (shame on me) who got the task to speed up somebody elses Ada program
> by a factor of about 100! What tools would you use?

A cheap but perfectly portable way is to use Ada.Calendar (or just
"Calendar" if you need compatibility with Ada 83).

Some variables of type "Time"

  T0, T1, T2: Time;

to catch the wall clock

    T1 := Clock;

(you can define/wrap a CPU_Clock function if the system provides it)

Eventually a ...

   package DurIO is new Fixed_IO(duration);      use DurIO;

to output the differences without conversion to float/integer:

    Put("structure et remplissage"); DurIO.Put(T1 - T0, aft=> 2);
    New_Line;
    Put("resolution");               DurIO.Put(T2 - T1, aft=> 2);
    New_Line;

Of course it is valid for "macroscopic" times (0.01 sec ?) so you
might have to scale your "experiences"

HTH

G.



Wed, 04 Dec 2002 03:00:00 GMT  
 Gnat and gprof support
Quote:

> 2 OM! About the only way you can get that kind of a speed up is to use
> better algorithms.

Sometimes you can get that just by changing the way you're storing data.
If its a disk bound app and you move the data to memory, you could
easily see this kind of performance improvement.

But I would agree that if someone expects 100x performance increase,
there has to be a belief that the original design was weak. You sure
aren't going to get there by inlining some procedure calls.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/

Visit my web site at:  http://www.mcondic.com/

"Some people think programming Windows is like nailing jello to the
ceiling... easy with the right kind of nails."

    --  Ivor Horton - Beginning Visual C++ 6
======================================================================



Wed, 04 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:

> Yipes..Factor of 100...I have pulled something like that off once but you
> have to hope that the person who wrote the original code (probably in this
> order):

> 1) I performing a lot of calculations that are not really needed at all.
> 2) Chose the wrong algorithms.
> 3) Wrote code in a very inefficient (approaching wrong) way
> 4) Strides through large multi-dimensional data in a cache unfriendly way
> 4) Put some delay statements in so that they could later be removed to speed
> up code :)

Could also be that the program makes bad use of strings and keep
triggering massive string copying.

Another problem might be I/O related. If the Ada I/O system do no
buffering, then there could be a lot of time to save by introducing
buffering.

Greetings,



Wed, 04 Dec 2002 03:00:00 GMT  
 Gnat and gprof support
Quote:

> 2 OM! About the only way you can get that kind of a speed up is to use
> better algorithms.

Sometimes you can get that just by changing the way you're storing data.
If its a disk bound app and you move the data to memory, you could
easily see this kind of performance improvement.

But I would agree that if someone expects 100x performance increase,
there has to be a belief that the original design was weak. You sure
aren't going to get there by inlining some procedure calls.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/

Visit my web site at:  http://www.mcondic.com/

"Some people think programming Windows is like nailing jello to the
ceiling... easy with the right kind of nails."

    --  Ivor Horton - Beginning Visual C++ 6
======================================================================



Wed, 04 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

|A cheap but perfectly portable way is to use Ada.Calendar (or just
|"Calendar" if you need compatibility with Ada 83).
|
|Some variables of type "Time"
|
|T0, T1, T2: Time;
|
|to catch the wall clock
|
|  T1 := Clock;
|

Some generic routines for doing this (as well as checking tasking
overhead, IIRC) that I wrote are available from AdPower.


http://purl.oclc.org/NET/ehudlamm <== My home on the web
Check it out and subscribe to the E-List- for interesting essays and more!



Thu, 05 Dec 2002 03:00:00 GMT  
 Gnat and gprof support

Quote:


> > Or on a more general note, what do people use if they need to profile
> > their Ada programs? To give you my background, I am a C/C++ programmer
> > (shame on me) who got the task to speed up somebody elses Ada program
> > by a factor of about 100! What tools would you use?

> ...
> In general, a safe bet is that you are up against the 80/20 rule - 20%
> of the code is consuming 80% of the time. So you want to identify what
> that 20% is and then get creative about speeding it up.

Given the goal of 100x speedup, you had better hope the 99/1 rule applies,
1% of the code is taking up 99% of the time, and you can eliminate that
1% of the code completely.

--

Technical Director, Commercial Division, AverStar (formerly Intermetrics)
(http://www.averstar.com/services/IT_consulting.html)  Burlington, MA  USA



Mon, 09 Dec 2002 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. gprof with gnat

2. GNAT & gprof

3. gnat 3.14 RAW Socket support ?

4. GNAT Support Costs

5. Low-end processor supported by gnat/gcc

6. Commercial support for GNAT

7. shared library support for GNAT.

8. Mouse and/or VGA Support Package for GNAT/MS DOS

9. In support of GNAT

10. Does GNAT support tasking yet?

11. Commercial use and support of GNAT - Opinions Wanted

12. ANNOUNCE: tkgnats-3.0.3 - GNATS Network and Win95/NT support

 

 
Powered by phpBB® Forum Software