Hi all,
because of lack for ARequest start time, here is small patch for fcl-web that implements it during TRequest object creation phase.
It can be used for example:
- performance tracing in production (imlement procedure AfterResponse that logs request/reply duration)
- performance metrics inside Actions -during action you can use multiple times Application.log ...
You can read request start time via:
AResponse.Request.TimeStart
Patch against FPC trunk:
--- packages/fcl-web/src/base/httpdefs.pp (revision 31326)
+++ packages/fcl-web/src/base/httpdefs.pp (working copy)
@@ -415,6 +415,7 @@
FServerPort : String;
FContentRead : Boolean;
FContent : String;
+ FTimeStart : QWord;
function GetLocalPathPrefix: string;
function GetFirstHeaderLine: String;
Protected
@@ -457,6 +458,7 @@
Property ContentRange : String Index ord(hhContentRange) Read GetHeaderValue Write SetHeaderValue;
Property TE : String Index ord(hhTE) Read GetHeaderValue Write SetHeaderValue;
Property Upgrade : String Index ord(hhUpgrade) Read GetHeaderValue Write SetHeaderValue;
+ Property TimeStart:QWord Read FTimeStart; // Request arrival time
end;
@@ -1416,6 +1418,7 @@
FFiles:=CreateUploadedFiles;
FFiles.FRequest:=Self;
FLocalPathPrefix:='-';
+ FTimeStart:=GetTickCount64;
end;
function TRequest.CreateUploadedFiles: TUploadedFiles;