From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1faa282f2bd20fd4 X-Google-Attributes: gidfee84,public From: mogul@actitis.pa.dec.com (Jeffrey Mogul) Subject: Re: Real time clock (rpcc) Date: 1997/06/26 Message-ID: <5ose30$iu5@usenet.pa.dec.com>#1/1 X-Deja-AN: 252584470 Distribution: world References: Organization: DEC Western Research Newsgroups: comp.unix.osf.osf1 In article , Rob Kirkbride writes: |> I am trying to use rpcc to give me accurate times in order that I can |> trigger a timer every 50ms. This generates a SIGALRM and then I use the |> rpcc instruction to find whether I have am late servicing the timer and |> if so by how much. |> |> Also my code |> is not safe in a multi-processor system which I would like it to be. If you can tolerate a few microseconds of overhead, and if you are running Digital UNIX V4.0 or later, you can configure the kernel to provide microsecond resolution from the gettimeofday() system call. The kernel does this by using the RPCC instruction to interpolate between the 1024 Hz clock interrupts. As you observe, this can be tricky on a multiprocessor. However, my understanding is that the kernel code solves this problem, using a fairly subtle algorithm to make sure that the interpolation is done correctly. It might be very hard (or even impossible) to do this efficiently inside user-level code. For more details, see http://www.supelec.fr/decus/faq/faq-Digital-UNIX.html#P9 -Jeff