| /* | |
| ** 2008 May 27 | |
| ** | |
| ** The author disclaims copyright to this source code. In place of | |
| ** a legal notice, here is a blessing: | |
| ** | |
| ** May you do good and not evil. | |
| ** May you find forgiveness for yourself and forgive others. | |
| ** May you share freely, never taking more than you give. | |
| ** | |
| ****************************************************************************** | |
| ** | |
| ** This file contains inline asm code for retrieving "high-performance" | |
| ** counters for x86 and x86_64 class CPUs. | |
| */ | |
| /* | |
| ** The following routine only works on Pentium-class (or newer) processors. | |
| ** It uses the RDTSC opcode to read the cycle count value out of the | |
| ** processor and returns that value. This can be used for high-res | |
| ** profiling. | |
| */ | |
| __inline__ sqlite_uint64 sqlite3Hwtime(void){ | |
| unsigned int lo, hi; | |
| __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); | |
| return (sqlite_uint64)hi << 32 | lo; | |
| } | |
| __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ | |
| __asm { | |
| rdtsc | |
| ret ; return value at EDX:EAX | |
| } | |
| } | |
| __inline__ sqlite_uint64 sqlite3Hwtime(void){ | |
| unsigned int lo, hi; | |
| __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); | |
| return (sqlite_uint64)hi << 32 | lo; | |
| } | |
| __inline__ sqlite_uint64 sqlite3Hwtime(void){ | |
| unsigned long long retval; | |
| unsigned long junk; | |
| __asm__ __volatile__ ("\n\ | |
| 1: mftbu %1\n\ | |
| mftb %L0\n\ | |
| mftbu %0\n\ | |
| cmpw %0,%1\n\ | |
| bne 1b" | |
| : "=r" (retval), "=r" (junk)); | |
| return retval; | |
| } | |
| /* | |
| ** asm() is needed for hardware timing support. Without asm(), | |
| ** disable the sqlite3Hwtime() routine. | |
| ** | |
| ** sqlite3Hwtime() is only used for some obscure debugging | |
| ** and analysis configurations, not in any deliverable, so this | |
| ** should not be a great loss. | |
| */ | |
| sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } | |