Ignore:
Timestamp:
Apr 17, 2019, 10:42:18 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Updated Graphics32 library.
Location:
GraphicTest/Packages/Graphics32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/Graphics32

    • Property svn:ignore set to
      lib
  • GraphicTest/Packages/Graphics32/GR32_System.pas

    r450 r522  
    7070    function ReadNanoseconds: string;
    7171    function ReadMilliseconds: string;
    72     function ReadSeconds: String;
     72    function ReadSeconds: string;
     73
    7374    function ReadValue: Int64;
    7475  end;
     
    127128
    128129function TPerfTimer.ReadNanoseconds: string;
    129 var
    130   t : timeval;
    131 begin
    132   fpgettimeofday(@t,nil);
    133    // Build a 64 bit microsecond tick from the seconds and microsecond longints
    134   Result := IntToStr( ( (Int64(t.tv_sec) * 1000000) + t.tv_usec ) div 1000 );
     130begin
     131  Result := IntToStr(ReadValue);
    135132end;
    136133
    137134function TPerfTimer.ReadMilliseconds: string;
    138 var
    139   t : timeval;
    140 begin
    141   fpgettimeofday(@t,nil);
    142    // Build a 64 bit microsecond tick from the seconds and microsecond longints
    143   Result := IntToStr( ( (Int64(t.tv_sec) * 1000000) + t.tv_usec ) * 1000 );
     135begin
     136  Result := IntToStr(ReadValue div 1000);
    144137end;
    145138
    146139function TPerfTimer.ReadSeconds: string;
    147 var
    148   t : timeval;
    149 begin
    150   fpgettimeofday(@t,nil);
    151    // Build a 64 bit microsecond tick from the seconds and microsecond longints
    152   Result := IntToStr( ( (Int64(t.tv_sec) * 1000000) + t.tv_usec ) );
     140begin
     141  Result := IntToStr(ReadValue div 1000000);
    153142end;
    154143
    155144function TPerfTimer.ReadValue: Int64;
    156 var t : timeval;
    157 begin
    158   fpgettimeofday(@t,nil);
    159    // Build a 64 bit microsecond tick from the seconds and microsecond longints
    160   Result := (Int64(t.tv_sec) * 1000000) + t.tv_usec;
    161   Result := Result div 1000;
     145begin
     146  Result := GetTickCount - FStart;
    162147end;
    163148
    164149procedure TPerfTimer.Start;
    165 var
    166   t : timeval;
    167 begin
    168   fpgettimeofday(@t,nil);
    169    // Build a 64 bit microsecond tick from the seconds and microsecond longints
    170   FStart := (Int64(t.tv_sec) * 1000000) + t.tv_usec;
     150begin
     151  FStart := GetTickCount;
    171152end;
    172153{$ENDIF}
     
    242223{$IFNDEF PUREPASCAL}
    243224const
    244   CPUISChecks: Array[TCPUInstructionSet] of Cardinal =
     225  CPUISChecks: array [TCPUInstructionSet] of Cardinal =
    245226    ($800000,  $400000, $2000000, $4000000, $80000000, $40000000);
    246227    {ciMMX  ,  ciEMMX,  ciSSE   , ciSSE2  , ci3DNow ,  ci3DNowExt}
     
    248229function CPUID_Available: Boolean;
    249230asm
     231{$IFDEF TARGET_x86}
     232        MOV       EDX,False
     233        PUSHFD
     234        POP       EAX
     235        MOV       ECX,EAX
     236        XOR       EAX,$00200000
     237        PUSH      EAX
     238        POPFD
     239        PUSHFD
     240        POP       EAX
     241        XOR       ECX,EAX
     242        JZ        @1
     243        MOV       EDX,True
     244@1:     PUSH      EAX
     245        POPFD
     246        MOV       EAX,EDX
     247{$ENDIF}
    250248{$IFDEF TARGET_x64}
    251249        MOV       EDX,False
     
    264262        POPFQ
    265263        MOV       EAX,EDX
    266 {$ELSE}
    267         MOV       EDX,False
    268         PUSHFD
    269         POP       EAX
    270         MOV       ECX,EAX
    271         XOR       EAX,$00200000
    272         PUSH      EAX
    273         POPFD
    274         PUSHFD
    275         POP       EAX
    276         XOR       ECX,EAX
    277         JZ        @1
    278         MOV       EDX,True
    279 @1:     PUSH      EAX
    280         POPFD
    281         MOV       EAX,EDX
    282264{$ENDIF}
    283265end;
     
    285267function CPU_Signature: Integer;
    286268asm
    287 {$IFDEF TARGET_x64}
    288         PUSH      RBX
    289         MOV       EAX,1
    290         CPUID
    291         POP       RBX
    292 {$ELSE}
     269{$IFDEF TARGET_x86}
    293270        PUSH      EBX
    294271        MOV       EAX,1
     
    300277        POP       EBX
    301278{$ENDIF}
    302 end;
    303 
    304 function CPU_Features: Integer;
    305 asm
    306279{$IFDEF TARGET_x64}
    307280        PUSH      RBX
     
    309282        CPUID
    310283        POP       RBX
    311         MOV       EAX,EDX
    312 {$ELSE}
     284{$ENDIF}
     285end;
     286
     287function CPU_Features: Integer;
     288asm
     289{$IFDEF TARGET_x86}
    313290        PUSH      EBX
    314291        MOV       EAX,1
     
    321298        MOV       EAX,EDX
    322299{$ENDIF}
     300{$IFDEF TARGET_x64}
     301        PUSH      RBX
     302        MOV       EAX,1
     303        CPUID
     304        POP       RBX
     305        MOV       EAX,EDX
     306{$ENDIF}
    323307end;
    324308
    325309function CPU_ExtensionsAvailable: Boolean;
    326310asm
    327 {$IFDEF TARGET_x64}
    328         PUSH      RBX
    329         MOV       @Result, True
    330         MOV       EAX, $80000000
    331         CPUID
    332         CMP       EAX, $80000000
    333         JBE       @NOEXTENSION
    334         JMP       @EXIT
    335         @NOEXTENSION:
    336         MOV       @Result, False
    337         @EXIT:
    338         POP       RBX
    339 {$ELSE}
     311{$IFDEF TARGET_x86}
    340312        PUSH      EBX
    341313        MOV       @Result, True
     
    354326        POP       EBX
    355327{$ENDIF}
     328{$IFDEF TARGET_x64}
     329        PUSH      RBX
     330        MOV       @Result, True
     331        MOV       EAX, $80000000
     332        CPUID
     333        CMP       EAX, $80000000
     334        JBE       @NOEXTENSION
     335        JMP       @EXIT
     336        @NOEXTENSION:
     337        MOV       @Result, False
     338        @EXIT:
     339        POP       RBX
     340{$ENDIF}
    356341end;
    357342
    358343function CPU_ExtFeatures: Integer;
    359344asm
    360 {$IFDEF TARGET_x64}
    361         PUSH      RBX
    362         MOV       EAX, $80000001
    363         CPUID
    364         POP       RBX
    365         MOV       EAX,EDX
    366 {$ELSE}
     345{$IFDEF TARGET_x86}
    367346        PUSH      EBX
    368347        MOV       EAX, $80000001
     
    373352        {$ENDIF}
    374353        POP       EBX
     354        MOV       EAX,EDX
     355{$ENDIF}
     356{$IFDEF TARGET_x64}
     357        PUSH      RBX
     358        MOV       EAX, $80000001
     359        CPUID
     360        POP       RBX
    375361        MOV       EAX,EDX
    376362{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.