Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA28100; Wed, 20 Dec 95 02:00:25 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA23138; Wed, 20 Dec 95 02:00:26 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.6.12/8.6.9) id AAA16421; Wed, 20 Dec 1995 00:12:06 -0500
Received: from BALVENIE.PDL.CS.CMU.EDU by pain.lcs.mit.edu (8.6.12/8.6.9) with SMTP id AAA16384 for <netbsd-developers@netbsd.org>; Wed, 20 Dec 1995 00:05:13 -0500
Received: from localhost by BALVENIE.PDL.CS.CMU.EDU id aa28827;
          20 Dec 95 0:04 EST
To: netbsd-developers@netbsd.org
Cc: cgd@BALVENIE.PDL.CS.CMU.EDU
X-Copyright: Copyright 1995, Christopher G. Demetriou.  All rights reserved.
X-Notice: Duplication and redistribution prohibited without consent of
	  the author.
Subject: interface to put MD hooks into 'hardclock'?
Date: Wed, 20 Dec 1995 00:04:41 -0500
Message-Id: <29373.819435881@BALVENIE.PDL.CS.CMU.EDU>
From: Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU>
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG

hi folks...

I'm wondering if anybody has any good ideas for ways to put
machine-dependent hooks into hardclock()...

In particular, what i need is something so that i can say:

Index: kern_clock.c
===================================================================
RCS file: /usr/users/cgd/NetBSD/cvs/src/sys/kern/kern_clock.c,v
retrieving revision 1.3
diff -u -r1.3 kern_clock.c
--- 1.3	1995/03/06 17:27:17
+++ kern_clock.c	1995/12/20 02:25:50
@@ -203,8 +203,10 @@
 		if (tickfixcnt > tickfixinterval) {
 			delta += tickfix;
 			tickfixcnt = 0;
+			reset_cc_offset();
 		}
-	}
+	} else
+		reset_cc_offset();
 	if (timedelta != 0) {
 		delta = tick + tickdelta;
 		timedelta -= tickdelta;


that is, if tickfix == 0, then run that function every time a tick
happens, otherwise run it when a tick causes tickfix to be applied...


i've converted the Alpha to use the Process Cycle Counter when doing
microtime(), and want to sync a cycle count 'base' with the clock
every time the clock and the cycle counter should theoretically match.
(that happens to be every time a tickfix is applied, if tickfix != 0,
or at every clock tick.)


I'm also vaguely interested in adding something to hardclock so that
it'll accumulate a clock tick into an interrupt counter, so that i
don't have to jump through another function when going to hardclock...


any ideas on how to do this reasonably?  I'd rather not #ifdef alpha,
because at least some of these hooks could potentially be useful on
other ports.  (the pmax has a TC cycle counter that can be used for
timing, apparently, and pentiums have cycle counters ... i dunno about
anything else.)


it's nice to get ~10us resolution in userland via gettimeofday()... 8-)


chris
