1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Add SQLITE_STATUS_PAGECACHE_SIZE and SQLITE_STATUS_SCRATCH_SIZE. (CVS 5537)

FossilOrigin-Name: c4e9b824062ba82a8db01cd82e3e681de1940208
This commit is contained in:
drh
2008-08-05 17:53:22 +00:00
parent e9d1c720ee
commit e50135e26d
8 changed files with 72 additions and 36 deletions

View File

@ -1,5 +1,5 @@
C Separate\sverbs\sof\ssqlite3_config()\sand\ssqlite3_db_config()\sinto\stheir\nown\snamespaces.\s\sAllow\sSQLITE3_DBCONFIG_LOOKASIDE\sto\sspecific\san\sexternal\nmemory\sbuffer.\s(CVS\s5536) C Add\sSQLITE_STATUS_PAGECACHE_SIZE\sand\sSQLITE_STATUS_SCRATCH_SIZE.\s(CVS\s5537)
D 2008-08-04T20:13:27 D 2008-08-05T17:53:23
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 2713ea64947be3b35f35d9a3158bb8299c90b019 F Makefile.in 2713ea64947be3b35f35d9a3158bb8299c90b019
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -116,7 +116,7 @@ F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64 F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
F src/main.c d750c6c0d381252851401f6ea2ee72185de005ed F src/main.c d750c6c0d381252851401f6ea2ee72185de005ed
F src/malloc.c f0ad28008351cac2337ef502a3fdc8ffd3e5d9a9 F src/malloc.c 22c68fc62f0c2df0f1deb8cd9a5ea968f995cac2
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
F src/mem2.c 87381b143530cc377592e868bd548e881c2498a3 F src/mem2.c 87381b143530cc377592e868bd548e881c2498a3
@ -144,11 +144,11 @@ F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/select.c c1899b14f5eb3d3b71aeb02d541d6c5052ad3b70 F src/select.c c1899b14f5eb3d3b71aeb02d541d6c5052ad3b70
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1 F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
F src/sqlite.h.in 286cbb5e5bbe31949d4537f532e44a22a3d14184 F src/sqlite.h.in 157cd9932c2747a6ef3cb091e006185f4f9105d3
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
F src/sqliteInt.h 685b9cf6537e59e4453269b43acb33c59b566346 F src/sqliteInt.h 685b9cf6537e59e4453269b43acb33c59b566346
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 8ad1f215934c5f5afb91df86e44dccff7ef3c1d0 F src/status.c b39b4468fe97c7d26be2de052804887c099312e7
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
F src/tclsqlite.c ec46084184f033ba396a9ee7b5514b695083d0f3 F src/tclsqlite.c ec46084184f033ba396a9ee7b5514b695083d0f3
F src/test1.c e503344d492584d3df31c959f2b14da112e536f4 F src/test1.c e503344d492584d3df31c959f2b14da112e536f4
@ -168,7 +168,7 @@ F src/test_devsym.c 6012cb8e3acf812513511025a4fa5d626e0ba19b
F src/test_func.c df7ddd5abfc5c8d6cd3e36ae9ecb0c276b0e9039 F src/test_func.c df7ddd5abfc5c8d6cd3e36ae9ecb0c276b0e9039
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9 F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9
F src/test_malloc.c 75f639a723e498a67c0ee68e81318c671388d1a3 F src/test_malloc.c 49abbf5d9c71fb06cf7a7cf96f9b9a799b77a421
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071 F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
F src/test_mutex.c d3422d9f60cc1330249d102e74b333f0d24a0cb6 F src/test_mutex.c d3422d9f60cc1330249d102e74b333f0d24a0cb6
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
@ -393,7 +393,7 @@ F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90 F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
F test/lookaside.test 22a518a780de0797d428d2ed6de56828ee7b5544 F test/lookaside.test 48846c5620a0d4529e53fcb9d2e0e8b028833c6a
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
F test/malloc.test 69f5bb5a13b24edb1322fc1f42894f9d2f6446b1 F test/malloc.test 69f5bb5a13b24edb1322fc1f42894f9d2f6446b1
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8 F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
@ -497,7 +497,7 @@ F test/tableapi.test 505031f15b18a750184d967d2c896cf88fcc969c
F test/tclsqlite.test aa1781808502271feccfd24f9e2c0d2c1d7c496a F test/tclsqlite.test aa1781808502271feccfd24f9e2c0d2c1d7c496a
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1 F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125 F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
F test/tester.tcl 160c759e7e0661eaf1b4c15395ca7c0614b03d55 F test/tester.tcl 12fd8394caeb71f7d961707da8668756389bc9d3
F test/thread001.test 3fb08080e1fe84d1bb7ec7bbc9e13743a77e5bc5 F test/thread001.test 3fb08080e1fe84d1bb7ec7bbc9e13743a77e5bc5
F test/thread002.test ed9b800460df01e3cf9428ee11dc4e3f04b9b896 F test/thread002.test ed9b800460df01e3cf9428ee11dc4e3f04b9b896
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@ -617,7 +617,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P f167b2745d491a1adb2b6c869b2169cd6fa53af8 P 5dd865da5e787c10ef4c9e96647724bfab9dea01
R d131d66bc7d60253653f16ca16c768cd R ce2564d8ec0dc6375aa3480b9fe6e715
U drh U drh
Z d5dc59ad71fc51bae7a99c7ae5dfa84b Z 6fec2c40476962caef5feb67a58958a2

View File

@ -1 +1 @@
5dd865da5e787c10ef4c9e96647724bfab9dea01 c4e9b824062ba82a8db01cd82e3e681de1940208

View File

@ -12,7 +12,7 @@
** **
** Memory allocation functions used throughout sqlite. ** Memory allocation functions used throughout sqlite.
** **
** $Id: malloc.c,v 1.33 2008/08/01 16:31:14 drh Exp $ ** $Id: malloc.c,v 1.34 2008/08/05 17:53:23 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@ -312,6 +312,7 @@ void *sqlite3ScratchMalloc(int n){
sqlite3_mutex_leave(mem0.mutex); sqlite3_mutex_leave(mem0.mutex);
i *= sqlite3Config.szScratch; i *= sqlite3Config.szScratch;
sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1); sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
p = (void*)&((char*)sqlite3Config.pScratch)[i]; p = (void*)&((char*)sqlite3Config.pScratch)[i];
} }
} }
@ -324,6 +325,7 @@ void *sqlite3ScratchMalloc(int n){
scratch_overflow: scratch_overflow:
if( sqlite3Config.bMemstat ){ if( sqlite3Config.bMemstat ){
sqlite3_mutex_enter(mem0.mutex); sqlite3_mutex_enter(mem0.mutex);
sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
n = mallocWithAlarm(n, &p); n = mallocWithAlarm(n, &p);
if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n); if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
sqlite3_mutex_leave(mem0.mutex); sqlite3_mutex_leave(mem0.mutex);
@ -398,6 +400,7 @@ void *sqlite3PageMalloc(int n){
i = mem0.aPageFree[--mem0.nPageFree]; i = mem0.aPageFree[--mem0.nPageFree];
sqlite3_mutex_leave(mem0.mutex); sqlite3_mutex_leave(mem0.mutex);
i *= sqlite3Config.szPage; i *= sqlite3Config.szPage;
sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1); sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1);
p = (void*)&((char*)sqlite3Config.pPage)[i]; p = (void*)&((char*)sqlite3Config.pPage)[i];
} }
@ -407,6 +410,7 @@ void *sqlite3PageMalloc(int n){
page_overflow: page_overflow:
if( sqlite3Config.bMemstat ){ if( sqlite3Config.bMemstat ){
sqlite3_mutex_enter(mem0.mutex); sqlite3_mutex_enter(mem0.mutex);
sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
n = mallocWithAlarm(n, &p); n = mallocWithAlarm(n, &p);
if( p ) sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, n); if( p ) sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, n);
sqlite3_mutex_leave(mem0.mutex); sqlite3_mutex_leave(mem0.mutex);

View File

@ -30,7 +30,7 @@
** the version number) and changes its name to "sqlite3.h" as ** the version number) and changes its name to "sqlite3.h" as
** part of the build process. ** part of the build process.
** **
** @(#) $Id: sqlite.h.in,v 1.386 2008/08/04 20:13:27 drh Exp $ ** @(#) $Id: sqlite.h.in,v 1.387 2008/08/05 17:53:23 drh Exp $
*/ */
#ifndef _SQLITE3_H_ #ifndef _SQLITE3_H_
#define _SQLITE3_H_ #define _SQLITE3_H_
@ -6182,35 +6182,57 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
** this parameter. The amount returned is the sum of the allocation ** this parameter. The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd> ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>
** **
** <dt>SQLITE_STATUS_MALLOC_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
** internal equivalents). Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.
** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_USED</dt> ** <dt>SQLITE_STATUS_PAGECACHE_USED</dt>
** <dd>This parameter returns the number of pages used out of the ** <dd>This parameter returns the number of pages used out of the
** page cache buffer configured using [SQLITE_CONFIG_PAGECACHE]. The ** [pagecache memory allocator] that was configured using
** [SQLITE_CONFIG_PAGECACHE]. The
** value returned is in pages, not in bytes.</dd> ** value returned is in pages, not in bytes.</dd>
** **
** <dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt> ** <dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of page cache ** <dd>This parameter returns the number of bytes of page cache
** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE] ** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
** buffer and where forced to overflow to [sqlite3_malloc()].</dd> ** buffer and where forced to overflow to [sqlite3_malloc()]. The
** returned value includes allocations that overflowed because they
** where too large (they were larger than the "sz" parameter to
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
** no space was left in the page cache.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [pagecache memory allocator]. Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.
** The value written into the *pCurrent parameter is undefined.</dd>
** **
** <dt>SQLITE_STATUS_SCRATCH_USED</dt> ** <dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>This parameter returns the number of allocations used out of the ** <dd>This parameter returns the number of allocations used out of the
** scratch allocation lookaside buffer configured using ** [scratch memory allocator] configured using
** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
** in bytes. Since a single thread may only have one allocation ** in bytes. Since a single thread may only have one scratch allocation
** outstanding at time, this parameter also reports the number of threads ** outstanding at time, this parameter also reports the number of threads
** using scratch memory at the same time.</dd> ** using scratch memory at the same time.</dd>
** **
** <dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> ** <dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of scratch memory ** <dd>This parameter returns the number of bytes of scratch memory
** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH] ** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
** buffer and where forced to overflow to [sqlite3_malloc()].</dd> ** buffer and where forced to overflow to [sqlite3_malloc()]. The values
** returned include overflows because the requested allocation was too
** larger (that is, because the requested allocation was larger than the
** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
** slots were available.
** </dd>
** **
** <dt>SQLITE_STATUS_MALLOC_SIZE</dt> ** <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
** <dd>This parameter records the largest memory allocation request ** <dd>This parameter records the largest memory allocation request
** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their ** handed to [scratch memory allocator]. Only the value returned in the
** internal equivalents). The value of interest is return in the ** *pHighwater parameter to [sqlite3_status()] is of interest.
** *pHighwater parameter to [sqlite3_status()]. The value written ** The value written into the *pCurrent parameter is undefined.</dd>
** into the *pCurrent parameter is undefined.</dd>
** **
** <dt>SQLITE_STATUS_PARSER_STACK</dt> ** <dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>This parameter records the deepest parser stack. It is only ** <dd>This parameter records the deepest parser stack. It is only
@ -6226,6 +6248,8 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4
#define SQLITE_STATUS_MALLOC_SIZE 5 #define SQLITE_STATUS_MALLOC_SIZE 5
#define SQLITE_STATUS_PARSER_STACK 6 #define SQLITE_STATUS_PARSER_STACK 6
#define SQLITE_STATUS_PAGECACHE_SIZE 7
#define SQLITE_STATUS_SCRATCH_SIZE 8
/* /*
** CAPI3REF: Status Parameters for database connections {H17275} <H17200> ** CAPI3REF: Status Parameters for database connections {H17275} <H17200>

View File

@ -13,7 +13,7 @@
** This module implements the sqlite3_status() interface and related ** This module implements the sqlite3_status() interface and related
** functionality. ** functionality.
** **
** $Id: status.c,v 1.6 2008/08/01 16:31:14 drh Exp $ ** $Id: status.c,v 1.7 2008/08/05 17:53:23 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -21,8 +21,8 @@
** Variables in which to record status information. ** Variables in which to record status information.
*/ */
static struct { static struct {
int nowValue[7]; /* Current value */ int nowValue[9]; /* Current value */
int mxValue[7]; /* Maximum value */ int mxValue[9]; /* Maximum value */
} sqlite3Stat; } sqlite3Stat;

View File

@ -13,7 +13,7 @@
** This file contains code used to implement test interfaces to the ** This file contains code used to implement test interfaces to the
** memory allocation subsystem. ** memory allocation subsystem.
** **
** $Id: test_malloc.c,v 1.46 2008/08/04 20:13:27 drh Exp $ ** $Id: test_malloc.c,v 1.47 2008/08/05 17:53:24 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@ -1181,11 +1181,13 @@ static int test_status(
int op; int op;
} aOp[] = { } aOp[] = {
{ "SQLITE_STATUS_MEMORY_USED", SQLITE_STATUS_MEMORY_USED }, { "SQLITE_STATUS_MEMORY_USED", SQLITE_STATUS_MEMORY_USED },
{ "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE },
{ "SQLITE_STATUS_PAGECACHE_USED", SQLITE_STATUS_PAGECACHE_USED }, { "SQLITE_STATUS_PAGECACHE_USED", SQLITE_STATUS_PAGECACHE_USED },
{ "SQLITE_STATUS_PAGECACHE_OVERFLOW", SQLITE_STATUS_PAGECACHE_OVERFLOW }, { "SQLITE_STATUS_PAGECACHE_OVERFLOW", SQLITE_STATUS_PAGECACHE_OVERFLOW },
{ "SQLITE_STATUS_PAGECACHE_SIZE", SQLITE_STATUS_PAGECACHE_SIZE },
{ "SQLITE_STATUS_SCRATCH_USED", SQLITE_STATUS_SCRATCH_USED }, { "SQLITE_STATUS_SCRATCH_USED", SQLITE_STATUS_SCRATCH_USED },
{ "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW }, { "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW },
{ "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE }, { "SQLITE_STATUS_SCRATCH_SIZE", SQLITE_STATUS_SCRATCH_SIZE },
{ "SQLITE_STATUS_PARSER_STACK", SQLITE_STATUS_PARSER_STACK }, { "SQLITE_STATUS_PARSER_STACK", SQLITE_STATUS_PARSER_STACK },
}; };
Tcl_Obj *pResult; Tcl_Obj *pResult;

View File

@ -11,7 +11,7 @@
# #
# Tests for the lookaside memory allocator. # Tests for the lookaside memory allocator.
# #
# $Id: lookaside.test,v 1.3 2008/08/04 20:13:27 drh Exp $ # $Id: lookaside.test,v 1.4 2008/08/05 17:53:24 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -93,3 +93,5 @@ do_test lookaside-4.1 {
catch sqlite3_config_error catch sqlite3_config_error
} {0} } {0}
sqlite3_initialize sqlite3_initialize
finish_test

View File

@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression # This file implements some common TCL routines used for regression
# testing the SQLite library # testing the SQLite library
# #
# $Id: tester.tcl,v 1.133 2008/07/25 15:39:04 drh Exp $ # $Id: tester.tcl,v 1.134 2008/08/05 17:53:24 drh Exp $
# #
# What for user input before continuing. This gives an opportunity # What for user input before continuing. This gives an opportunity
@ -368,10 +368,14 @@ proc finalize_testing {} {
# #
proc show_memstats {} { proc show_memstats {} {
set x [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] set x [sqlite3_status SQLITE_STATUS_MEMORY_USED 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]] set y [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0]
set val [format {now %10d max %10d max-size %10d} \
[lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Memory used: $val" puts "Memory used: $val"
set x [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] set x [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]] set y [sqlite3_status SQLITE_STATUS_PAGECACHE_SIZE 0]
set val [format {now %10d max %10d max-size %10d} \
[lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Page-cache used: $val" puts "Page-cache used: $val"
set x [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] set x [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]] set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
@ -380,15 +384,15 @@ proc show_memstats {} {
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]] set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]]
puts "Scratch memory used: $val" puts "Scratch memory used: $val"
set x [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0] set x [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0]
set val [format {now %10d max %10d} [lindex $x 1] [lindex $x 2]] set y [sqlite3_status SQLITE_STATUS_SCRATCH_SIZE 0]
set val [format {now %10d max %10d max-size %10d} \
[lindex $x 1] [lindex $x 2] [lindex $y 2]]
puts "Scratch overflow: $val" puts "Scratch overflow: $val"
ifcapable yytrackmaxstackdepth { ifcapable yytrackmaxstackdepth {
set x [sqlite3_status SQLITE_STATUS_PARSER_STACK 0] set x [sqlite3_status SQLITE_STATUS_PARSER_STACK 0]
set val [format { max %10d} [lindex $x 2]] set val [format { max %10d} [lindex $x 2]]
puts "Parser stack depth: $val" puts "Parser stack depth: $val"
} }
set x [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0]
puts "Maximum alloc size: [lindex $x 2]"
} }
# A procedure to execute SQL # A procedure to execute SQL