42 |
|
FBTransaction; |
43 |
|
|
44 |
|
type |
45 |
+ |
TPerfStatistics = array[psCurrentMemory..psFetches] of Int64; |
46 |
|
|
47 |
|
{ TFBStatement } |
48 |
|
|
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; |
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; |
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 |
|
|