Fossil SCM
Update the --sqltrace debugging option so that it outputs memory usage statistics within SQL comments.
Commit
cb745cc7898674f29e9b9021d9ba00aae8688251
Parent
e084092a07a6273…
1 file changed
+19
M
src/db.c
+19
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -941,10 +941,29 @@ | ||
| 941 | 941 | ** Close the database connection. |
| 942 | 942 | */ |
| 943 | 943 | void db_close(void){ |
| 944 | 944 | sqlite3_stmt *pStmt; |
| 945 | 945 | if( g.db==0 ) return; |
| 946 | + if( g.fSqlTrace ){ | |
| 947 | + int cur, hiwtr; | |
| 948 | + sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0); | |
| 949 | + fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr); | |
| 950 | + sqlite3_db_status(g.db, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiwtr, 0); | |
| 951 | + fprintf(stderr, "-- CACHE_USED %10d\n", cur); | |
| 952 | + sqlite3_db_status(g.db, SQLITE_DBSTATUS_SCHEMA_USED, &cur, &hiwtr, 0); | |
| 953 | + fprintf(stderr, "-- SCHEMA_USED %10d\n", cur); | |
| 954 | + sqlite3_db_status(g.db, SQLITE_DBSTATUS_STMT_USED, &cur, &hiwtr, 0); | |
| 955 | + fprintf(stderr, "-- STMT_USED %10d\n", cur); | |
| 956 | + sqlite3_status(SQLITE_STATUS_MEMORY_USED, &cur, &hiwtr, 0); | |
| 957 | + fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr); | |
| 958 | + sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &cur, &hiwtr, 0); | |
| 959 | + fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr); | |
| 960 | + sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &cur, &hiwtr, 0); | |
| 961 | + fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr); | |
| 962 | + sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &cur, &hiwtr, 0); | |
| 963 | + fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr); | |
| 964 | + } | |
| 946 | 965 | while( pAllStmt ){ |
| 947 | 966 | db_finalize(pAllStmt); |
| 948 | 967 | } |
| 949 | 968 | db_end_transaction(1); |
| 950 | 969 | pStmt = 0; |
| 951 | 970 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -941,10 +941,29 @@ | |
| 941 | ** Close the database connection. |
| 942 | */ |
| 943 | void db_close(void){ |
| 944 | sqlite3_stmt *pStmt; |
| 945 | if( g.db==0 ) return; |
| 946 | while( pAllStmt ){ |
| 947 | db_finalize(pAllStmt); |
| 948 | } |
| 949 | db_end_transaction(1); |
| 950 | pStmt = 0; |
| 951 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -941,10 +941,29 @@ | |
| 941 | ** Close the database connection. |
| 942 | */ |
| 943 | void db_close(void){ |
| 944 | sqlite3_stmt *pStmt; |
| 945 | if( g.db==0 ) return; |
| 946 | if( g.fSqlTrace ){ |
| 947 | int cur, hiwtr; |
| 948 | sqlite3_db_status(g.db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &hiwtr, 0); |
| 949 | fprintf(stderr, "-- LOOKASIDE_USED %10d %10d\n", cur, hiwtr); |
| 950 | sqlite3_db_status(g.db, SQLITE_DBSTATUS_CACHE_USED, &cur, &hiwtr, 0); |
| 951 | fprintf(stderr, "-- CACHE_USED %10d\n", cur); |
| 952 | sqlite3_db_status(g.db, SQLITE_DBSTATUS_SCHEMA_USED, &cur, &hiwtr, 0); |
| 953 | fprintf(stderr, "-- SCHEMA_USED %10d\n", cur); |
| 954 | sqlite3_db_status(g.db, SQLITE_DBSTATUS_STMT_USED, &cur, &hiwtr, 0); |
| 955 | fprintf(stderr, "-- STMT_USED %10d\n", cur); |
| 956 | sqlite3_status(SQLITE_STATUS_MEMORY_USED, &cur, &hiwtr, 0); |
| 957 | fprintf(stderr, "-- MEMORY_USED %10d %10d\n", cur, hiwtr); |
| 958 | sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &cur, &hiwtr, 0); |
| 959 | fprintf(stderr, "-- MALLOC_SIZE %10d\n", hiwtr); |
| 960 | sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &cur, &hiwtr, 0); |
| 961 | fprintf(stderr, "-- MALLOC_COUNT %10d %10d\n", cur, hiwtr); |
| 962 | sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &cur, &hiwtr, 0); |
| 963 | fprintf(stderr, "-- PCACHE_OVFLOW %10d %10d\n", cur, hiwtr); |
| 964 | } |
| 965 | while( pAllStmt ){ |
| 966 | db_finalize(pAllStmt); |
| 967 | } |
| 968 | db_end_transaction(1); |
| 969 | pStmt = 0; |
| 970 |