From 916c18962318796f8f0f31af138c4db749461ac7 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 1 Oct 2009 17:23:38 +0200 Subject: Added EpikTimer for performance timing. Just a temporary thing. --- src/HelpFile.pas | 1 - src/frm_main.pas | 24 +++++++++++++++++------- src/newview_fpgui.lpi | 8 +++++++- src/newview_fpgui.lpr | 4 ++-- src/nvUtilities.pas | 2 +- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/HelpFile.pas b/src/HelpFile.pas index 4f4de9f6..806fd042 100644 --- a/src/HelpFile.pas +++ b/src/HelpFile.pas @@ -240,7 +240,6 @@ begin for EntryIndex := 0 to _Header.ntoc-1 do begin pEntry := _Data + tocarray[EntryIndex]; - writeln('pEntry^.length = ', IntToStr(pEntry^.Length) + ' NumSlots=' + IntToStr(pEntry^.numSlots)); Topic := TTopic.Create( _Data, _Header, _Dictionary, diff --git a/src/frm_main.pas b/src/frm_main.pas index 75b6f9a9..20cad3ff 100644 --- a/src/frm_main.pas +++ b/src/frm_main.pas @@ -105,18 +105,28 @@ const implementation uses - fpg_dialogs, fpg_constants, nvUtilities, HelpTopic; + fpg_dialogs, fpg_constants, nvUtilities, HelpTopic, EpikTimer; {@VFD_NEWFORM_IMPL} procedure TMainForm.MainFormShow(Sender: TObject); +var + s, e: TDateTime; + t: TEpikTimer; begin bvlBody.Realign; if Paramcount > 0 then begin + t := TEpikTimer.Create(nil); + t.Start; +// s := now; OpenFile(ParamStr(1)); +// e := now; + t.Stop; + writeln(t.ElapsedDHMS); +// writeln(FormatDateTime('mm:ss.zz', e-s)); end; end; @@ -489,7 +499,7 @@ var HelpFile: THelpFile; Topic: TTopic; Begin - writeln('DisplayTopic >>>>'); + ProfileEvent('DisplayTopic >>>>'); if tvContents.Selection = nil then begin ShowMessage('You must select a topic first by clicking it.'); @@ -497,23 +507,23 @@ Begin end else Topic := TTopic(tvContents.Selection.Data); - writeln('Got Topic from Treeview'); + ProfileEvent('Got Topic from Treeview'); Memo1.Lines.Clear; ImageIndices := TList.Create; - writeln('Cleared memo...'); + ProfileEvent('Cleared memo...'); HelpFile := TopicFile(Topic); if HelpFile = nil then raise Exception.Create('Failed to get active HelpFile from Topic'); if HelpFile.HighlightWords <> nil then - writeln('highlightwords is ok'); + ProfileEvent('highlightwords is ok'); Text := nil; - writeln('Debug = ', Debug); + ProfileEvent('Debug = ' + BoolToStr(Debug)); if ImageIndices <> nil then - writeln('ImageIndices initialized'); + ProfileEvent('ImageIndices initialized'); Topic.GetText(HelpFile.HighlightWords, Debug, Text, diff --git a/src/newview_fpgui.lpi b/src/newview_fpgui.lpi index dbdefa59..fc6c00ff 100644 --- a/src/newview_fpgui.lpi +++ b/src/newview_fpgui.lpi @@ -32,7 +32,7 @@ - + @@ -98,12 +98,18 @@ + + + + + + diff --git a/src/newview_fpgui.lpr b/src/newview_fpgui.lpr index 08827df8..a43c80bd 100644 --- a/src/newview_fpgui.lpr +++ b/src/newview_fpgui.lpr @@ -6,8 +6,8 @@ uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} - Classes, fpg_main, frm_main, DataTypes, HelpFileHeader, HelpWindow, IPFEscapeCodes, - HelpTopic, CompareWordUnit, SearchTable, TextSearchQuery, nvUtilities, + Classes, EpikTimer, fpg_main, frm_main, DataTypes, HelpFileHeader, HelpWindow, + IPFEscapeCodes, HelpTopic, CompareWordUnit, SearchTable, TextSearchQuery, nvUtilities, nvNullObjects, HelpFile; diff --git a/src/nvUtilities.pas b/src/nvUtilities.pas index 1af9b6cf..a3315f1e 100644 --- a/src/nvUtilities.pas +++ b/src/nvUtilities.pas @@ -3,7 +3,7 @@ unit nvUtilities; {$mode objfpc}{$H+} // disable to remove debugging output -{$Define DEBUG} +{.$Define DEBUG} interface -- cgit v1.2.3-70-g09d2