From owner-freebsd-hackers Thu Jul 15 9:49:39 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from vulture.dmem.strath.ac.uk (vulture.dmem.strath.ac.uk [130.159.232.158]) by hub.freebsd.org (Postfix) with ESMTP id 48257155B8 for ; Thu, 15 Jul 1999 09:49:24 -0700 (PDT) (envelope-from jen@vulture.dmem.strath.ac.uk) Received: from vulture.dmem.strath.ac.uk (vulture [130.159.232.158]) by vulture.dmem.strath.ac.uk (8.9.3/8.9.3) with ESMTP id RAA07108 for ; Thu, 15 Jul 1999 17:48:04 +0100 (BST) (envelope-from jen@vulture.dmem.strath.ac.uk) Message-ID: <378E10C4.9AD7979E@vulture.dmem.strath.ac.uk> Date: Thu, 15 Jul 1999 17:48:04 +0100 From: Jennifer Clark X-Mailer: Mozilla 4.6 [en] (X11; I; FreeBSD 3.2-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Advice on deriving accurate time values from the kernel? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I am in the process of developing a device driver for the purpose of stepper motor control. The timing of each pulse is determined by external timing hardware on an I/O board, which will fire an interrupt after the time requested. Using this method, I am able to generate streams of pulses at approximately 5000Hz on a Pentium II 400MHz system. Everything seems to be working well, but I'd really like to gather some accurate timing data in order to derive some statistics to from the system. Intuition tells me I'll need a clock with a tick rate of at least 20000 Hz to derive this. So, is such a thing available in the kernel? I've searched through various mailing list archives and have found reference to the "HZ" option to the kernel, which works to a point. However, it is not ideal as setting HZ to high values generates far too much kernel overhead. Also being considered is additional external timing hardware, but this is something I'd rather avoid for many reasons. What I am after is not a "timer" as such - all I need to do is derive a time value at an initial time, and a subsequent value at a later time. I've used "getmicrouptime", but this appears dependent on the "Hz" option, and as such is of limited use. I've just had some input from a colleauge who has suggested using the Pentium profiling registers, which we are currently investigating... Any advice gratefully received, -- Jennifer Clark http://telepresence.dmem.strath.ac.uk http://www.crmjewellery.co.uk http://www.furniturenet.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message