functionRDTSC:Int64;assembler;
asm
db$0F,$31//opcodeforRDTSC
end;
functionRDQPC:Int64;
begin
QueryPerformanceCounter(result);
end;
functionCPUSpeed:Integer;
var
f,tsc,pc:Int64;
begin
ifQueryPerformanceFrequency(f)then
begin
Sleep(0);
pc:=RDQPC;
tsc:=RDTSC;
Sleep(100);
pc:=RDQPC-pc;
tsc:=RDTSC-tsc;
result:=round(tsc*f/(pc*1000000));
end
else
result:=-1;
end;
//Kullanimi:
procedureTForm1.Button1Click(Sender:TObject);
begin
label1.caption:=Format('%dMhz',[CPUSpeed]);
end;
Hiç yorum yok:
Yorum Gönder