* Re: Profiling with GPROF considered buggy?
@ 2001-08-28 0:28 Carsten Thorenz
0 siblings, 0 replies; 5+ messages in thread
From: Carsten Thorenz @ 2001-08-28 0:28 UTC (permalink / raw)
To: Tim Prince; +Cc: cygwin
[-- Attachment #1: Type: text/plain, Size: 4042 bytes --]
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@gmx.de>
> To: <cygwin@cygwin.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
[-- Attachment #2: test.c --]
[-- Type: text/x-c, Size: 388 bytes --]
long i, j, k;
double a, b, c;
void crunch1(void);
void crunch2(void);
int main(void) {
for(i=0;i<100000;i++) crunch1();
for(i=0;i<400000;i++) crunch2();
}
void crunch1(void) {
for(j=0;j<400;j++)
for(k=1;k<10;k++)
a = (double)j / (double)k;
}
void crunch2(void) {
for(j=0;j<100;j++)
for(k=1;k<10;k++)
a = (double)j / (double)k;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Profiling with GPROF considered buggy?
@ 2001-08-27 6:37 Carsten Thorenz
2001-08-27 14:49 ` Tim Prince
0 siblings, 1 reply; 5+ messages in thread
From: Carsten Thorenz @ 2001-08-27 6:37 UTC (permalink / raw)
To: cygwin
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Profiling with GPROF considered buggy?
2001-08-27 6:37 Carsten Thorenz
@ 2001-08-27 14:49 ` Tim Prince
0 siblings, 0 replies; 5+ messages in thread
From: Tim Prince @ 2001-08-27 14:49 UTC (permalink / raw)
To: Carsten Thorenz, cygwin
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.
----- Original Message -----
From: "Carsten Thorenz" <XZ550S@gmx.de>
To: <cygwin@cygwin.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/
>
--
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Profiling with GPROF considered buggy?
@ 2001-08-27 4:04 Carsten Thorenz
2001-08-27 5:49 ` Tim Prince
0 siblings, 1 reply; 5+ messages in thread
From: Carsten Thorenz @ 2001-08-27 4:04 UTC (permalink / raw)
To: cygwin
Hi!
Recently I ran into problems profiling a scientific numerical program
using Cygwin. I've seen in the list that other people had similar problems,
but no clue was found.
About my problems: I've compiled and linked the whole program with -pg,
ran it and used gprof to to print the profile. Now about the strange things:
The cumulative runtime in the "flat profile" is _way_ to small. The example
I've used is running approximately 3 minutes, but only 15 seconds are
recorded in the profile. The program doesn't do much communication
with the outside world, it only crunches numbers during those 3 minutes.
Furthermore, the functions that I _know_ about using a lot of CPU-time
are not even listed in the flat profile.
The profiling works very fine with gcc on Linux and on OS/2, but
it doesn't work for WinNT4. I've tried it with both Cygwin and
Mingw, the problems are the same. So I guess it is not the external
library that causes the problems, but the timing routines within gcc.
My first guess: Are the timer intervals of the profiling to long, so
that it doesn't "catch" functions which are executed very fast, but
very often?
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Profiling with GPROF considered buggy?
2001-08-27 4:04 Carsten Thorenz
@ 2001-08-27 5:49 ` Tim Prince
0 siblings, 0 replies; 5+ messages in thread
From: Tim Prince @ 2001-08-27 5:49 UTC (permalink / raw)
To: Carsten Thorenz, cygwin
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 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.
----- Original Message -----
From: "Carsten Thorenz" <XZ550S@gmx.de>
To: <cygwin@cygwin.com>
Sent: Monday, August 27, 2001 4:04 AM
Subject: Profiling with GPROF considered buggy?
> Hi!
>
> Recently I ran into problems profiling a scientific numerical program
> using Cygwin. I've seen in the list that other people had similar problems,
> but no clue was found.
>
> About my problems: I've compiled and linked the whole program with -pg,
> ran it and used gprof to to print the profile. Now about the strange things:
>
> The cumulative runtime in the "flat profile" is _way_ to small. The example
> I've used is running approximately 3 minutes, but only 15 seconds are
> recorded in the profile. The program doesn't do much communication
> with the outside world, it only crunches numbers during those 3 minutes.
> Furthermore, the functions that I _know_ about using a lot of CPU-time
> are not even listed in the flat profile.
>
> The profiling works very fine with gcc on Linux and on OS/2, but
> it doesn't work for WinNT4. I've tried it with both Cygwin and
> Mingw, the problems are the same. So I guess it is not the external
> library that causes the problems, but the timing routines within gcc.
>
> My first guess: Are the timer intervals of the profiling to long, so
> that it doesn't "catch" functions which are executed very fast, but
> very often?
>
> 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/
>
--
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-28 0:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-28 0:28 Profiling with GPROF considered buggy? Carsten Thorenz
-- strict thread matches above, loose matches on Subject: below --
2001-08-27 6:37 Carsten Thorenz
2001-08-27 14:49 ` Tim Prince
2001-08-27 4:04 Carsten Thorenz
2001-08-27 5:49 ` Tim Prince
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).