From: SMTP%"leichter@lrw.com" 30-JAN-1995 08:40:00.87 To: EVERHART CC: Subj: RE: Need high resolution clock on Alpha From: Jerry Leichter X-Newsgroups: comp.os.vms Subject: RE: Need high resolution clock on Alpha Message-ID: <9501300217.AA25651@uu3.psi.com> Date: Sun, 29 Jan 95 21:03:39 EDT Organization: Info-Vax<==>Comp.Os.Vms Gateway X-Gateway-Source-Info: Mailing List Lines: 34 To: Info-VAX@Mvb.Saic.Com Does anyone know of a way to get the current time (or measure a time interval) on an Alpha running VMS to a greater accuracy than 0.01 second? On some VAXes, it is possible to sample the processor's ICR (Interval Count Register) which is incremented every microsecond and combine that value with the system time for more accurate timing. Perhaps the Alpha has something similar?? We need to determine the elapsed time to run sections of code. In most cases, the run times are < 0.01 seconds and it isn't feasible to repeat the code inside a loop until the run time becomes measurable. The exact internal operation of the system timer seems to be implementation- specific on Alphas to an even greater degree than on VAXes. About all the Alpha architecture specifies is that there is an interval timer that generates an interrupt (at IPL 22, if I recall), and that the interrupt must occur no less frequently then every millisecond. (It's also recommended that it occur no *more* frequently than once every 500 memory access times.) The actual interval can be read in the hardware RPB - a structure that appears to be unspecified further in the architecture. Alpha software is expected to do its own incrementing/decrementing of clock values and schedule actions at appropriate times. There is, however, another "timer" available on all Alphas: The Process Cycle Counter (and more generally but more expensively) the System Cycle Counter. The PCC is a fast 32-bit counter which can be accessed very cheaply by any code (RPCC instruction). The PCC counts cycles executed, and "is suitable for timing intervals on the order of nanoseconds and may be used for detailed performance characterization", according the the Alpha architecture book. There is no architected real-time rate for the PCC, but of course you can easily measure the rate on any given system. So, check out the RPCC, and the closely connected CALL_PAL RSCC PALcode instruction, which reads a 64-bit *System* Cycle Counter built by the software from the PCC. -- Jerry