Page 1 of 1
speed detection
Posted: Thu Oct 03, 2002 11:00 pm
by Stefan
Is there an memory location where I can find the speed in MHz of the processor, or I have to calculate it?
The calculation for frequency is the same for AMD processors, as for Intel?
Thank you!
RE:speed detection
Posted: Thu Oct 03, 2002 11:00 pm
by anton
There is no such mem location, you should calculate it. I don't understand, what you mean by "same for AMD processors, as for Intel". It's the same for all processors.
Anton.
RE:speed detection
Posted: Thu Oct 03, 2002 11:00 pm
by Stefan
I ment if the algorithm for calculating intel cpu frequency is the same for amd, cyrix, crusoe, etc.
RE:speed detection
Posted: Fri Oct 04, 2002 11:00 pm
by carbonBased
Yes, and as was said, it's the same for all processors.
A one MHz computer can perform 1 million operations per second, regardless of the manufacturer.
Jeff
RE:speed detection
Posted: Sat Oct 05, 2002 11:00 pm
by smaffy
...cycles per second.
one operation can take more than one cycle
(ghaak.. i feel odd!)
RE:speed detection
Posted: Sun Oct 06, 2002 11:00 pm
by Dave68
and conversely, modern super-scalar processors can do multiple instructions in one clock cycle - to say that every CPU can do one instruction in one clock cycle is amazingly wrong. That been said, Intel have an application note, primarily intended for information on how to use the CPUID instruction which is supported by all pentium + CPUs and some 486 (not 386 on as someone commented) which also contains a surprisingly accurate algorithm for MHz calculation, this also works extremely well on AMD CPUs, it may well hold up for other manufacturers as well but I have not personally tried it - note incidently that this routine uses internal performance counters in the CPU and does not just count how many instructions are executed in a second which cannot possibley work - hope this helps !
RE:speed detection
Posted: Sun Oct 06, 2002 11:00 pm
by Dave68
Sorry, forgot to mention that the ap note can be had at
http://developer.intel.com/design/xeon/ ... 161821.pdf
RE:speed detection - clarification...?
Posted: Sun Oct 06, 2002 11:00 pm
by carbonBased
Yes, indeed... sorry 'bout that. I made a point not to say "instruction," but ended up just using a synonym.
I would imagine, however, that timing a single clocked instruction such as nop (that's 1 cycle on all x86 cpus, right?) would afford a somewhat accurate example of clock speed. I've never done this, however, it's more a guess than a theory.
Of course, as was mentioned, modern cpus can execute multiple instructions concurrently (and indeed, out of order, I believe). Those CPUs, however, all support CPUID for clock speed detection (late 486s, and pentiums should support CPUID, I believe), and should probably be used.
However, my understanding of these systems is that only certain combinations of instructions can be executed concurrently (?). If this is true, it may still be possible to time based on instruction execution... although, obviously not as reliable as CPUID.
I'm curious, though. My old 486 was 100Mhz, but actually ran at 102Mhz. Which would CPUID return?
Lastly, the Linux sources can an accurate Mhz detection system (arch/i386/kernel/cpuid.c, I believe).
Jeff