Changeset 522 for GraphicTest/Packages/Graphics32/GR32_System.pas
- Timestamp:
- Apr 17, 2019, 10:42:18 AM (5 years ago)
- Location:
- GraphicTest/Packages/Graphics32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/Graphics32
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
GraphicTest/Packages/Graphics32/GR32_System.pas
r450 r522 70 70 function ReadNanoseconds: string; 71 71 function ReadMilliseconds: string; 72 function ReadSeconds: String; 72 function ReadSeconds: string; 73 73 74 function ReadValue: Int64; 74 75 end; … … 127 128 128 129 function 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 ); 130 begin 131 Result := IntToStr(ReadValue); 135 132 end; 136 133 137 134 function 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 ); 135 begin 136 Result := IntToStr(ReadValue div 1000); 144 137 end; 145 138 146 139 function 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 ) ); 140 begin 141 Result := IntToStr(ReadValue div 1000000); 153 142 end; 154 143 155 144 function 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; 145 begin 146 Result := GetTickCount - FStart; 162 147 end; 163 148 164 149 procedure 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; 150 begin 151 FStart := GetTickCount; 171 152 end; 172 153 {$ENDIF} … … 242 223 {$IFNDEF PUREPASCAL} 243 224 const 244 CPUISChecks: Array[TCPUInstructionSet] of Cardinal =225 CPUISChecks: array [TCPUInstructionSet] of Cardinal = 245 226 ($800000, $400000, $2000000, $4000000, $80000000, $40000000); 246 227 {ciMMX , ciEMMX, ciSSE , ciSSE2 , ci3DNow , ci3DNowExt} … … 248 229 function CPUID_Available: Boolean; 249 230 asm 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} 250 248 {$IFDEF TARGET_x64} 251 249 MOV EDX,False … … 264 262 POPFQ 265 263 MOV EAX,EDX 266 {$ELSE}267 MOV EDX,False268 PUSHFD269 POP EAX270 MOV ECX,EAX271 XOR EAX,$00200000272 PUSH EAX273 POPFD274 PUSHFD275 POP EAX276 XOR ECX,EAX277 JZ @1278 MOV EDX,True279 @1: PUSH EAX280 POPFD281 MOV EAX,EDX282 264 {$ENDIF} 283 265 end; … … 285 267 function CPU_Signature: Integer; 286 268 asm 287 {$IFDEF TARGET_x64} 288 PUSH RBX 289 MOV EAX,1 290 CPUID 291 POP RBX 292 {$ELSE} 269 {$IFDEF TARGET_x86} 293 270 PUSH EBX 294 271 MOV EAX,1 … … 300 277 POP EBX 301 278 {$ENDIF} 302 end;303 304 function CPU_Features: Integer;305 asm306 279 {$IFDEF TARGET_x64} 307 280 PUSH RBX … … 309 282 CPUID 310 283 POP RBX 311 MOV EAX,EDX 312 {$ELSE} 284 {$ENDIF} 285 end; 286 287 function CPU_Features: Integer; 288 asm 289 {$IFDEF TARGET_x86} 313 290 PUSH EBX 314 291 MOV EAX,1 … … 321 298 MOV EAX,EDX 322 299 {$ENDIF} 300 {$IFDEF TARGET_x64} 301 PUSH RBX 302 MOV EAX,1 303 CPUID 304 POP RBX 305 MOV EAX,EDX 306 {$ENDIF} 323 307 end; 324 308 325 309 function CPU_ExtensionsAvailable: Boolean; 326 310 asm 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} 340 312 PUSH EBX 341 313 MOV @Result, True … … 354 326 POP EBX 355 327 {$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} 356 341 end; 357 342 358 343 function CPU_ExtFeatures: Integer; 359 344 asm 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} 367 346 PUSH EBX 368 347 MOV EAX, $80000001 … … 373 352 {$ENDIF} 374 353 POP EBX 354 MOV EAX,EDX 355 {$ENDIF} 356 {$IFDEF TARGET_x64} 357 PUSH RBX 358 MOV EAX, $80000001 359 CPUID 360 POP RBX 375 361 MOV EAX,EDX 376 362 {$ENDIF}
Note:
See TracChangeset
for help on using the changeset viewer.