[comp.os.msdos.programmer] How Do You Determine Processor Speed Inside A Program?

duff@evax.arl.utexas.edu (Robert Duff) (01/23/91)

I could not find this in the FAQ to see if this has been answered before, 
so please accept my apologies if it has:

I am trying to write an application that needs to run based on real time.
Unfortunately, my compiler, Turbo C 2.0, does not give enough time 
resolution with function "clock".  Therefore, I must using a counter
loop to achieve proper timing.  My problem is that I want this application
to be portable, and the variation in processor speeds of different 
computers causes faulty timing.

Is there a way to determine processor speed, in a relatively portable way,
from inside a program?  I have looked at a list of standard MsDOS
interrupts and have found nothing.

Thanks for any help.


-------------------------------------------------------------------------------
Remeber the immortal words of Socrates       |  Robert Duff
who said:                                    |  Automation & Robotics Research
          "I Drank WHAT!?"                   |  Institute - (817) 794-5957
                              Chris Knight   |  duff@evax.uta.edu

rcollins@altos86.Altos.COM (Robert Collins) (01/24/91)

In article <1991Jan22.170156.14647@evax.arl.utexas.edu> duff@evax.arl.utexas.edu (Robert Duff) writes:
>
>Is there a way to determine processor speed, in a relatively portable way,
>from inside a program?  I have looked at a list of standard MsDOS
>interrupts and have found nothing.
>
Yes there is.  Set up a timing loop, and time CPU instructions that have a
known execution (clock) time.



-- 
"Worship the Lord your God, and serve him only."  Mat. 4:10
Robert Collins                 UUCP:  ...!sun!altos86!rcollins
HOME:  (408) 225-8002
WORK:  (408) 432-6200 x4356