mirror of
https://github.com/sqlite/sqlite.git
synced 2025-09-02 12:21:26 +03:00
Add the SQLITE_DB_STATUS_CACHE_HIT and MISS options. For querying the number of cache hits and misses on a per-connection basis.
FossilOrigin-Name: 5100b6e9dc5107f0f835d0aac26fe6d4938ffc73
This commit is contained in:
22
src/status.c
22
src/status.c
@@ -218,6 +218,28 @@ int sqlite3_db_status(
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
** Set *pCurrent to the total cache hits or misses encountered by all
|
||||
** pagers the database handle is connected to. *pHighwater is always set
|
||||
** to zero.
|
||||
*/
|
||||
case SQLITE_DBSTATUS_CACHE_HIT:
|
||||
case SQLITE_DBSTATUS_CACHE_MISS: {
|
||||
int i;
|
||||
int nRet = 0;
|
||||
assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );
|
||||
|
||||
for(i=0; i<db->nDb; i++){
|
||||
if( db->aDb[i].pBt ){
|
||||
Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);
|
||||
sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet);
|
||||
}
|
||||
}
|
||||
*pHighwater = 0;
|
||||
*pCurrent = nRet;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
|
Reference in New Issue
Block a user