aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-02-27 02:01:14 +0000
committerdrh <drh@noemail.net>2007-02-27 02:01:14 +0000
commit15d00c4e7b8d924973760d480a990fb1b500361c (patch)
tree739dde52c08a20526ee50c1d438612f02b104b45 /src/os_unix.c
parentd40aab0ea837d95a1bf58f59e28163accb86c5c6 (diff)
downloadsqlite-15d00c4e7b8d924973760d480a990fb1b500361c.tar.gz
sqlite-15d00c4e7b8d924973760d480a990fb1b500361c.zip
Improvements to OS layer tracing on the unix backend. (CVS 3664)
FossilOrigin-Name: 3ad96dbe09b99bd5f623de0de3072a25e9e2bc17
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 8ac272e5e..67b7425af 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1001,6 +1001,7 @@ int sqlite3UnixIsDirWritable(char *zBuf){
static int seekAndRead(unixFile *id, void *pBuf, int cnt){
int got;
i64 newOffset;
+ TIMER_START;
#ifdef USE_PREAD
got = pread(id->h, pBuf, cnt, id->offset);
#else
@@ -1010,6 +1011,8 @@ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
}
got = read(id->h, pBuf, cnt);
#endif
+ TIMER_END;
+ TRACE5("READ %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
if( got>0 ){
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){
int got;
assert( id );
- TIMER_START;
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 );
if( got==amt ){
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){
int got;
i64 newOffset;
+ TIMER_START;
#ifdef USE_PREAD
got = pwrite(id->h, pBuf, cnt, id->offset);
#else
@@ -1057,6 +1056,8 @@ static int seekAndWrite(unixFile *id, const void *pBuf, int cnt){
}
got = write(id->h, pBuf, cnt);
#endif
+ TIMER_END;
+ TRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, id->offset, TIMER_ELAPSED);
if( got>0 ){
id->offset += got;
}
@@ -1072,15 +1073,10 @@ static int unixWrite(OsFile *id, const void *pBuf, int amt){
int wrote = 0;
assert( id );
assert( amt>0 );
- TIMER_START;
while( amt>0 && (wrote = seekAndWrite((unixFile*)id, pBuf, amt))>0 ){
amt -= 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 ));
SimulateDiskfullError(( wrote=0, amt=1 ));
if( amt>0 ){
@@ -1098,7 +1094,6 @@ static int unixWrite(OsFile *id, const void *pBuf, int amt){
*/
static int unixSeek(OsFile *id, i64 offset){
assert( id );
- SEEK(offset/1024 + 1);
#ifdef SQLITE_TEST
if( offset ) SimulateDiskfullError(return SQLITE_FULL);
#endif