1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add additional DBSTATUS options for measuring the hit and miss rates against

the lookaside memory pool - information useful in tuning the lookaside size.
Currently experimental pending analysis of performance impact.

FossilOrigin-Name: 34613f1dc54c638531ca2f5907b71fbe8841233e
This commit is contained in:
drh
2010-12-20 15:51:58 +00:00
parent 9c88d68988
commit 0b12e7f860
6 changed files with 77 additions and 25 deletions

View File

@@ -616,14 +616,20 @@ void *sqlite3DbMallocRaw(sqlite3 *db, int n){
if( db->mallocFailed ){
return 0;
}
if( db->lookaside.bEnabled && n<=db->lookaside.sz
&& (pBuf = db->lookaside.pFree)!=0 ){
db->lookaside.pFree = pBuf->pNext;
db->lookaside.nOut++;
if( db->lookaside.nOut>db->lookaside.mxOut ){
db->lookaside.mxOut = db->lookaside.nOut;
if( db->lookaside.bEnabled ){
if( n>db->lookaside.sz ){
db->lookaside.anStat[1]++;
}else if( (pBuf = db->lookaside.pFree)==0 ){
db->lookaside.anStat[2]++;
}else{
db->lookaside.pFree = pBuf->pNext;
db->lookaside.nOut++;
db->lookaside.anStat[0]++;
if( db->lookaside.nOut>db->lookaside.mxOut ){
db->lookaside.mxOut = db->lookaside.nOut;
}
return (void*)pBuf;
}
return (void*)pBuf;
}
}
#else