Re: Changing the clock speed

From: Werner Vogels <vogels_at_nospam.org>
Date: Tue Feb 14 1995 - 12:20:18 PST

[I didn't read the sources on this so I apologize if I am slighty wrong]

The problem of getting accurate time information is not a problem of the
interrupt frequency. Quite a number of traditional OS indeed return time
information based on a time variable that gets incremented at every
clock interrupt. BSD even created a uniquetime call to assure that two
subsequent invocations of the time reading routine would return a unique
time (even though it didn't represent the real time).

The way to do it right is to *read* your clock/timer at every call and
use that information in combination with the global time variable to produce
a more accurate timer. On the 386 family machines you can also do this,
you can read out the 8253 register for timer0 to find out how many ticks
have passed since the last interrupt. This way you get a microsecond
timer resolution without changing you interrupt frequency.

example code for this: ftp://ftp.ee.lbl.gov/microtime-i386.tar.Z

--
Werner
Received on Tue Feb 14 11:42:32 1995

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:17 PDT