From f9df1c361be828a2c1111c7eabef12a68ebada44 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Tue, 15 Nov 2011 21:28:30 +0000 Subject: [PATCH] Adds the profiler initial stub git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2146 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/tappytux/tappydrawer.pas | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/applications/tappytux/tappydrawer.pas b/applications/tappytux/tappydrawer.pas index 95e4f955e..aa10617ba 100644 --- a/applications/tappytux/tappydrawer.pas +++ b/applications/tappytux/tappydrawer.pas @@ -63,6 +63,7 @@ type class procedure DrawImageWithTransparentColor( ADest: TLazIntfImage; const ADestX, ADestY: Integer; AColor: TFPColor; AImage: TFPImageBitmap); + class function DateTimeToMilliseconds(aDateTime: TDateTime): Int64; //function GetImage(ATile: TChessTile): TPortableNetworkGraphic; procedure HandleMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure HandleMouseUp(Sender: TObject; Button: TMouseButton; @@ -207,7 +208,11 @@ var X, Y: integer; i: Integer; lAnimation: TTappyTuxAnimation; + lStartTime, lTimeDiff: TDateTime; begin + {$IFDEF TAPPY_PROFILER} + lStartTime := Now; + {$ENDIF} lIntfImage := TLazIntfImage.Create(0, 0); lTmpBmp := TBitmap.Create; try @@ -242,6 +247,10 @@ begin lTmpBmp.Free; lIntfImage.Free; end; + {$IFDEF TAPPY_PROFILER} + lTimeDiff := Now - lStartTime; + // DebugLn(Format('[TwebLobbyServer.DataModuleRequest] END RequestClass=%s Performance: %7d ms', [Msg.ClassName, DateTimeToMilliseconds(lTimeDiff)])); + {$ENDIF} end; class procedure TTappyTuxDrawer.DrawImageWithTransparentColor(ADest: TLazIntfImage; @@ -281,6 +290,17 @@ begin end; end; +class function TTappyTuxDrawer.DateTimeToMilliseconds(aDateTime: TDateTime + ): Int64; +var + TimeStamp: TTimeStamp; +begin + {Call DateTimeToTimeStamp to convert DateTime to TimeStamp:} + TimeStamp:= DateTimeToTimeStamp (aDateTime); + {Multiply and add to complete the conversion:} + Result:= TimeStamp.Time; +end; + procedure TTappyTuxDrawer.HandleMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin