![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как определить частоту процессора? [D5, Win95/98, WinME, Win2k]
Quest © (2002-01-28 08:46:00)Доброго времени суток!
Подскажите пожалуйста, какими тестами возможно определить частоту процессора, или это возможно сделать обращением к БИОС ... а может эта информация есть в реестре?
Dimaond Cat (2002-01-29 00:19:00) [1]unit UCPUSpd;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls, Buttons;
type
TFormCPUSpeed = class(TForm)
PageControl: TPageControl;
BitBtnStart: TBitBtn;
BitBtnStop: TBitBtn;
TabSheet: TTabSheet;
LabelCPUSpeed: TLabel;
LabelInfo: TLabel;
procedure BitBtnStartClick(Sender: TObject);
procedure BitBtnStopClick(Sender: TObject);
private
{ Private declarations }
Stop: Boolean;
public
{ Public declarations }
end;
var
FormCPUSpeed: TFormCPUSpeed;
implementation
{$R *.DFM}
function GetCPUSpeed: Double;
const
DelayTime = 500; // measure time in ms
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 // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
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 TFormCPUSpeed.BitBtnStartClick(Sender: TObject);
begin
BitBtnStart.Enabled := False;
BitBtnStop.Enabled := True;
Stop := False;
while not Stop do
begin
LabelCPUSpeed.Caption := Format("Скорость процессора: %f MHz", [GetCPUSpeed]);
Application.ProcessMessages;
end;
BitBtnStart.Enabled := True;
BitBtnStop.Enabled := False;
end;
procedure TFormCPUSpeed.BitBtnStopClick(Sender: TObject);
begin
Stop := True;
end;
end.
Quest (2002-01-28 09:08:00) [2]Спасибо, нашёл.
VuDZ (2002-01-28 08:53:00) [3]а может это есть в поиске?
как такая мысля?
ищи про точное измерение временных интервалов - там есть мой исходник на эту тему