From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11595 invoked by alias); 26 Jun 2002 17:41:59 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 11579 invoked from network); 26 Jun 2002 17:41:56 -0000 Received: from unknown (HELO brouhaha.com) (209.66.107.17) by sources.redhat.com with SMTP; 26 Jun 2002 17:41:56 -0000 Received: (qmail 29931 invoked by uid 1032); 26 Jun 2002 17:41:59 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 26 Jun 2002 17:41:59 -0000 Date: Wed, 26 Jun 2002 10:41:00 -0000 From: Scott Dattalo X-X-Sender: sdattalo@ruckus.brouhaha.com To: "Frank Ch. Eigler" cc: sid@sources.redhat.com Subject: Re: Profiling In-Reply-To: <20020625220816.A9043@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-q2/txt/msg00039.txt.bz2 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.