Ken Adam wrote:
>I can't see what use the smallest time is to you (since you can't make it
>happen every time without already knowing the result!)
on 12 June 2003, Rob Kennedy wrote in response to my posting:
> Many years ago I used:
>
> Function RDTSC : Comp;
> Var
> TimeStamp : Record
> case byte of
> 1 : (Whole:comp);
> 2 : (Lo, Hi : Longint);
> end;
> begin
> asm
> db $0F;
> db $31;
> mov [Timestamp.Lo],eax
> mov [Timestamp.Hi],edx
> end;
> Result := TimeStamp.Whole;
> end;
Rob replied:
"Now that Comp has fallen by the wayside due to Int64's introduction..."
function RDTSC: Int64;
// Read time-stamp code
asm
db $0f, $31
end;
"I've read that Delphi 6 and Kylix will actually recognize the mnemonic:"
function RDTSC: Int64;
asm
rdtsc
end;
Why not just count and average the number of CPU cycles for a
sufficient number of repetitions to determine which asm code is fastest?
Irwin Scollar
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi