From owner-freebsd-sparc64@FreeBSD.ORG Sat Feb 11 23:19:47 2006 Return-Path: X-Original-To: freebsd-sparc64@freebsd.org Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F09E16A420 for ; Sat, 11 Feb 2006 23:19:47 +0000 (GMT) (envelope-from toa@pop.agri.ch) Received: from exsmtp01.agrinet.ch (exsmtp01.agrinet.ch [81.221.250.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD93B43D78 for ; Sat, 11 Feb 2006 23:19:38 +0000 (GMT) (envelope-from toa@pop.agri.ch) Received: from smtp.messaging.ch ([10.50.250.214]) by exsmtp01.agrinet.ch with Microsoft SMTPSVC(6.0.3790.211); Sun, 12 Feb 2006 00:19:37 +0100 Received: from [192.168.225.5] ([80.219.88.141]) by smtp.messaging.ch with id wPL81T00232ylCo0000000 for freebsd-sparc64@freebsd.org; Sun, 12 Feb 2006 00:20:09 +0100 X-IMP: RBL SORBS: 0.10, RBL MAPS_ORDB: 0.00, RBL SPAMCOP: 0.00, RBL SBL+XBL: 0.00, URL RHS: 0.00, URL SURBL: 0.00 Message-ID: <43EE7108.2040200@pop.agri.ch> Date: Sun, 12 Feb 2006 00:19:36 +0100 From: Andreas Tobler User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: Marius Strobl References: <20060205112432.A3868@newtrinity.zeist.de> <43E5D988.2070009@pop.agri.ch> <20060205122153.O68720@newtrinity.zeist.de> <43E5E70D.1090209@pop.agri.ch> <20060205132234.P68720@newtrinity.zeist.de> <43E60F45.4070004@pop.agri.ch> <20060205175656.S68720@newtrinity.zeist.de> <43E7B94E.3070805@pop.agri.ch> <20060207170055.B53619@newtrinity.zeist.de> <43E8FC6B.50705@pop.agri.ch> <20060208173546.D53619@newtrinity.zeist.de> In-Reply-To: <20060208173546.D53619@newtrinity.zeist.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Feb 2006 23:19:37.0116 (UTC) FILETIME=[A01BFDC0:01C62F61] Cc: freebsd-sparc64@freebsd.org Subject: Re: profiling with cc X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2006 23:19:47 -0000 Marius Strobl wrote: > On Tue, Feb 07, 2006 at 09:00:43PM +0100, Andreas Tobler wrote: >> Attached what I have so far. I built a libc_p.a and I can compile some >> code with -pg and do some investigations with gprof now. >> >> Done on an enterprise 2 2x296MHz 896MB. >> >> FreeBSD enterprise.andreas.nets 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Sun >> Feb 5 08:20:12 CET 2006 >> andreast@enterprise.andreas.nets:/usr/obj/home/andreast/devel/src/sys/GENERIC >> sparc64 >> >> What I do not know yet, is the fact, how reliably the figures are. >> > > It should work fine for C functions but the ENTRY macro in > sparc64/include/asm.h has to be changed to call _mcount() so profiling > info is also gathered for asm functions (e.g. those in libc). Ok, after some reading I got confused. Do you expect an ENTRY for normal operation and one for PROFILED work? Like netbsd does: #define ENTRY(name) _ENTRY(name); _PROF_PROLOGUE #define ENTRY_NOPROFILE(name) _ENTRY(name) Where _PROF_PROLOGUE is like: #define _PROF_PROLOGUE \ .data; .align 4; 1: .long 0; \ .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \ or %o0,%lo(1b),%o0; restore ? > >> Would you mind giving me some feedback if the attached is useful/needs >> rework? >> > > It has some style issues and inconsitencies (see style(9) and other > inline asm in e.g. sparc64/include/cpufunc.h). Otherwise it looks > good but probably needs a PIC version of the MCOUNT asm so it also > works when compiling with -p. Regarding inline asm, do you mean something like this: #define MCOUNT ({ \ __asm __volatile( \ " .global __mcount ; " \ "__mcount: ; " \ " add %o7, 8, %o1 ; " \ "1: call 2f ; " \ " nop ; " \ "2: add %o7, _mcount - 1b, %o2 ; " \ " ld [%o2], %o2 ; " \ " jmpl %o2, %g0 ; " \ " add %i7, 8, %o0 ; "); }) style 9 is good to have, but I seem to run in corner cases (my impression). It would be helpful for me to point out exactly what you mean I'm doing 'wrong'. Going through the code shows some inconsistencies and I am confused, as said ;) Thanks, Andreas