public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: Scott Dattalo <scott@dattalo.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: sid@sources.redhat.com
Subject: Re: Profiling
Date: Wed, 26 Jun 2002 10:41:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0206260906340.28584-100000@ruckus.brouhaha.com> (raw)
In-Reply-To: <20020625220816.A9043@redhat.com>

On Tue, 25 Jun 2002, Frank Ch. Eigler wrote:

> Hi -
> 
> On Tue, Jun 25, 2002 at 07:01:39PM -0700, Scott Dattalo wrote:
> > [...]
> > But the question I have is how do you build arm-elf-gprof [...]
> 
> The gprof program, for historical reasons, is sometimes excluded
> from a cross-targeted toolchain.  If you have a source tree with
> a Cygnus configure script at the top level, or a gcc source tree,
> then look for the "native_only" variable from the top-level
> configure.in, remove "gprof".  Then reconfigure the build tree,
> and run "make" in the gprof subdirectory.

That did it!

Just to be clear, this is what I did:

I untar'd the binutils-2.12.1 tar ball and edited 
binutils-2.12.1/configure.in. There's a line containing "native_only" that 
several packages (like gprof, sed,...); I removed gprof from that list.

I then followed the instructions here for building binutils:
http://sources.redhat.com/ecos/tools/linux-arm-elf.html

and arm-elf-gprof was created! Score!

---

Now for profiling...

My application uses the eCos RTOS and consequently is linked with it. I 
discovered that you *can't* compile the source for profiling by adding -pg 
option as part of the CFLAGS. Okay, I'm lying; you can compile with the 
-pg option, but you get unresolved references when you link. I don't know 
if eCos can be configured for profiling or not. I'll check into that 
later. For the time being though, I don't need it. I was able to extract 
profiling info just fine without compiling the sources with -pg. Here's 
what I did:

1) Configured SID for profiling. I followed the instructions in the SID 
documentation. Essentially, I added --gprof and --trace-counter to the SID 
invocation. BTW, I also told SID to creat a configuration file by adding 
--save-temps and --no-run to the invocation. Once you have a configuration 
file, you can invoke SID by: sid configuration_file.conf.

2) Run the application. Again, following the instructions on the SID web 
page, I started sid and ran my application:

sid myconf.conf &
arm-elf-gdb myexecutable

in gdb, add these commands:

 (gdb) target remote localhost:2000
 (gdb) load
 (gdb) break main
 (gdb) cont

(note that this is a copy-n-paste from the SID faq)

I then stepped through my code and exited gdb when I was done.

3) looking at the results. Upon exiting gdb, the file "gmon.prof" is 
created. This contains the profile information. Use gprof to look at it:

arm-elf-gprof --flat-profile myexecutable

Without --flat-profile, gprof reports: 

arm-elf-gprof: gmon.out file is missing call-graph data

Also, you need to specify the executable to gprof and not the gmon.out 
file.

The first few lines of my profile look like this:


Flat profile:

Each sample counts as 1 tick.
  %   cumulative   self              self     total           
 time      tick      tick    calls  Tt/call  Tt/call  name    
 16.87   1009.00  1009.00                             __unpack_f
 16.57   2000.00   991.00                             __pack_f
 13.21   2790.00   790.00                             _fpadd_parts
  9.73   3372.00   582.00                             __floatsisf

------

And now I can go off and do some work!

Thanks for the info Frank.

Scott

PS. Sorry about the abruptly ending e-mail I sent to you privately. I was 
composing it for the whole list, but ran out of time. I shouldn't of even 
sent it.

      reply	other threads:[~2002-06-26 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-25 17:03 Profiling Scott Dattalo
2002-06-25 18:37 ` Profiling Frank Ch. Eigler
2002-06-25 19:01   ` Profiling Scott Dattalo
2002-06-25 19:08     ` Profiling Frank Ch. Eigler
2002-06-26 10:41       ` Scott Dattalo [this message]

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=Pine.LNX.4.44.0206260906340.28584-100000@ruckus.brouhaha.com \
    --to=scott@dattalo.com \
    --cc=fche@redhat.com \
    --cc=sid@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).