Processor Speed

Can anyone tell me  how to detect the type of CPU in a machine and its speed?  Say, a Pentium running at 166 mhz?

Thanks

Stu
LVL 1
SJohnsonAsked:
Who is Participating?
 
kwang080897Connect With a Mentor Commented:
Not long ago, I was looking for the same thing, and found the answer right here on Experts Exchange(Good Place)

I Dont know how this works, but i works thanks to someone on Experts Exchange (dont remember who).

A good advise :

Check some of the previos answered questionon this side:
There is a lot of good stuff (Cheap)



function tmainform.GetCPUSpeed: String;
var
  t: DWORD;
  mhi, mlo, nhi, nlo: DWORD;
  t0, t1, chi, clo, shr32: Comp;
begin
  try
    shr32 := 65536;
    shr32 := shr32 * 65536;

    t := GetTickCount;
    while t = GetTickCount do begin end;
    asm
      DB 0FH
      DB 031H
      mov mhi,edx
      mov mlo,eax
    end;

    while GetTickCount < (t + 1000) do begin end;
    asm
      DB 0FH
      DB 031H
      mov nhi,edx
      mov nlo,eax
    end;

    chi := mhi; if mhi < 0 then chi := chi + shr32;
    clo := mlo; if mlo < 0 then clo := clo + shr32;

    t0 := chi * shr32 + clo;

    chi := nhi; if nhi < 0 then chi := chi + shr32;
    clo := nlo; if nlo < 0 then clo := clo + shr32;

    t1 := chi * shr32 + clo;

    Result := Format('%.0f MHz', [(t1 - t0) / 1E6])

  except
    Result := 'Ukendt';
  end;
end;
0
 
JimBob091197Commented:
The "GetSystemInfo" api call will return the type of CPU (486, Pentium, etc.) but not the speed...

JB
0
 
SJohnsonAuthor Commented:
Thanks for that.  I actually found that just after posting this.  But I still need to find the speed.

Again, thanks.

Stuart
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
JimBob091197Commented:
I don't think Delphi declares all the constants for GetSystemInfo, but they are declared in Winnt.h if you have VC++.
0
 
buemohCommented:
GetSystemInfo can not detect the CPU-speed, but you can read the BIOS, because all newer BIOS store the CPU-speed.
NOTICE: to read BIOS-information you've to change the memory-address (under 640KByte) to selectors, which only can be used in WIN95 or WINNT.

Some years ago I wrote a small programn which does this. May be I find it.
0
 
SJohnsonAuthor Commented:
Thanks for that kwang.  Worked beautifully.

Again, thanks

Stuart
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.