From owner-freebsd-sparc64@FreeBSD.ORG Tue Feb 7 20:00:48 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 1EA6D16A422 for ; Tue, 7 Feb 2006 20:00:48 +0000 (GMT) (envelope-from toa@pop.agri.ch) Received: from exsmtp02.agrinet.ch (exsmtp02.agrinet.ch [81.221.252.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3019643D45 for ; Tue, 7 Feb 2006 20:00:46 +0000 (GMT) (envelope-from toa@pop.agri.ch) Received: from smtp.messaging.ch ([10.50.250.214]) by exsmtp02.agrinet.ch with Microsoft SMTPSVC(6.0.3790.211); Tue, 7 Feb 2006 21:00:45 +0100 Received: from [192.168.225.5] ([80.219.88.141]) by smtp.messaging.ch with id uk1A1T00132ylCo0000000 for freebsd-sparc64@freebsd.org; Tue, 07 Feb 2006 21:01:12 +0100 X-IMP: RBL SBL+XBL: 0.00, RBL SPAMCOP: 0.00, RBL MAPS_ORDB: 0.00, RBL SORBS: 0.10, URL RHS: 0.00, URL SURBL: 0.00 Message-ID: <43E8FC6B.50705@pop.agri.ch> Date: Tue, 07 Feb 2006 21:00:43 +0100 From: Andreas Tobler User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: Marius Strobl References: <43E3D228.6060801@pop.agri.ch> <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> In-Reply-To: <20060207170055.B53619@newtrinity.zeist.de> Content-Type: multipart/mixed; boundary="------------060303090809000004010002" X-OriginalArrivalTime: 07 Feb 2006 20:00:45.0079 (UTC) FILETIME=[2E68A270:01C62C21] 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: Tue, 07 Feb 2006 20:00:48 -0000 This is a multi-part message in MIME format. --------------060303090809000004010002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Marius Strobl wrote: > If you just cd to src/lib/libc and issue make it's expected that the > system headers, i.e. the headers in /usr/include, are used as that's > basically the same as issuing make on any other source in any other > location. "Magic" regarding using the headers below src instead of > the system headers only happens when running a buildworld as then > (as far as I'm aware) a GCC with a special standard include path is > built and used. Heh. Anyway, buildworld just for testing is a bit lot of overhead. I solved it with symlinking. >> P.S, even a pointer to read all through would be good. > > Well, I think if you want to know how the build process works there's > no way around reading the Makefiles in src and /usr/share/mk/*. Thanks. Ok, back to the topic. 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. Would you mind giving me some feedback if the attached is useful/needs rework? TIA, Andreas --------------060303090809000004010002 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="sparc-profile.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sparc-profile.diff" Index: sys/sparc64/include/profile.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/profile.h,v retrieving revision 1.8 diff -u -r1.8 profile.h --- sys/sparc64/include/profile.h 7 Jan 2005 02:29:22 -0000 1.8 +++ sys/sparc64/include/profile.h 7 Feb 2006 19:37:47 -0000 @@ -32,13 +32,16 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ -#define FUNCTION_ALIGNMENT 32 -#define _MCOUNT_DECL void mcount -#define MCOUNT +#define _MCOUNT_SYM "mcount" +#define _MCOUNT_ENTRY "_mcount" + +#define FUNCTION_ALIGNMENT 32 typedef u_long fptrdiff_t; #ifdef _KERNEL +#define _MCOUNT_DECL void mcount +#define MCOUNT #include @@ -63,6 +66,26 @@ #else /* !_KERNEL */ +#define _MCOUNT_DECL \ + static void mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \ + static void mcount + +#ifdef __GNUCLIKE_ASM +#define MCOUNT \ + __asm(".global " _MCOUNT_ENTRY); \ + __asm(_MCOUNT_ENTRY ":"); \ + __asm("add %i7, 8, %o0"); \ + __asm("sethi %hi(" _MCOUNT_SYM "), %o2"); \ + __asm("jmpl %o2 + %lo(" _MCOUNT_SYM "), %g0"); \ + __asm("add %o7, 8, %o1") ; + +#else /* !__GNUCLIKE_ASM */ +#define MCOUNT \ + void \ + mcount() \ + { \ + } +#endif /* __GNUCLIKE_ASM */ typedef u_long uintfptr_t; #endif /* _KERNEL */ --------------060303090809000004010002--