Mengetahui kecepatan processor dengan Delphi

Mengetahui kecepatan processor dengan Delphi

Size
Price:

Read more

Berikut ini adalah source code untuk mendaparkan kecepatan processor komputer anda, source code Mendapatkan kecepatan Processor CPUdi tulis dengan bahasa pemrograman pascal dengan  Delphi 7




unit Unit_kecepatan_prosessor;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function GetCPUSpeed: Double;
var
  Form1: TForm1;

implementation

{$R *.dfm}

function GetCPUSpeed: Double;
const
  DelayTime = 500; // satuan waktu dalam milidetik
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); // tunda selama 10 ms
  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 / (1000.0 * DelayTime);
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text := Format('%f MHz', [GetCPUSpeed]);
end;

end.


hasil uju aplikasinya adalah sebagai berikut :




KUNJUNGI WEBSITE DAGANGAN KAMI KLIK PADA TEKS BERKEDIP INI

0 Reviews

Contact form

Name

Email *

Message *