From: Stephen Tweedie (sct@dcs.ed.ac.uk)
Date: 04/27/93


From: sct@dcs.ed.ac.uk (Stephen Tweedie)
Subject: Re: [Q] Profiling problems ...
Date: 27 Apr 1993 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.