Mail Archives: djgpp/1999/01/05/17:05:18
Eli Zaretskii wrote:
> DJGPP has a library function which does all that for you. It is
> called `uclock'. You get a result that has a 840 nsec granularity.
Under DOS, uclock() seems to work fine. Unfortunately, under Win95 uclock()
exhibits errors on the 55-ms level, which I have been unable to completely
diagnose. I sometimes even get *negative* times for events. Since my own
timer routine failed similarly, I have concluded that Win95 (in its infinite
wisdom) is periodically tampering with the 8254, so I gave up on uclock(), and
use RDTSC for high-resolution timing. With a little work, one can measure the
CPU clock speed by comparing RDTSC against the advancing 55-ms tick count from
rawclock(), so the RDTSC output can be converted to seconds. Win95 appears to
leave the operation of RDTSC completely unmolested.
Unfortunately, RDTSC is an illegal instruction on some x86 clones (maybe all
of them?).
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -