Oder du nimmst den hochauflösenden Timer, der in jedem Windows eingebaut ist:
Delphi-Quellcode:
unit csPerformance;
interface
Type
TTimerID = 0..10;
Var
CounterFrequency : Int64;
Procedure StartTimer (aTimer : TTimerID);
Function StopTimer (aTimer : TTimerID) : Real;
implementation
uses Windows;
Var
Tmr :
Array [TTimerID]
Of Int64;
Procedure StartTimer (aTimer : TTimerID);
Begin
QueryPerformanceCounter(Tmr[aTimer]);
End;
Function StopTimer (aTimer : TTimerID) : Real;
Var
t : Int64;
Begin
QueryPerformanceCounter (t);
Result := (t - Tmr [aTimer])/CounterFrequency
End;
initialization
QueryPerformanceFrequency(CounterFrequency);
if CounterFrequency = 0
then CounterFrequency := 1;
end.