From: Jason Molenda <jason-swarelist@molenda.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com, tromey@cygnus.com
Subject: Re: [RFA] patch to add 'maint profile-gdb' command
Date: Tue, 11 Sep 2001 01:37:00 -0000 [thread overview]
Message-ID: <20010911013721.A25996@shell17.ba.best.com> (raw)
In-Reply-To: <no.id>
On Tue, Sep 11, 2001 at 09:39:16AM +0200, Eli Zaretskii wrote:
> > monstartup provides some information, but not everything that full
> > profiling gets you.
>
> Sorry, I don't understand what you mean. AFAIK, a program linked with
> "-pg" calls monstartup in its startup code.
No, there is a lot more to a profiled program than that. The
compiler adds instrumentation in the code, sometimes simple calls
to mcount, sometimes more than that. It'll link in different
startup files (e.g. "gcrt1", "gcrtend"), and different versions of
libc (e.g. "c_p"), as well as the "gmon" library on some systems.
A simple call to monstartup() won't do that. The man page on a
FreeBSD system for monstartup() includes this text:
Programs that are not loaded with -pg may selectively collect profiling
statistics by calling monstartup() with the range of addresses to be pro-
filed.
[...]
Only functions in that range that have been compiled with the -pg
option to cc(1) will appear in the call graph part of the output; howev-
er, all functions in that address range will have their execution time
measured.
Calling monstartup() will get you the timing information, but not
the call graph information on a FreeBSD system, apparently. On a
Linux system, calling monstartup() doesn't get you anything unless
you compile with -pg.
The point of this is that profiling is a compile-time decision.
If you're not compiling for profiling, then there's little reason to
include calls to the profiling control functions.
I know it seems strange to ifdef the call to moncontrol() like
Tom's patch does, but I don't see any gain to using an autoconf
conditional -- the moncontrol() call is only going to work when
you're compiling specifically for profiling.
Think about how the code would look. A test to see if moncontrol()
works without -pg is not useful -- if we're on a system where
moncontrol() doesn't work without -pg, then we wouldn't set
HAVE_MONCONTROL (or whatever the macro setting is), but we _would_
be compiling -pg so we _would_ have moncontrol(). If we're adding a
test to see if moncontrol is available when -pg are used, then we
couldn't use the results of that in a non-pg gdb. The code which reads
#ifdef ENABLE_PROFILE
moncontrol (0);
#endif
Would now read
#ifdef ENABLE_PROFILE
#ifdef HAVE_MONCONTROL
moncontrol (0);
#endif
#endif
Unless we find some system which has profiling but doesn't have
moncontrol(), I don't see any benefit to using autoconf to detect
this.
Jason
next prev parent reply other threads:[~2001-09-11 1:37 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-10 0:30 Jason Molenda
2001-09-10 8:48 ` Andrew Cagney
2001-09-10 8:58 ` Eli Zaretskii
2001-09-10 9:04 ` Andrew Cagney
2001-09-10 11:52 ` Jason Molenda
2001-09-10 13:43 ` Eli Zaretskii
2001-09-10 13:59 ` Jason Molenda
2001-09-11 0:38 ` Eli Zaretskii
[not found] ` <no.id>
1999-06-15 20:10 ` Missing routines: gdb/top.c John David Anglin
2001-09-11 1:37 ` Jason Molenda [this message]
2001-09-11 1:57 ` [RFA] patch to add 'maint profile-gdb' command Eli Zaretskii
2001-09-12 0:00 ` Jason Molenda
2001-09-12 6:00 ` Eli Zaretskii
2001-09-12 7:42 ` Jason Molenda
2001-09-12 9:06 ` Eli Zaretskii
2001-09-12 11:58 ` Tom Tromey
2001-09-12 13:16 ` Jason Molenda
2008-08-06 19:24 ` [patch] Don't set DT_HP_DEBUG_PRIVATE in solib-pa64.c John David Anglin
2008-08-06 19:49 ` Mark Kettenis
2008-08-06 20:09 ` John David Anglin
2008-08-06 23:10 ` John David Anglin
2008-08-07 21:39 ` [patch] Only force private mapping of shared libraries in solib-som.c on HP-UX 10 and earlier John David Anglin
2008-08-08 10:48 ` Joel Brobecker
2008-08-08 15:34 ` John David Anglin
2008-08-09 14:37 ` Joel Brobecker
2008-08-09 18:59 ` John David Anglin
2008-08-08 19:30 ` ttrace: Protocal error John David Anglin
2008-08-08 20:16 ` John David Anglin
2008-08-09 14:52 ` Pedro Alves
2008-08-09 15:34 ` John David Anglin
2008-08-09 18:49 ` John David Anglin
2008-08-09 22:45 ` Pedro Alves
2008-08-09 22:46 ` Pedro Alves
2008-08-09 22:51 ` Pedro Alves
2008-08-09 23:19 ` John David Anglin
2008-08-09 22:48 ` Pedro Alves
2008-08-09 14:53 ` Joel Brobecker
2008-08-09 23:40 ` John David Anglin
2008-08-10 0:46 ` [4/7] Adjust the ttrace target (HP-UX) to always register the John David Anglin
2008-09-15 2:08 ` [PATCH] Fix dwarf register column to gdb register mapping John David Anglin
2008-09-15 2:24 ` [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache John David Anglin
2001-09-12 11:28 ` [RFA] patch to add 'maint profile-gdb' command Andrew Cagney
2001-09-12 11:43 ` Andrew Cagney
2001-09-16 17:45 ` [RFA] Version 2 of " Jason Molenda
2001-09-17 22:39 ` Andrew Cagney
2001-09-18 17:52 ` Fernando Nasser
2001-09-18 17:56 ` Andrew Cagney
2001-09-19 7:11 ` Fernando Nasser
2001-09-19 7:28 ` Eli Zaretskii
2001-09-19 9:29 ` Fernando Nasser
2001-09-19 11:30 ` Eli Zaretskii
2001-09-19 11:41 ` Andrew Cagney
2001-09-19 11:53 ` Kevin Buettner
[not found] ` <200109170536.HAA21988@is.elta.co.il>
2001-09-17 15:08 ` Michael Snyder
2001-09-17 22:43 ` Andrew Cagney
2001-09-17 23:59 ` Eli Zaretskii
2001-09-24 13:33 ` Jason Molenda
2001-09-24 14:41 ` Andrew Cagney
2001-09-24 14:58 ` Eli Zaretskii
2001-09-24 15:13 ` Andrew Cagney
2001-09-24 14:53 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010911013721.A25996@shell17.ba.best.com \
--to=jason-swarelist@molenda.com \
--cc=eliz@is.elta.co.il \
--cc=gdb-patches@sources.redhat.com \
--cc=tromey@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox