Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 1997 11:59:14 +0200 (MET DST)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        msmith@atrad.adelaide.edu.au (Michael Smith)
Cc:        Shimon@i-Connect.Net, FreeBSD-Hackers@FreeBSD.ORG
Subject:   Re: High Resolution Timers, How?
Message-ID:  <199706180959.LAA19607@labinfo.iet.unipi.it>
In-Reply-To: <199706180858.SAA21423@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Jun 18, 97 06:27:53 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 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/
_____________________________|______________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706180959.LAA19607>