Technology and Trends
 Linux Activists Mailing List Archives
  
From: veillard@imag.fr (Daniel Veillard)
Subject: [Q] Profiling problems ...
Date: Wed, 21 Apr 1993 08:37:32 GMT

  I've tried to profile a program under linux (SLS 099.4 + gcc 2.3.2)
I compiled the whole stuff with -pg (tried also with -p) but got
errors during link (linking with -pg too) , ld found the gcrt0.o
but failed to find libc_g.a . Since gprof and gcrt0.o exists in the
standard SLS I would expected to find libc_g.a too but this seems not
to be available anywhere.
  Any hints, or maybe I'm just made mistakes while compiling ??

Linux is great, with profiling it would be near perfect :-)

Daniel.

Daniel Veillard : Bull-IMAG Grenoble FRANCE
E-mail : veillard@imag.imag.fr

From: sct@dcs.ed.ac.uk (Stephen Tweedie)
Subject: Re: [Q] Profiling problems ...
Date: Wed, 21 Apr 1993 21:37:20 GMT

In article <C5tryK.M8C@imag.fr>, veillard@imag.fr (Daniel Veillard) writes:

>   I've tried to profile a program under linux (SLS 099.4 + gcc 2.3.2)
> I compiled the whole stuff with -pg (tried also with -p) but got
> errors during link (linking with -pg too) , ld found the gcrt0.o
> but failed to find libc_g.a . Since gprof and gcrt0.o exists in the
> standard SLS I would expected to find libc_g.a too but this seems not
> to be available anywhere.
>   Any hints, or maybe I'm just made mistakes while compiling ??

I have never had any trouble profiling code under Linux - and was
delighted to discover that it was so easy.

You don't really need a libc_g.a - it is mainly there to allow you to
debug the C library - so you can get away with making a link to the
libc.a.  (ln -sf /usr/lib/libc.a /usr/lib/libc_g.a)

> Linux is great, with profiling it would be near perfect :-)

Quite. :-)

Cheers,
 Stephen Tweedie.
---
Stephen Tweedie <sct@uk.ac.ed.dcs>   (Internet: <sct@dcs.ed.ac.uk>)
Department of Computer Science, Edinburgh University, Scotland.

From: marc@r-node.hub.org (Marc G Fournier)
Subject: Re: [Q] Profiling problems ...
Date: Mon, 26 Apr 1993 21:07:15 GMT

sct@dcs.ed.ac.uk (Stephen Tweedie) writes:

>In article <C5tryK.M8C@imag.fr>, veillard@imag.fr (Daniel Veillard) writes:

>>   I've tried to profile a program under linux (SLS 099.4 + gcc 2.3.2)
>> I compiled the whole stuff with -pg (tried also with -p) but got
>> errors during link (linking with -pg too) , ld found the gcrt0.o
>> but failed to find libc_g.a . Since gprof and gcrt0.o exists in the
>> standard SLS I would expected to find libc_g.a too but this seems not
>> to be available anywhere.
>>   Any hints, or maybe I'm just made mistakes while compiling ??

>I have never had any trouble profiling code under Linux - and was
>delighted to discover that it was so easy.

        what is profiling? :(

marc
-- 
Marc G. Fournier      | FREE        R-node Public Access Unix       FREE
Etobicoke, Ontario    | 2300+ newsgroups    network email  Linux 0.99p7A
voice: 249-4230       | shell accounts  24hrs  7 days/week  416-249-5366
marc@r-node.hub.org   | Telebit WorldBlazer/SupraModem 2400/P.P. v.32bis 


From: sct@dcs.ed.ac.uk (Stephen Tweedie)
Subject: Re: [Q] Profiling problems ...
Date: 27 Apr 93 17:27:10 GMT

In article <C64007.Exx@r-node.hub.org>, 
marc@r-node.hub.org (Marc G Fournier) writes:

> sct@dcs.ed.ac.uk (Stephen Tweedie) writes:

>>I have never had any trouble profiling code under Linux - and was
>>delighted to discover that it was so easy.

>       what is profiling? :(

It's a performance-tuning tool.  If you compile and link gcc/g++ code
with the "-pg" option, it gets extra code compiled in to produce a
variety of run-time statistics, such as how much time is spent in each
section of code, and which functions get called from which other
functions.

The output gets written to a file "gmon.out", which can be interpreted
by the "gprof" program to produce a human-readable report.

I'm not sure exactly where you would get gprof; it could be in the
binutils distribution, but I think I got mine from the MCC
distribution.

I develop C++ code on Sun4s and my 486/33 Linux box at home.  I had
added a profiling option to the Makefile a few months ago on the Sun,
and one day, just on impulse, decided to try it out at home.  I almost
fell of my seat grinning when it worked perfectly first time.

All credit to HJ for a superb job here.  Thanks!

Cheers,
 Stephen Tweedie.
---
Stephen Tweedie <sct@uk.ac.ed.dcs>   (Internet: <sct@dcs.ed.ac.uk>)
Department of Computer Science, Edinburgh University, Scotland.