Date: Tue, 07 Feb 2006 21:00:43 +0100 From: Andreas Tobler <toa@pop.agri.ch> To: Marius Strobl <marius@alchemy.franken.de> Cc: freebsd-sparc64@freebsd.org Subject: Re: profiling with cc Message-ID: <43E8FC6B.50705@pop.agri.ch> In-Reply-To: <20060207170055.B53619@newtrinity.zeist.de> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
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 <machine/cpufunc.h>
@@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43E8FC6B.50705>
