PROCEDURE TMain.Test;
var v:double; i:integer; q1,q2,qs,qe,tsdelay:int64;
FUNCTION TimeStamp:int64;
asm
rdtsc
end;
FUNCTION TimeStampDelay:int64;
var i:integer; ts0,ts1:int64;
begin
result:=maxint;
for i:=1
to 3
do begin
ts0:=TimeStamp;
ts1:=TimeStamp;
dec(ts1,ts0);
if ts1<result
then result:=ts1;
end;
end;
begin
tsdelay:=TimeStampDelay;
q1:=High(int64);
for i:=1
to 10
do begin
qs:=TimeStamp;
v:=SmallToDouble($FFFFFFFF);
v:=SmallToDouble($EFFFFFFF);
v:=SmallToDouble($DFFFFFFF);
v:=SmallToDouble($CFFFFFFF);
v:=SmallToDouble($BFFFFFFF);
v:=SmallToDouble($AFFFFFFF);
v:=SmallToDouble($9FFFFFFF);
v:=SmallToDouble($8FFFFFFF);
v:=SmallToDouble($7FFFFFFF);
v:=SmallToDouble($6FFFFFFF);
v:=SmallToDouble($5FFFFFFF);
v:=SmallToDouble($4FFFFFFF);
v:=SmallToDouble($3FFFFFFF);
v:=SmallToDouble($2FFFFFFF);
v:=SmallToDouble($1FFFFFFF);
v:=SmallToDouble($0FFFFFFF);
qe:=TimeStamp;
dec(qe,qs);
if qe<q1
then q1:=qe;
end;
dec(q1,tsdelay);
q2:=High(int64);
for i:=1
to 10
do begin
qs:=TimeStamp;
v:=xSmallToDouble($FFFFFFFF);
v:=xSmallToDouble($EFFFFFFF);
v:=xSmallToDouble($DFFFFFFF);
v:=xSmallToDouble($CFFFFFFF);
v:=xSmallToDouble($BFFFFFFF);
v:=xSmallToDouble($AFFFFFFF);
v:=xSmallToDouble($9FFFFFFF);
v:=xSmallToDouble($8FFFFFFF);
v:=xSmallToDouble($7FFFFFFF);
v:=xSmallToDouble($6FFFFFFF);
v:=xSmallToDouble($5FFFFFFF);
v:=xSmallToDouble($4FFFFFFF);
v:=xSmallToDouble($3FFFFFFF);
v:=xSmallToDouble($2FFFFFFF);
v:=xSmallToDouble($1FFFFFFF);
v:=xSmallToDouble($0FFFFFFF);
qe:=TimeStamp;
dec(qe,qs);
if qe<q2
then q2:=qe;
end;
dec(q2,tsdelay);
showmessage(inttostr(q1
div 16)+#13+inttostr(q2
div 16));
end;