Page 1 of 1
cpu type over 486 & speed
Posted: Wed May 14, 2003 4:11 pm
by udarkman
Is there a way to find the cpu type over 80486. All the algorithms I found checks cpu type up to 486 and then gives the cpuid result. how can I find type of Cpu, such as Pentium II, Pentium III, Celeron, AMD..??
And as a second question, how can I measure the speed of CPU??
Thanks for any help, example, advice or web addr...
Even for good google search keys except: cpu,type,speed:))
Re:cpu type over 486 & speed
Posted: Wed May 14, 2003 6:05 pm
by slacker
look at cpuid in intel manual
Re:cpu type over 486 & speed
Posted: Wed May 14, 2003 11:07 pm
by udarkman
slacker wrote:
look at cpuid in intel manual
I wonder if intel manual includes AMD specific information. But as I learnt, some AMD processors supports CPUID instruction.
And what about speed?how would you measure the speed of CPU?
Re:cpu type over 486 & speed
Posted: Wed May 14, 2003 11:19 pm
by gtsphere
i doubt Intel would carry such knowledge of AMD. try amd's website.
-GT
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 1:37 am
by Pype.Clicker
the CPUID instruction is generic. It will help you defining the CPU manufacturer (as it's returned
in texto by the processor whether it's GenuineIntel or AuthenticAMD
) and various misc. info like does it support MMX, SSE, PGE, etc.
Now, if you have 486 only, CPUID will raise a InvalidOpcode exception, because it's an instruction that has been introduced on the Pentium only. (i.e. supported on all Pentium compatible processors, including AMD K6 and K7 family)
To determine your processor speed, the best way is to combine the use of a timer interrupt and the use of RDTSC instruction (also pentium-specific) or a counting loop that consumes a well-known amount of CPU cycles.
You should find more infos about this in
this thread and in
this other one
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 2:10 am
by Tim
Later 486 chips do support CPUID, so check the ID bit in EFLAGS (was it EFLAGS? or was it some other register? -- check in Intel manual).
CPUID can also give you the CPU speed in MHz. Alternatively, there was a thread in alt.os.development recently about Pype.Clicker's way of doing it.
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 3:22 am
by Pype.Clicker
i gave a quick look at
http://grafi.ii.pw.edu.pl/gbm/x86/cpuid ... tidroutine , but i don't see any information about speed. Other documents give a table of stepping information and the speed of the processor, but just relying on that table cannot take into account over/underclocked processors.
Or is it something i'm just missing ?
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 3:25 am
by Pype.Clicker
Tim Robinson wrote:
Later 486 chips do support CPUID, so check the ID bit in EFLAGS (was it EFLAGS? or was it some other register? -- check in Intel manual).
from the above link:
Checking for CPUID support
This is quite easy. Try to change the value of CPUID bit (bit 21) in EFLAGS. If the bit can be toggled, CPUID is supported and shall be used for precise identification. On Cyrix chips the bit cannot be toggled if not explicitly allowed - please use this link ....(not ready yet)
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 7:58 am
by udarkman
Pype.Clicker wrote:
a counting loop that consumes a well-known amount of CPU cycles.
Is there a common-loop-pattern? I may use RDTSC but I dont want the procedure to be pentium specific..
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 1:13 pm
by udarkman
For instance, you have IRQ0@1KHz, and some code looking like
here:
inc [counter]
cmp [done],1
jne here
cpu_speed = [counter] * $x
using $x cpu cycles for each loop.
Is it possible to calculate the total cycle to execute this loop once? I think the total cycle is not the sum of each instructions execute cycles, due to the pipeline. Arent I right?
Re:cpu type over 486 & speed
Posted: Thu May 15, 2003 4:31 pm
by Tim
On any CPU that doesn't have RDTSC, you can count instruction cycles. On more modern pipelined CPUs you have to rely on RDTSC to count cycles.