Skip to content

Commit

Permalink
Minor tweak to Delphi Timer utility
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusJohnson committed Oct 2, 2022
1 parent 3f4bc09 commit ff73799
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Delphi/BenchMark/DelphiBenchmark.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ begin
clip[0] := MakeRandomPath(maxWidth, maxHeight, edgeCount);

begin
DoTimer(timerResult);
InitTimer(timerResult);
solution := Intersect(subj, clip, frNonZero);
end;
timeTotal := timeTotal + timerResult;
Expand Down
20 changes: 18 additions & 2 deletions Delphi/Utils/Timer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ interface
Windows,
SysUtils;

(*******************************************************************************
* Example: *
* *
* var *
* time: double; *
* begin *
* ... *
* begin *
* InitTimer(time); *
* DoSomeLengthyOp(); *
* end; *
* Caption := Format('DoSomeLengthyOp took %1.3n secs', [time]); *
* .... *
* end; *
*******************************************************************************)

{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
Expand All @@ -16,7 +32,7 @@ interface
['{A50173E8-6497-4F83-B4A8-9C0D5D709834}']
end;

function DoTimer(out timeResult: double): ITimer;
function InitTimer(out timeResult: double): ITimer;

implementation

Expand Down Expand Up @@ -81,7 +97,7 @@ class function TTimer.Release(Inst: PTimerData): Integer; stdcall;
Dispose(Inst);
end;

function DoTimer(out timeResult: double): ITimer;
function InitTimer(out timeResult: double): ITimer;
var
timer: PTimerData;
begin
Expand Down

0 comments on commit ff73799

Please sign in to comment.