How To Get Your Cpu Speed ?

by admin on April 16, 2008

For you guys that need to know what is your cpu speed we got the snippet to get the cpu timer speed here …

function GetCPUSpeed: Double;
const
DelayTime = 500;
var
  TimerHi, TimerLo: DWORD;
  PriorityClass, Priority: Integer;
begin
  PriorityClass := GetPriorityClass(GetCurrentProcess);
  Priority := GetThreadPriority(GetCurrentThread);
  SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
  SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
  Sleep(10);
  asm
    dw 310Fh
    mov TimerLo, eax
    mov TimerHi, edx
  end;
  Sleep(DelayTime);
  asm
    dw 310Fh
    sub eax, TimerLo
    sbb edx, TimerHi
    mov TimerLo, eax
    mov TimerHi, edx
  end;
  SetThreadPriority(GetCurrentThread, Priority);
  SetPriorityClass(GetCurrentProcess, PriorityClass);
  Result := TimerLo / (1000000 * DelayTime);
end;

{ 1 comment… read it below or add one }

Yudi Suteja April 24, 2008 at 7:43 pm

Hi Eddy,

Congrats on your new website. I just knew your website today, so I visited here and it looks great. Keep up the good work.

Yudi

Reply

Leave a Comment

Previous post:

Next post: