Improve the accuracy of the Pager heap usage estimate.

FossilOrigin-Name: ae89777e7f8bae2cdd3407395ea84c1b39577c4b
This commit is contained in:
drh 2010-07-28 17:36:11 +00:00
parent abc97a7834
commit 233f816b84
4 changed files with 16 additions and 14 deletions

View File

@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Adjust\sthe\sshell\stest\sscript\s"shell4.test"\sto\saccount\sfor\schanges\sin\sthe\n".stat\son"\sdisplay\sformat\sfrom\sthe\sprevious\scheckin.
D 2010-07-28T17:16:41
C Improve\sthe\saccuracy\sof\sthe\sPager\sheap\susage\sestimate.
D 2010-07-28T17:36:12
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -159,7 +159,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
F src/os_unix.c 3109e0e5a0d5551bab2e8c7322b20a3b8b171248
F src/os_win.c 1f8b0a1a5bcf6289e7754d0d3c16cec16d4c93ab
F src/pager.c 78ca1e1f3315c8227431c403c04d791dccf242fb
F src/pager.c b877df9489b647cb3a9b3590f168bd4ee31bf9e7
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@ -172,7 +172,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c 74fef1334bec27e606ef0b19e5c41cd0a639e69c
F src/shell.c cc1a4d200a2c67919da363958048b592d9d3b72f
F src/shell.c 8517fc1f9c59ae4007e6cc8b9af91ab231ea2056
F src/sqlite.h.in 373dedd8489ecd9dfb33d6d4378ee9f34a3c2386
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h a9be6badc6cd6a3c1ae54475a98661cf351ecad5
@ -842,14 +842,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P f9adf66ad575abbb63736caef27bd3c619e516a6
R 9558d79cf319dc848ba05a8d52ee237b
P 2f2fa7dd809ae2a67048643da8c01a4664848ba7
R b7bd2ca1374c0179d87c6bae7ca407e6
U drh
Z 2f19f50f273aa39e26644f0a727198db
Z 03585c4f4d1ec104a0103a0a8c108d7f
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMUGX8oxKgR168RlERAtubAJ47D4HEKATV6b/ioA0aSOHcQpGbtACfbXdm
NtY/U+/oQI9Ujb0cG0mLzfE=
=QYCo
iD8DBQFMUGqPoxKgR168RlERAgxrAJ4+w32hgMSWWsLb7m9/xZmvHyOoagCaAmtG
MhNGa6qhE2RISj/kSRw4Vo0=
=wqBl
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
2f2fa7dd809ae2a67048643da8c01a4664848ba7
ae89777e7f8bae2cdd3407395ea84c1b39577c4b

View File

@ -5414,9 +5414,11 @@ int sqlite3PagerRefcount(Pager *pPager){
** used by the pager and its associated cache.
*/
int sqlite3PagerMemUsed(Pager *pPager){
int perPageSize = pPager->pageSize + pPager->nExtra + 20;
int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr)
+ 5*sizeof(void*);
return perPageSize*sqlite3PcachePagecount(pPager->pPCache)
+ sqlite3MallocSize(pPager);
+ sqlite3MallocSize(pPager)
+ (pPager->pTmpSpace ? pPager->pageSize : 0);
}
/*

View File

@ -1021,7 +1021,7 @@ static int display_stats(
fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n", iCur, iHiwtr);
iHiwtr = iCur = -1;
sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
fprintf(pArg->out, "Pcache Heap Usage: %d bytes\n", iCur);
fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur);
iHiwtr = iCur = -1;
sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur);