codetools: mem stats plus keywordfunclist

git-svn-id: trunk@19928 -
This commit is contained in:
mattias 2009-05-11 16:52:30 +00:00
parent 20e525a22b
commit 2ffb8e87be
2 changed files with 17 additions and 2 deletions

View File

@ -5141,6 +5141,7 @@ begin
Node:=FPascalTools.FindSuccessor(Node); Node:=FPascalTools.FindSuccessor(Node);
end; end;
end; end;
Stats.Add('KeywordFuncLists.Global',KeywordFuncLists.CalcMemSize);
Stats.WriteReport; Stats.WriteReport;
Stats.Free; Stats.Free;
end; end;

View File

@ -168,11 +168,14 @@ var
function UpperCaseStr(const s: string): string; function UpperCaseStr(const s: string): string;
function IsUpperCaseStr(const s: string): boolean; function IsUpperCaseStr(const s: string): boolean;
function CalcMemSize: PtrUInt;
implementation implementation
var var
CharToIHash: array[char] of integer; CharToIHash: array[char] of integer;
UpWords: array[word] of word; UpWords: array[word] of word;
KeyWordLists: TFPList;
function UpperCaseStr(const s: string): string; function UpperCaseStr(const s: string): string;
var i, l, l2: integer; var i, l, l2: integer;
@ -200,6 +203,19 @@ begin
Result:=i>l; Result:=i>l;
end; end;
function CalcMemSize: PtrUInt;
var
i: Integer;
begin
Result:=0;
if KeyWordLists<>nil then begin
inc(Result,PtrUInt(KeyWordLists.InstanceSize)
+SizeOf(Pointer)*PtrUInt(KeyWordLists.Capacity));
for i:=0 to KeyWordLists.Count-1 do
inc(Result,TBaseKeyWordFunctionList(KeyWordLists[i]).CalcMemSize);
end;
end;
{ TBaseKeyWordFunctionList } { TBaseKeyWordFunctionList }
constructor TBaseKeyWordFunctionList.Create; constructor TBaseKeyWordFunctionList.Create;
@ -703,8 +719,6 @@ end;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
var KeyWordLists: TFPList;
procedure InternalInit; procedure InternalInit;
var var
c: char; c: char;