ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/fbintf/client/FBStatement.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/FBStatement.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC

# Line 42 | Line 42 | uses
42    FBTransaction;
43  
44   type
45 +  TPerfStatistics = array[psCurrentMemory..psFetches] of Int64;
46  
47    { TFBStatement }
48  
# Line 64 | Line 65 | type
65      FSingleResults: boolean;
66      FGenerateParamNames: boolean;
67      FChangeSeqNo: integer;
68 +    FCollectStatistics: boolean;
69 +    FStatisticsAvailable: boolean;
70 +    FBeforeStats: TPerfStatistics;
71 +    FAfterStats: TPerfStatistics;
72      procedure CheckHandle; virtual; abstract;
73      procedure CheckTransaction(aTransaction: ITransaction);
74      procedure GetDsqlInfo(info_request: byte; buffer: ISQLInfoResults); overload; virtual; abstract;
# Line 105 | Line 110 | type
110      function GetTransaction: ITransaction;
111      function GetDSQLInfo(Request: byte): ISQLInfoResults; overload;
112      procedure SetRetainInterfaces(aValue: boolean); virtual;
113 +    procedure EnableStatistics(aValue: boolean);
114 +    function GetPerfStatistics(var stats: TPerfCounters): boolean;
115      property ChangeSeqNo: integer read FChangeSeqNo;
116      property SQLParams: ISQLParams read GetSQLParams;
117      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
# Line 299 | Line 306 | begin
306    RetainInterfaces := aValue;
307   end;
308  
309 + procedure TFBStatement.EnableStatistics(aValue: boolean);
310 + begin
311 +  if FCollectStatistics <> aValue then
312 +  begin
313 +    FCollectStatistics := aValue;
314 +    FStatisticsAvailable := false;
315 +  end;
316 + end;
317 +
318 + function TFBStatement.GetPerfStatistics(var stats: TPerfCounters): boolean;
319 + begin
320 +  Result := FStatisticsAvailable;
321 +  if Result then
322 +  begin
323 +    stats[psCurrentMemory] := FAfterStats[psCurrentMemory];
324 +    stats[psDeltaMemory] := FAfterStats[psCurrentMemory] - FBeforeStats[psCurrentMemory];
325 +    stats[psMaxMemory] := FAfterStats[psMaxMemory];
326 +    stats[psRealTime] :=  FAfterStats[psRealTime] - FBeforeStats[psRealTime];
327 +    stats[psUserTime] :=  FAfterStats[psUserTime] - FBeforeStats[psUserTime];
328 +    stats[psReads] := FAfterStats[psReads] - FBeforeStats[psReads];
329 +    stats[psWrites] := FAfterStats[psWrites] - FBeforeStats[psWrites];
330 +    stats[psFetches] := FAfterStats[psFetches] - FBeforeStats[psFetches];
331 +    stats[psBuffers] :=  FAfterStats[psBuffers];
332 +  end;
333 + end;
334 +
335   end.
336  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines