diff options
author | dan <dan@noemail.net> | 2011-09-22 14:41:16 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2011-09-22 14:41:16 +0000 |
commit | 58ca31c9057ee914d9cf4d1e47cf901c7501e75f (patch) | |
tree | eec2b333105dc748801d337452074e5c254a9059 /src/status.c | |
parent | 0fe0c466cafc174a8f14dbaf1d7cab8dcdc25773 (diff) | |
download | sqlite-58ca31c9057ee914d9cf4d1e47cf901c7501e75f.tar.gz sqlite-58ca31c9057ee914d9cf4d1e47cf901c7501e75f.zip |
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
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/status.c b/src/status.c index b8c1d58df..b23238bb1 100644 --- a/src/status.c +++ b/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; } |