Currently, I am using MarkTime() and TimeFromMark() to measure the length of object-finding functions. However, the only two results I ever seem to get is 0ms or 16ms.
Is there a more exact timekeeping function I could use?

Currently, I am using MarkTime() and TimeFromMark() to measure the length of object-finding functions. However, the only two results I ever seem to get is 0ms or 16ms.
Is there a more exact timekeeping function I could use?
In SRL it seems the most common method is using GetSystemTime, something like
t := GetSystemTime;
repeat
//do action
until(GetSystemTime - t > 5000);
Would be worth a try. Though I use TimeFromMark and MarkTime as well
EDIT: Appears they are the same thing![]()
Last edited by Runescapian321; 08-20-2009 at 10:32 PM.




Alright, I'll give that a shot, thanks =)
what i do to time functions is:
Works well for me.Code:c:=GetSystemTime(); //code to time goes here c:=GetSystemTime()-c; writeln('[file/functionName()] Execution Time: ' + IntToStr(c) );

Let the code to speak!
SCAR Code:{*******************************************************************************
procedure MarkTime(var TimeMarker: Integer);
By: Stupid3ooo
Description: Sets TimeMarker to current system time
*******************************************************************************}
procedure MarkTime(var TimeMarker: Integer);
begin
TimeMarker := GetSystemTime;
end;
{*******************************************************************************
function TimeFromMark(TimeMarker: Integer): Integer;
By: Stupid3ooo
Description: returns Milliseconds since MarkTime was set
*******************************************************************************}
function TimeFromMark(TimeMarker: Integer): Integer;
begin
Result := GetSystemTime - TimeMarker;
end;
Yes, MarkTime and TimeFromMark does the same as you. So your have to he same 16ms thing, I suppose.

For benchmarking, just do like marktime, for i := 0 to 9999 do ..., writeln(inttostr(timefrommark/10000)); or something along the way.
You are going seriously hate reading my scripts then. I will do stuff like this to make it more readable (to me at least):
And my clay softener literally has a line that reads like this (I kid you not):Code:const SUCCESS = TRUE; FAIL = FALSE; if (DoSomeAction() = FAIL) then { Take corrective action here }
Code:for WaterType := WATERJUG to WATERBUCKET do

There are currently 1 users browsing this thread. (0 members and 1 guests)