1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-24 09:53:10 +03:00

Improvements to OS layer tracing on the unix backend. (CVS 3664)

FossilOrigin-Name: 3ad96dbe09b99bd5f623de0de3072a25e9e2bc17
This commit is contained in:
drh
2007-02-27 02:01:14 +00:00
parent d40aab0ea8
commit 15d00c4e7b
3 changed files with 13 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
C Add\scomments\sto\ssqlite3ExprCompare()\sto\sclarify\sits\soperation.\sTicket\s#2216.\s(CVS\s3663) C Improvements\sto\sOS\slayer\stracing\son\sthe\sunix\sbackend.\s(CVS\s3664)
D 2007-02-24T15:29:04 D 2007-02-27T02:01:14
F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -81,7 +81,7 @@ F src/os_os2.c 8ee8207fe218a1acf3a31d59753e165e5c23bb95
F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c 2f7f7dbb95bbfa109f951c828b248102ab75b621 F src/os_unix.c abdb0f7b8e3f078b8b48d4c0b8c801693046774d
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@@ -434,7 +434,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 2bf5475bde763f73f7f4dd9cac7d13a631a7d2aa P fba0a1e50820677081bc7cf01f97bf953065f7c4
R bf7e89dd91722385f525c6269433be59 R 53e6e1175e996a66fdc28979d298605a
U drh U drh
Z 359d2bb09f0008f8bf6cf7c87fededb5 Z 6212737d1226e74d32458bf3f5faf876

View File

@@ -1 +1 @@
fba0a1e50820677081bc7cf01f97bf953065f7c4 3ad96dbe09b99bd5f623de0de3072a25e9e2bc17

View File

@@ -1001,6 +1001,7 @@ int sqlite3UnixIsDirWritable(char *zBuf){
static int seekAndRead(unixFile *id, void *pBuf, int cnt){ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
int got; int got;
i64 newOffset; i64 newOffset;
TIMER_START;
#ifdef USE_PREAD #ifdef USE_PREAD
got = pread(id->h, pBuf, cnt, id->offset); got = pread(id->h, pBuf, cnt, id->offset);
#else #else
@@ -1010,6 +1011,8 @@ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
} }
got = read(id->h, pBuf, cnt); got = read(id->h, pBuf, cnt);
#endif #endif
TIMER_END;
TRACE5("READ %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
if( got>0 ){ if( got>0 ){
id->offset += got; id->offset += got;
} }
@@ -1024,12 +1027,7 @@ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
static int unixRead(OsFile *id, void *pBuf, int amt){ static int unixRead(OsFile *id, void *pBuf, int amt){
int got; int got;
assert( id ); assert( id );
TIMER_START;
got = seekAndRead((unixFile*)id, pBuf, amt); got = seekAndRead((unixFile*)id, pBuf, amt);
TIMER_END;
TRACE5("READ %-3d %5d %7d %d\n", ((unixFile*)id)->h, got,
last_page, TIMER_ELAPSED);
SEEK(0);
SimulateIOError( got = -1 ); SimulateIOError( got = -1 );
if( got==amt ){ if( got==amt ){
return SQLITE_OK; return SQLITE_OK;
@@ -1048,6 +1046,7 @@ static int unixRead(OsFile *id, void *pBuf, int amt){
static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){ static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
int got; int got;
i64 newOffset; i64 newOffset;
TIMER_START;
#ifdef USE_PREAD #ifdef USE_PREAD
got = pwrite(id->h, pBuf, cnt, id->offset); got = pwrite(id->h, pBuf, cnt, id->offset);
#else #else
@@ -1057,6 +1056,8 @@ static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
} }
got = write(id->h, pBuf, cnt); got = write(id->h, pBuf, cnt);
#endif #endif
TIMER_END;
TRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
if( got>0 ){ if( got>0 ){
id->offset += got; id->offset += got;
} }
@@ -1072,15 +1073,10 @@ static int unixWrite(OsFile *id, const void *pBuf, int amt){
int wrote = 0; int wrote = 0;
assert( id ); assert( id );
assert( amt>0 ); assert( amt>0 );
TIMER_START;
while( amt>0 && (wrote = seekAndWrite((unixFile*)id, pBuf, amt))>0 ){ while( amt>0 && (wrote = seekAndWrite((unixFile*)id, pBuf, amt))>0 ){
amt -= wrote; amt -= wrote;
pBuf = &((char*)pBuf)[wrote]; pBuf = &((char*)pBuf)[wrote];
} }
TIMER_END;
TRACE5("WRITE %-3d %5d %7d %d\n", ((unixFile*)id)->h, wrote,
last_page, TIMER_ELAPSED);
SEEK(0);
SimulateIOError(( wrote=(-1), amt=1 )); SimulateIOError(( wrote=(-1), amt=1 ));
SimulateDiskfullError(( wrote=0, amt=1 )); SimulateDiskfullError(( wrote=0, amt=1 ));
if( amt>0 ){ if( amt>0 ){
@@ -1098,7 +1094,6 @@ static int unixWrite(OsFile *id, const void *pBuf, int amt){
*/ */
static int unixSeek(OsFile *id, i64 offset){ static int unixSeek(OsFile *id, i64 offset){
assert( id ); assert( id );
SEEK(offset/1024 + 1);
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
if( offset ) SimulateDiskfullError(return SQLITE_FULL); if( offset ) SimulateDiskfullError(return SQLITE_FULL);
#endif #endif