delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/28/03:29:17

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 28 Aug 2001 09:27:42 +0200 (MEST)
From: Carsten Thorenz <XZ550S AT gmx DOT de>
To: "Tim Prince" <tprince AT computer DOT org>
Cc: cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: Re: Profiling with GPROF considered buggy?
X-Priority: 3 (Normal)
X-Authenticated-Sender: #0010974549 AT gmx DOT net
X-Authenticated-IP: [193.174.162.184]
Message-ID: <3003.998983662@www55.gmx.net>
X-Mailer: WWW-Mail 1.5 (Global Message Exchange)
X-Flags: 0001

--========GMXBoundary3003998983662
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Tim!

> I thought that most linux implementations had the same timer resolution as
> Win2K installations.  I don't know that anyone has considered the
implications of gprof on WIn9x.

Linux seems to use 10ms as a standard, the same as WinNT4 (which I'm using)
but it 
can be changed to higher resolutions. 

Anyhow, it seems as if this is not only a problem with profiling.  I've
attached
the source for a _very_ simple test program. If you compile and profile it 
with -pg and gprof, you will immediately see some of Cygwins problems:

- The real total runtime is bigger than the one recorded in the flat profile
- The number of calls and the time per call is missing in the flat profile
- The call graph is completely useless

For comparison, this is what it looks like on a (rather slow) Linux-machine:

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ns/call  ns/call  name    
 50.01     37.63    37.63   400000 94075.00 94075.00  crunch2
 49.99     75.24    37.61   100000 376100.00 376100.00  crunch1

...

Call graph:

index % time    self  children    called     name
                                                 <spontaneous>
[1]    100.0    0.00   75.24                 main [1]
               37.63    0.00  400000/400000      crunch2 [2]
               37.61    0.00  100000/100000      crunch1 [3]
-----------------------------------------------
               37.63    0.00  400000/400000      main [1]
[2]     50.0   37.63    0.00  400000         crunch2 [2]
-----------------------------------------------
               37.61    0.00  100000/100000      main [1]
[3]     50.0   37.61    0.00  100000         crunch1 [3]
-----------------------------------------------

Here, the call graph shows the correct structure, furthermore the
timing records for the function itself and the children are correct.

Bye, Carsten









> ----- Original Message -----
> From: "Carsten Thorenz" <XZ550S AT gmx DOT de>
> To: <cygwin AT cygwin DOT com>
> Sent: Monday, August 27, 2001 6:37 AM
> Subject: Re: Profiling with GPROF considered buggy?
> 
> 
> > Hi Tim!
> >
> > Tim Prince wrote:
> > > Unless I am mistaken, cygwin doesn't include any libraries built with
> -pg.
> > > When I wish to profile with g77, I build a copy of
> > > libg2c with -pg as well as building all my code with -pg. When
> > > I profile numerical code built with gcc, I use a mathinline.h as well
> > > as a few of my own math functions to avoid spending much time in the
> > newlib libm.
> >
> > I'm using standard ANSI-C, no libraries are linked in right now.
> > What seems strange to me is that the behaviour of the profiler is _so_
> > different when used under Linux, OS/2 or on completely other platforms
> > (I tried HPUX, too). Ok, on HPUX the results differ, because it is a
> > completely different machine, but at least the tendencies are the
> > same for all of the above and provide very useful information. Not
> > so with Cygwin or Mingw.
> >
> > > I can't tell from your message which language you
> > > are using or whether you expect all the time to be spent in your own
> -pg
> > compiled code.
> >
> > As I wrote previously: The program doesn't communicate much.
> > It doesn't use libraries. It simply crunches numbers, but some
> > of the CPU-intensive functions do not appear in the profile. Again my
> > guess: The time spent in each of these functions for a single call is
> > very short, but they are called _many, many_ times. Maybe the timer
> > resolution
> > is too bad to catch this?
> >
> > Bye,
> >
> > Carsten
> >
> >
> >
> > --
> > GMX - Die Kommunikationsplattform im Internet.
> > http://www.gmx.net
> >
> >
> >
> > --
> > Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> > Bug reporting:         http://cygwin.com/bugs.html
> > Documentation:         http://cygwin.com/docs.html
> > FAQ:                   http://cygwin.com/faq/
> >
> 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

--========GMXBoundary3003998983662
Content-Type: application/octet-stream; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"

bG9uZyBpLCBqLCBrOw0KZG91YmxlIGEsIGIsIGM7IA0Kdm9pZCBjcnVuY2gxKHZvaWQpOw0Kdm9p
ZCBjcnVuY2gyKHZvaWQpOw0KDQppbnQgbWFpbih2b2lkKSB7DQogIGZvcihpPTA7aTwxMDAwMDA7
aSsrKSBjcnVuY2gxKCk7DQogIGZvcihpPTA7aTw0MDAwMDA7aSsrKSBjcnVuY2gyKCk7DQp9DQoN
CnZvaWQgY3J1bmNoMSh2b2lkKSB7DQogIGZvcihqPTA7ajw0MDA7aisrKQ0KICAgIGZvcihrPTE7
azwxMDtrKyspDQogICAgICBhID0gKGRvdWJsZSlqIC8gKGRvdWJsZSlrOw0KfQ0KDQp2b2lkIGNy
dW5jaDIodm9pZCkgew0KICBmb3Ioaj0wO2o8MTAwO2orKykNCiAgICBmb3Ioaz0xO2s8MTA7aysr
KQ0KICAgICAgYSA9IChkb3VibGUpaiAvIChkb3VibGUpazsNCn0NCg0KDQoNCg==


--========GMXBoundary3003998983662
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--========GMXBoundary3003998983662--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019