/ Check-in [ae89777e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve the accuracy of the Pager heap usage estimate.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ae89777e7f8bae2cdd3407395ea84c1b39577c4b
User & Date: drh 2010-07-28 17:36:12
Context
2010-07-28
18:51
Fix the dbstatus.test script so that it works correctly on 64-bit machines. check-in: a3401d9e user: drh tags: trunk
18:35
Merge trunk changes into experimental branch. check-in: aa819001 user: dan tags: experimental
17:36
Improve the accuracy of the Pager heap usage estimate. check-in: ae89777e user: drh tags: trunk
17:16
Adjust the shell test script "shell4.test" to account for changes in the ".stat on" display format from the previous checkin. check-in: 2f2fa7dd user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  5410   5410   }
  5411   5411   
  5412   5412   /*
  5413   5413   ** Return the approximate number of bytes of memory currently
  5414   5414   ** used by the pager and its associated cache.
  5415   5415   */
  5416   5416   int sqlite3PagerMemUsed(Pager *pPager){
  5417         -  int perPageSize = pPager->pageSize + pPager->nExtra + 20;
         5417  +  int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr)
         5418  +                                     + 5*sizeof(void*);
  5418   5419     return perPageSize*sqlite3PcachePagecount(pPager->pPCache)
  5419         -           + sqlite3MallocSize(pPager);
         5420  +           + sqlite3MallocSize(pPager)
         5421  +           + (pPager->pTmpSpace ? pPager->pageSize : 0);
  5420   5422   }
  5421   5423   
  5422   5424   /*
  5423   5425   ** Return the number of references to the specified page.
  5424   5426   */
  5425   5427   int sqlite3PagerPageRefcount(DbPage *pPage){
  5426   5428     return sqlite3PcachePageRefcount(pPage);

Changes to src/shell.c.

  1017   1017   
  1018   1018     if( pArg && pArg->out && db ){
  1019   1019       iHiwtr = iCur = -1;
  1020   1020       sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
  1021   1021       fprintf(pArg->out, "Lookaside Slots Used:                %d (max %d)\n", iCur, iHiwtr);
  1022   1022       iHiwtr = iCur = -1;
  1023   1023       sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
  1024         -    fprintf(pArg->out, "Pcache Heap Usage:                   %d bytes\n", iCur); 
         1024  +    fprintf(pArg->out, "Pager Heap Usage:                    %d bytes\n", iCur); 
  1025   1025       iHiwtr = iCur = -1;
  1026   1026       sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
  1027   1027       fprintf(pArg->out, "Schema Heap Usage:                   %d bytes\n", iCur); 
  1028   1028       iHiwtr = iCur = -1;
  1029   1029       sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
  1030   1030       fprintf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n", iCur); 
  1031   1031     }