Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Separate P4 timing asm code out of the SQLITE_DEBUG macro so that SQLITE_DEBUG can be used on non-x86 machines and with compilers other than GCC. Ticket #838. (CVS 1876) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
add266ccc3146fa56572d109e84c8a79 |
User & Date: | drh 2004-08-04 14:44:34.000 |
Context
2004-08-04
| ||
15:16 | In the command-line shell: importments to the "help" message and better error checking in the new .import command. (CVS 1877) (check-in: ed489f776a user: drh tags: trunk) | |
14:44 | Separate P4 timing asm code out of the SQLITE_DEBUG macro so that SQLITE_DEBUG can be used on non-x86 machines and with compilers other than GCC. Ticket #838. (CVS 1876) (check-in: add266ccc3 user: drh tags: trunk) | |
14:29 | Separate the ifdefs for INTPTR_TYPE and UINTPTR_TYPE in sqliteInt.h. (CVS 1875) (check-in: 4e7953c13f user: drh tags: trunk) | |
Changes
Changes to src/os_common.h.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 | ** all of the platform-specific files (os_*.c) and is #included into those ** files. ** ** This file should be #included by the os_*.c files only. It is not a ** general purpose header file. */ /* ** Macros for performance tracing. Normally turned off. Only works ** on i486 hardware. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | < < < < < < < < | < < | < < < < < < < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | ** all of the platform-specific files (os_*.c) and is #included into those ** files. ** ** This file should be #included by the os_*.c files only. It is not a ** general purpose header file. */ /* ** At least two bugs have slipped in because we changed the MEMORY_DEBUG ** macro to SQLITE_DEBUG and some older makefiles have not yet made the ** switch. The following code should catch this problem at compile-time. */ #ifdef MEMORY_DEBUG # error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." #endif int sqlite3_os_trace = 0; #ifdef SQLITE_DEBUG static int last_page = 0; #define SEEK(X) last_page=(X) #define TRACE1(X) if( sqlite3_os_trace ) sqlite3DebugPrintf(X) #define TRACE2(X,Y) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y) #define TRACE3(X,Y,Z) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z) #define TRACE4(X,Y,Z,A) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A) #define TRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B) #define TRACE6(X,Y,Z,A,B,C) if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C) #define TRACE7(X,Y,Z,A,B,C,D) \ if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D) #else #define SEEK(X) #define TRACE1(X) #define TRACE2(X,Y) #define TRACE3(X,Y,Z) #define TRACE4(X,Y,Z,A) #define TRACE5(X,Y,Z,A,B) #define TRACE6(X,Y,Z,A,B,C) #define TRACE7(X,Y,Z,A,B,C,D) #endif /* ** Macros for performance tracing. Normally turned off. Only works ** on i486 hardware. */ #ifdef SQLITE_PERFORMANCE_TRACE __inline__ unsigned long long int hwtime(void){ unsigned long long int x; __asm__("rdtsc\n\t" "mov %%edx, %%ecx\n\t" :"=A" (x)); return x; } static unsigned long long int g_start; static unsigned int elapse; #define TIMER_START g_start=hwtime() #define TIMER_END elapse=hwtime()-g_start #define TIMER_ELAPSED elapse #else #define TIMER_START #define TIMER_END #define TIMER_ELAPSED 0 #endif /* ** If we compile with the SQLITE_TEST macro set, then the following block ** of code will give us the ability to simulate a disk I/O error. This ** is used for testing the I/O recovery logic. */ #ifdef SQLITE_TEST |
︙ | ︙ |
Changes to src/os_unix.c.
︙ | ︙ | |||
613 614 615 616 617 618 619 | int sqlite3OsRead(OsFile *id, void *pBuf, int amt){ int got; assert( id->isOpen ); SimulateIOError(SQLITE_IOERR); TIMER_START; got = read(id->h, pBuf, amt); TIMER_END; | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | int sqlite3OsRead(OsFile *id, void *pBuf, int amt){ int got; assert( id->isOpen ); SimulateIOError(SQLITE_IOERR); TIMER_START; got = read(id->h, pBuf, amt); TIMER_END; TRACE4("READ %-3d %7d %d\n", id->h, last_page, TIMER_ELAPSED); SEEK(0); /* if( got<0 ) got = 0; */ if( got==amt ){ return SQLITE_OK; }else{ return SQLITE_IOERR; } |
︙ | ︙ | |||
637 638 639 640 641 642 643 | SimulateIOError(SQLITE_IOERR); TIMER_START; while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){ amt -= wrote; pBuf = &((char*)pBuf)[wrote]; } TIMER_END; | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | SimulateIOError(SQLITE_IOERR); TIMER_START; while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){ amt -= wrote; pBuf = &((char*)pBuf)[wrote]; } TIMER_END; TRACE4("WRITE %-3d %7d %d\n", id->h, last_page, TIMER_ELAPSED); SEEK(0); if( amt>0 ){ return SQLITE_FULL; } return SQLITE_OK; } |
︙ | ︙ |