From: drh Date: Wed, 20 Jul 2005 14:31:53 +0000 (+0000) Subject: Extra memory usage instrumentation added. (CVS 2553) X-Git-Tag: version-3.6.10~3606 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=013972052e3722cc9277ab6b2d21e702baf814e3;p=thirdparty%2Fsqlite.git Extra memory usage instrumentation added. (CVS 2553) FossilOrigin-Name: ac669f56c0759a7e3eaa6f0018c8fb9d614e7d69 --- diff --git a/manifest b/manifest index f63464223e..9484f523dd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\srefactoring\sin\swhere.c.\s(CVS\s2552) -D 2005-07-19T22:22:13 +C Extra\smemory\susage\sinstrumentation\sadded.\s(CVS\s2553) +D 2005-07-20T14:31:53 F Makefile.in 22ea9c0fe748f591712d8fe3c6d972c6c173a165 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -67,7 +67,7 @@ F src/sqlite.h.in 838382ed6b48d392366a55e07f49d9d71263e1fe F src/sqliteInt.h 97d50f5714a5f5a8190b871305e33a96c4638a8a F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/tclsqlite.c cccaf6b78c290d824cf8ea089b8b27377e545830 -F src/test1.c 1dea8df4abb846cb3a2ce8a6e13d8b32dbd31b16 +F src/test1.c 722c1444b5774705eb6eb11163343fc94ffe17f7 F src/test2.c 716c1809dba8e5be6093703e9cada99d627542dc F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df @@ -76,7 +76,7 @@ F src/tokenize.c 57ec9926612fb9e325b57a141303573bc20c79bf F src/trigger.c f51dec15921629591cb98bf2e350018e268b109a F src/update.c 49a9c618c3ba1ca57038d9ce41f14e958442fe58 F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c -F src/util.c 1acbe299cbe51f45176ac1e48ded9bea206c3c23 +F src/util.c 668d31be592753e5b8ea00e69ea8d3eedb29fa22 F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c F src/vdbe.c 7b41a1979d3421dbbe34a3a48970b4e75fb1d634 F src/vdbe.h 75e466d84d362b0c4498978a9d6b1e6bd32ecf3b @@ -286,7 +286,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b -P 57c6bd3760163c174be4a2ece58f414e82b55938 -R 3cdcdb6928aa7a2c42a275a913941b5a +P a35bd50af8961133adc66e40c38402e81a02bb56 +R 73dbc3e4bd94a516434db925353f0d59 U drh -Z b929286800f2e064fa91faa90163e11f +Z b94984498572a6b7851afac6f92deee0 diff --git a/manifest.uuid b/manifest.uuid index 20ef12eab7..36a376c70b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a35bd50af8961133adc66e40c38402e81a02bb56 \ No newline at end of file +ac669f56c0759a7e3eaa6f0018c8fb9d614e7d69 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 1b9ecd6a09..ae609edee0 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.149 2005/07/15 23:24:24 drh Exp $ +** $Id: test1.c,v 1.150 2005/07/20 14:31:53 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -3093,6 +3093,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite3_os_trace; extern int sqlite3_sync_count, sqlite3_fullsync_count; extern int sqlite3_opentemp_count; + extern int sqlite3_memUsed; + extern int sqlite3_memMax; extern char sqlite3_query_plan[]; static char *query_plan = sqlite3_query_plan; @@ -3115,6 +3117,10 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ (char*)&sqlite3_current_time, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_os_trace", (char*)&sqlite3_os_trace, TCL_LINK_INT); + Tcl_LinkVar(interp, "sqlite_memused", + (char*)&sqlite3_memUsed, TCL_LINK_INT | TCL_LINK_READ_ONLY); + Tcl_LinkVar(interp, "sqlite_memmax", + (char*)&sqlite3_memMax, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "sqlite_query_plan", (char*)&query_plan, TCL_LINK_STRING|TCL_LINK_READ_ONLY); #ifndef SQLITE_OMIT_DISKIO diff --git a/src/util.c b/src/util.c index 2f33a1120d..18b5ada247 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.140 2005/06/29 17:24:24 drh Exp $ +** $Id: util.c,v 1.141 2005/07/20 14:31:53 drh Exp $ */ #include "sqliteInt.h" #include @@ -58,6 +58,8 @@ int sqlite3_malloc_failed = 0; */ int sqlite3_nMalloc; /* Number of sqliteMalloc() calls */ int sqlite3_nFree; /* Number of sqliteFree() calls */ +int sqlite3_memUsed; /* Total memory obtained from malloc */ +int sqlite3_memMax; /* Mem usage high-water mark */ int sqlite3_iMallocFail; /* Fail sqliteMalloc() after this many calls */ int sqlite3_iMallocReset = -1; /* When iMallocFail reaches 0, set to this */ #if SQLITE_MEMDEBUG>1 @@ -92,6 +94,8 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){ } } if( n==0 ) return 0; + sqlite3_memUsed += n; + if( sqlite3_memMaxoldN ? oldN : n);