[comp.sys.ibm.pc.misc] finding out MHz rate of processor

ajbanck@cs.ruu.nl (Arent Banck) (02/13/91)

Looking at the norton utilities 5.0, I saw that it checked the 
freq. at wich the processor runs.
Does anybody know if there is an easy way of finding this freq.
And where I can find this. Also, does anybody know how nu is checking
this frequency?

Thanx,

Arent Banck.
Email : ajbanck@cs.ruu.nl   
			      (Holland)
-- WARNING!!! The above opinions may be HAZARDOUS or FATAL if swallowed!!! --

mir@chorus.fr (Adam Mirowski) (02/13/91)

In article <4833@ruuinf.cs.ruu.nl>, ajbanck@cs.ruu.nl (Arent Banck) writes:
%% Looking at the norton utilities 5.0, I saw that it checked the 
%% freq. at wich the processor runs.
%% Does anybody know if there is an easy way of finding this freq.
%% And where I can find this. Also, does anybody know how nu is checking
%% this frequency?

You have to know how many clock ticks a given instruction takes,
then repeat it many times, for example in a loop. There is a 838
nanoseconds-resolution timer in the PC which can be used to measure
the spent time with precision. Then you divide the total number of
clocks by the time spent and you get the frequency.
In order to implement this efficiently, you also have to figure out
how to minimize memory access during the loop.
-- 
Adam Mirowski,  mir@chorus.fr (FRANCE),  tel. +33 (1) 30-64-82-00 or 74
Chorus systemes, 6, av.Gustave Eiffel, 78182 Saint-Quentin-en-Yvelines CEDEX

rcollins@altos86.Altos.COM (Robert Collins) (02/15/91)

In article <4833@ruuinf.cs.ruu.nl> ajbanck@cs.ruu.nl (Arent Banck) writes:
>Looking at the norton utilities 5.0, I saw that it checked the 
>freq. at wich the processor runs.
>Does anybody know if there is an easy way of finding this freq.
>And where I can find this. Also, does anybody know how nu is checking
>this frequency?
>
I would be very suprised if anybody at Norton has actually figured out
a way to check CPU frequency, regardless of the fact that it's not that
difficult.  At least until Norton 4.5, they were executing an instruction
mix and comparing the results to known results of IBM, et al and using 
that as a comparative rating in MHZ.  I haven't seen norton 5.0, but
from my past history of Norton, this has been the way they have done it
all along...so why change it on 5.0?

However, to answer your question, to determing CPU frequency, try executing
a sequence of instructions that perform NO memory or bus cycles, and take
longer to execute than prefetch time.  Time this with the 8254, and do some
simple math and you have the CPU clock frequency.

Of corse my solution sounds simplistic, but it is hardly trivial to
implement.  For example, my own source code is rather short, but the
comments that describe the algorithm in grubby detail are over a page
long.  In other words, you will have to know a lot about how the CPU
operates, how to program the hardware, and do LOTS of thinking on
this one.

Good luck, and no I won't post the algorithm.



-- 
"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

leonard@qiclab.scn.rain.com (Leonard Erickson) (02/23/91)

NU 5.0 cheerfully reports that my 10 MHZ XT clone has a V20 CPU
(true) running at 16 MHZ (say *what*?)

-- 
Leonard Erickson			leonard@qiclab.uucp
personal:	CIS: [70465,203]	70465.203@compuserve.com
business:	CIS: [76376,1107]	76376.1107@compuserve.com