Răsfoiți Sursa

+ added -vs for time stamping

git-svn-id: trunk@6176 -
florian 18 ani în urmă
părinte
comite
dac9896a6d
4 a modificat fișierele cu 28 adăugiri și 14 ștergeri
  1. 8 1
      compiler/comphook.pas
  2. 5 13
      compiler/compiler.pas
  3. 11 0
      compiler/globals.pas
  4. 4 0
      compiler/verbose.pas

+ 8 - 1
compiler/comphook.pas

@@ -52,6 +52,7 @@ Const
   V_Conditional  = $10000;
   V_Debug        = $20000;
   V_Executable   = $40000;
+  V_TimeStamps   = $80000;
   V_LevelMask    = $fffffff;
   V_All          = V_LevelMask;
   V_Default      = V_Fatal + V_Error + V_Normal;
@@ -156,7 +157,7 @@ const
 implementation
 
   uses
-   cutils, systems
+   cutils, systems, globals
    ;
 
 {****************************************************************************
@@ -248,6 +249,7 @@ const
   rh_warningstr = 'warning:';
 var
   hs : string;
+  hs2 : string;
 begin
   def_comment:=false; { never stop }
   hs:='';
@@ -324,6 +326,11 @@ begin
      else
       hs:=s;
    end;
+  if (status.verbosity and V_TimeStamps)<>0 then
+    begin
+      system.str(getrealtime-starttime:0:3,hs2);
+      hs:='['+hs2+'] '+s;
+    end;
 
   { Display line }
   if ((status.verbosity and (Level and V_LevelMask))=(Level and V_LevelMask)) then

+ 5 - 13
compiler/compiler.pas

@@ -209,22 +209,14 @@ function Compile(const cmd:string):longint;
      end;
   end;
 
-  function getrealtime : real;
-  var
-    h,m,s,s1000 : word;
-  begin
-    DecodeTime(Time,h,m,s,s1000);
-    result:=h*3600.0+m*60.0+s+s1000/1000.0;
-  end;
-
 var
-  starttime  : real;
   timestr    : string[20];
   linkstr    : string[64];
 {$ifdef SHOWUSEDMEM}
   hstatus : TFPCHeapStatus;
 {$endif SHOWUSEDMEM}
   ExceptionMask : TFPUExceptionMask;
+  totaltime : real;
 begin
   try
     try
@@ -257,10 +249,10 @@ begin
        { Show statistics }
        if status.errorcount=0 then
         begin
-          starttime:=getrealtime-starttime;
-          if starttime<0 then
-            starttime:=starttime+3600.0*24.0;
-          timestr:=tostr(trunc(starttime))+'.'+tostr(trunc(frac(starttime)*10));
+          totaltime:=getrealtime-starttime;
+          if totaltime<0 then
+            totaltime:=totaltime+3600.0*24.0;
+          timestr:=tostr(trunc(totaltime))+'.'+tostr(round(frac(totaltime)*10));
           if status.codesize<>-1 then
             linkstr:=', '+tostr(status.codesize)+' ' +strpas(MessagePChar(general_text_bytes_code))+', '+tostr(status.datasize)+' '+strpas(MessagePChar(general_text_bytes_data))
           else

+ 11 - 0
compiler/globals.pas

@@ -313,10 +313,13 @@ interface
        { actual values are defined in ncgutil.pas }
        nroftrashvalues = 4;
 
+    var
+      starttime  : real;
 
     function getdatestr:string;
     function gettimestr:string;
     function filetimestring( t : longint) : string;
+    function getrealtime : real;
 
     procedure DefaultReplacements(var s:string);
 
@@ -583,6 +586,14 @@ implementation
      end;
 
 
+   function getrealtime : real;
+     var
+       h,m,s,s1000 : word;
+     begin
+       DecodeTime(Time,h,m,s,s1000);
+       result:=h*3600.0+m*60.0+s+s1000/1000.0;
+     end;
+
 {****************************************************************************
                           Default Macro Handling
 ****************************************************************************}

+ 4 - 0
compiler/verbose.pas

@@ -295,6 +295,10 @@ var
                          status.verbosity:=status.verbosity and (not V_Executable)
                        else
                          status.verbosity:=status.verbosity or V_Executable;
+                 'S' : if inverse then
+                         status.verbosity:=status.verbosity and (not V_TimeStamps)
+                       else
+                         status.verbosity:=status.verbosity or V_TimeStamps;
                  'V' : PrepareReport;
                  end;
                 inc(i);