Skip to content
Permalink
Browse files

renamed QueryPerformanceCounterMicroSeconds() as QueryPerformanceMicr…

…oSeconds()
  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Feb 22, 2019
1 parent d146a55 commit bcb638c119e9cb32cc694a67349f20be1e46fa3c
Showing with 21 additions and 21 deletions.
  1. +6 −6 SQLite3/mORMot.pas
  2. +5 −5 SynCommons.pas
  3. +3 −3 SynFPCLinux.pas
  4. +2 −2 SynKylix.pas
  5. +4 −4 SynLog.pas
  6. +1 −1 SynopseCommit.inc
begin
with Server.fPublishedMethod[MethodIndex] do begin
if mlMethods in Server.StatLevels then begin
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
if Stats=nil then begin
Server.fStats.Lock; // use this global lock
try
Server.InternalLog('% %',[Name,Parameters],sllServiceCall);
CallBack(self);
if Stats<>nil then begin
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
dec(timeEnd,timeStart);
StatsFromContext(Stats,timeEnd,false);
if Server.StatUsage<>nil then
{$ifdef WITHLOG}
log := fLogClass.Enter('URI % % in=%',[Call.Method,Call.Url,KB(Call.InBody)],self);
{$endif}
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
fStats.AddCurrentRequestCount(1);
if Assigned(fOnDecryptBody) then
fOnDecryptBody(self,Call.InBody,Call.InHead,Call.Url);
IsInvalidHttpHeader(pointer(Call.OutHead), length(Call.OutHead)) then
Ctxt.Error('Unsafe HTTP header rejected [%]', [EscapeToShort(Call.OutHead)], HTTP_SERVERERROR);
finally
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
Ctxt.MicroSecondsElapsed := fStats.FromExternalQueryPerformanceCounters(timeEnd-timeStart);
{$ifdef WITHLOG}
InternalLog('% % % %/% %=% out=% in %',

begin
if mlInterfaces in TSQLRestServer(Rest).StatLevels then
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeStart);
// 1. initialize Inst.Instance and Inst.InstanceID
Inst.InstanceID := 0;
Inst.Instance := nil;
if InstanceCreation=sicSingle then
Inst.SafeFreeInstance(self); // always release single shot instance
if stats<>nil then begin
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(timeEnd);
dec(timeEnd,timeStart);
Ctxt.StatsFromContext(stats,timeEnd,false);
if Ctxt.Server.StatUsage<>nil then
{$ifdef UNICODE}TPrecisionTimer = record{$else}TPrecisionTimer = object{$endif}
private
fStart,fStop,fResume,fLast: Int64;
{$ifndef LINUX} // use QueryPerformanceCounterMicroSeconds() fast API
{$ifndef LINUX} // use QueryPerformanceMicroSeconds() fast API
fWinFreq: Int64;
{$endif}
/// contains the time elapsed in micro seconds between Start and Stop
procedure TPrecisionTimer.Start;
begin
FillZero(self,SizeOf(self));
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(fStart);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(fStart);
fLast := fStart;
end;
{$IFDEF FPC} {$POP} {$ELSE} {$HINTS ON} {$ENDIF}
procedure TPrecisionTimer.ComputeTime;
begin
{$ifdef LINUX}
QueryPerformanceCounterMicroSeconds(fStop);
QueryPerformanceMicroSeconds(fStop);
fTime := fStop-fStart;
fLastTime := fStop-fLast;
{$else}

procedure TPrecisionTimer.Pause;
begin
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(fResume);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(fResume);
dec(fResume,fStart);
inc(fPauseCount);
end;

procedure TPrecisionTimer.Resume;
begin
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(fStart);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(fStart);
fLast := fStart;
dec(fStart,fResume);
fResume := 0;
@@ -99,7 +99,7 @@ function getpagesize: Integer; cdecl; external 'c';
procedure QueryPerformanceCounter(out Value: Int64);

/// slightly faster than QueryPerformanceCounter() div 1000 - but not for Windows
procedure QueryPerformanceCounterMicroSeconds(out Value: Int64);
procedure QueryPerformanceMicroSeconds(out Value: Int64);

/// compatibility function, wrapping Win32 API high resolution timer
function QueryPerformanceFrequency(out Value: Int64): boolean;
@@ -284,7 +284,7 @@ procedure QueryPerformanceCounter(out Value: Int64);
Value := round(Value*mach_timecoeff);
end;

procedure QueryPerformanceCounterMicroSeconds(out Value: Int64);
procedure QueryPerformanceMicroSeconds(out Value: Int64);
begin
if mach_timenanosecond then
Value := mach_absolute_time div 1000 else begin
@@ -358,7 +358,7 @@ procedure QueryPerformanceCounter(out Value: Int64);
value := r.tv_nsec+r.tv_sec*C_BILLION;
end;

procedure QueryPerformanceCounterMicroSeconds(out Value: Int64);
procedure QueryPerformanceMicroSeconds(out Value: Int64);
var r : TTimeSpec;
begin
clock_gettime(CLOCK_MONOTONIC,@r);
@@ -106,7 +106,7 @@ TSystemTime = record
procedure QueryPerformanceCounter(var Value: Int64);

/// slightly faster than QueryPerformanceCounter() div 1000 - but not for Windows
procedure QueryPerformanceCounterMicroSeconds(out Value: Int64);
procedure QueryPerformanceMicroSeconds(out Value: Int64);

/// compatibility function, wrapping Win32 API high resolution timer
function QueryPerformanceFrequency(var Value: Int64): boolean;
@@ -192,7 +192,7 @@ procedure QueryPerformanceCounter(var Value: Int64);
value := r.tv_nsec+r.tv_sec*C_BILLION;
end;

procedure QueryPerformanceCounterMicroSeconds(out Value: Int64);
procedure QueryPerformanceMicroSeconds(out Value: Int64);
var r : TTimeSpec;
begin
clock_gettime(CLOCK_MONOTONIC,r);
@@ -4290,7 +4290,7 @@ class procedure TSynLog.DebuggerNotify(Level: TSynLogInfo;
procedure TSynLog.LogFileInit;
begin
{$ifdef LINUX}
QueryPerformanceCounterMicroSeconds(fStartTimestamp);
QueryPerformanceMicroSeconds(fStartTimestamp);
{$else}
QueryPerformanceCounter(fStartTimestamp);
if not QueryPerformanceFrequency(fFrequencyTimestamp) then begin
@@ -4371,7 +4371,7 @@ procedure TSynLog.LogFileHeader;
{$endif}
AddShort(' Freq=');
{$ifdef LINUX}
AddShort('1000000'); // taken by QueryPerformanceCounterMicroSeconds()
AddShort('1000000'); // taken by QueryPerformanceMicroSeconds()
{$else}
QueryPerformanceFrequency(fFrequencyTimestamp);
Add(fFrequencyTimestamp);
@@ -4457,7 +4457,7 @@ procedure TSynLog.LogCurrentTime;
begin
{$ifdef LINUX}
if fFamily.HighResolutionTimestamp then begin
QueryPerformanceCounterMicroSeconds(fCurrentTimestamp);
QueryPerformanceMicroSeconds(fCurrentTimestamp);
{$else}
if fFamily.HighResolutionTimestamp and (fFrequencyTimestamp<>0) then begin
QueryPerformanceCounter(fCurrentTimestamp);
@@ -4749,7 +4749,7 @@ procedure TSynLog.AddRecursion(aIndex: integer; aLevel: TSynLogInfo);
end;
if (aLevel<>sllNone) {$ifndef LINUX}and (fFrequencyTimestamp<>0){$endif} then begin
if not fFamily.HighResolutionTimestamp then begin // no previous TSynLog.LogCurrentTime call
{$ifdef LINUX}QueryPerformanceCounterMicroSeconds{$else}QueryPerformanceCounter{$endif}(fCurrentTimestamp);
{$ifdef LINUX}QueryPerformanceMicroSeconds{$else}QueryPerformanceCounter{$endif}(fCurrentTimestamp);
dec(fCurrentTimestamp,fStartTimestamp);
end;
case aLevel of
@@ -1 +1 @@
'1.18.5061'
'1.18.5062'

0 comments on commit bcb638c

Please sign in to comment.
You can’t perform that action at this time.