| 72 | __asm |
| 73 | { |
| 74 | push eax |
| 75 | push edx |
| 76 | push ecx |
| 77 | rdtsc |
| 78 | mov ecx, time |
| 79 | mov DWORD PTR [ecx], eax |
| 80 | mov DWORD PTR [ecx + 4], edx |
| 81 | pop ecx |
| 82 | pop edx |
| 83 | pop eax |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | U32 endHighResolutionTimer(U32 time[2]) |
| 88 | { |
| 89 | U32 ticks; |
| 90 | //ticks = Platform::getRealMilliseconds() - time[0]; |
| 91 | //return ticks; |
| 92 | |
| 93 | __asm |
| 94 | { |
| 95 | push eax |
| 96 | push edx |
| 97 | push ecx |
| 98 | //db 0fh, 31h |
| 99 | rdtsc |
| 100 | mov ecx, time |
| 101 | sub edx, DWORD PTR [ecx+4] |
| 102 | sbb eax, DWORD PTR [ecx] |
| 103 | mov DWORD PTR ticks, eax |
| 104 | pop ecx |
| 105 | pop edx |
| 106 | pop eax |
| 107 | } |
| 108 | return ticks; |
| 109 | } |
| 110 | |
| 111 | #elif defined(TORQUE_SUPPORTS_GCC_INLINE_X86_ASM) |
| 112 | |
| 113 | // platform specific get hires times... |
| 114 | void startHighResolutionTimer(U32 time[2]) |
| 115 | { |
| 116 | __asm__ __volatile__( |
| 117 | "rdtsc\n" |
| 118 | : "=a" (time[0]), "=d" (time[1]) |
| 119 | ); |
| 120 | } |
| 121 | |
| 122 | U32 endHighResolutionTimer(U32 time[2]) |
| 123 | { |