Mail Archives: djgpp/2001/07/24/20:26:11
Daniel Friberg wrote:
> How do I go about doing this?
I am in the process of getting an IP release from my company for some
code to do just that. When that happens, I'll post the code somehow.
To satisfy your curiosity in the meantime, you measure the time elapsed
between two successive increments of the rawclock() function, using the
rdtsc instruction to get a timing in processor clocks, and multiply the
rdtsc timing by the rawclock() frequency, which is nominally
13.125E6/(65536.*11.) Hz. If you are willing to time many rawclock()
increments, you can get the processor clock rate accurate to a small
fraction of a percent.
On non-Intel processors that lack the rdtsc instruction, you have to use
tricks like measuring the timing of a div instruction for various
arguments. That's much less accurate.
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -