From owner-freebsd-hackers Wed Jun 18 03:36:59 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id DAA10129 for hackers-outgoing; Wed, 18 Jun 1997 03:36:59 -0700 (PDT) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id DAA10118 for ; Wed, 18 Jun 1997 03:36:54 -0700 (PDT) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id LAA19607; Wed, 18 Jun 1997 11:59:14 +0200 From: Luigi Rizzo Message-Id: <199706180959.LAA19607@labinfo.iet.unipi.it> Subject: Re: High Resolution Timers, How? To: msmith@atrad.adelaide.edu.au (Michael Smith) Date: Wed, 18 Jun 1997 11:59:14 +0200 (MET DST) Cc: Shimon@i-Connect.Net, FreeBSD-Hackers@FreeBSD.ORG In-Reply-To: <199706180858.SAA21423@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Jun 18, 97 06:27:53 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Simon Shapiro stands accused of saying: > > > > I am in need for a precise, high resolution timer within the kernel. > > I need it to time certain instructions, functions, and I/O events. > > microtime() It is worth mentioning that the Pentium also has an accessible cycle counter, which can be read using the rdtsc asm instruction (or the equivalent rdtsc() function in the kernel). I don't know much about it except, but from what I have read&heard it counts CPU clock cycles, so you have to scale to the actual clock speed of your processor. See /sys/i386/include/cpufunc.h Cheers Luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________