summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/profile.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-10-17 19:32:31 +0000
committerbde <bde@FreeBSD.org>1996-10-17 19:32:31 +0000
commita0f16401c5c8aa8537932ccc296e9253fca3debd (patch)
tree2f3c01bb1684b82e42c63c0a17d658ba5ded662b /sys/amd64/include/profile.h
parentd0d507caa9d6718e7f6699bae600f120362f59b7 (diff)
downloadFreeBSD-src-a0f16401c5c8aa8537932ccc296e9253fca3debd.zip
FreeBSD-src-a0f16401c5c8aa8537932ccc296e9253fca3debd.tar.gz
Improved non-statistical (GUPROF) profiling:
- use a more accurate and more efficient method of compensating for overheads. The old method counted too much time against leaf functions. - normally use the Pentium timestamp counter if available. On Pentiums, the times are now accurate to within a couple of cpu clock cycles per function call in the (unlikely) event that there are no cache misses in or caused by the profiling code. - optionally use an arbitrary Pentium event counter if available. - optionally regress to using the i8254 counter. - scaled the i8254 counter by a factor of 128. Now the i8254 counters overflow slightly faster than the TSC counters for a 150MHz Pentium :-) (after about 16 seconds). This is to avoid fractional overheads. files.i386: permon.c temporarily has to be classified as a profiling-routine because a couple of functions in it may be called from profiling code. options.i386: - I586_CTR_GUPROF is currently unused (oops). - I586_PMC_GUPROF should be something like 0x70000 to enable (but not use unless prof_machdep.c is changed) support for Pentium event counters. 7 is a control mode and the counter number 0 is somewhere in the 0000 bits (see perfmon.h for the encoding). profile.h: - added declarations. - cleaned up separation of user mode declarations. prof_machdep.c: Mostly clock-select changes. The default clock can be changed by editing kmem. There should be a sysctl for this. subr_prof.c: - added copyright. - calibrate overheads for the new method. - documented new method. - fixed races and and machine dependencies in start/stop code. mcount.c: Use the new overhead compensation method. gmon.h: - changed GPROF4 counter type from unsigned to int. Oops, this should be machine-dependent and/or int32_t. - reorganized overhead counters. Submitted by: Pentium event counter changes mostly by wollman
Diffstat (limited to 'sys/amd64/include/profile.h')
-rw-r--r--sys/amd64/include/profile.h36
1 files changed, 31 insertions, 5 deletions
diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h
index 4b9d51b..08d0dbd 100644
--- a/sys/amd64/include/profile.h
+++ b/sys/amd64/include/profile.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)profile.h 8.1 (Berkeley) 6/11/93
- * $Id: profile.h,v 1.6 1996/01/01 17:11:21 bde Exp $
+ * $Id: profile.h,v 1.7 1996/08/28 20:15:25 bde Exp $
*/
#ifndef _MACHINE_PROFILE_H_
@@ -97,18 +97,44 @@ typedef u_int fptrint_t;
*/
typedef int fptrdiff_t;
-__BEGIN_DECLS
#ifdef KERNEL
+
void mcount __P((fptrint_t frompc, fptrint_t selfpc));
+
+#ifdef GUPROF
+struct gmonparam;
+
+void nullfunc_loop_profiled __P((void));
+void nullfunc_profiled __P((void));
+void startguprof __P((struct gmonparam *p));
+void stopguprof __P((struct gmonparam *p));
#else
+#define startguprof(p)
+#define stopguprof(p)
+#endif /* GUPROF */
+
+#else /* !KERNEL */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
void mcount __P((void)) __asm("mcount");
static void _mcount __P((fptrint_t frompc, fptrint_t selfpc));
-#endif
+__END_DECLS
+
+#endif /* KERNEL */
#ifdef GUPROF
-u_int cputime __P((void));
+/* XXX doesn't quite work outside kernel yet. */
+extern int cputime_bias;
+
+__BEGIN_DECLS
+int cputime __P((void));
+void empty_loop __P((void));
void mexitcount __P((fptrint_t selfpc));
-#endif
+void nullfunc __P((void));
+void nullfunc_loop __P((void));
__END_DECLS
+#endif
#endif /* !_MACHINE_PROFILE_H_ */
OpenPOWER on IntegriCloud