-C Get\sthe\s"--testset\srtree"\soption\sworking\son\sspeedtest1.\s\sAdd\sthe\s--rtree,\n--lookaside,\sand\s--clang\soptions\sto\sthe\sspeed-check.sh\sscript.
-D 2017-01-20T16:09:12.221
+C Add\soption\s"--stats"\sto\stest\sprogram\skvtest.\sSpecifying\s--stats\scauses\skvtest\nto\soutput\sinformation\ssimilar\sto\sthe\sshell\stool\soption\sof\sthe\ssame\sname.
+D 2017-01-20T16:46:20.421
F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
F test/json102.test bf3fe7a706d30936a76a0f7a0375e1e8e73aff5a
F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
-F test/kvtest.c 2c66ddefcd03c2caa337f6dd79e6c82368af83df
+F test/kvtest.c da3fddb003221d3d9726afd959d9c6017516fd02
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 52a61967d920047ea0b4409b79793e05c0128964
-R 4e64e669335e5bcf79eed63ea8c1840b
-U drh
-Z 6f7214599f293ddc9e6d41b975d33fdf
+P 87b640c8d07a76b2bc7e896e01965cc09e06f77b
+R b9affb78955ec88bf34da37dcc1dd9ef
+U dan
+Z 3096b993434f8157eb2ffff3d1e5a264
" --max-id N Maximum blob key to use\n"
" --random Read blobs in a random order\n"
" --start N Start reading with this blob key\n"
+" --stats Output operating stats before exiting\n"
;
/* Reference resources used */
return t;
}
+#ifdef __linux__
+/*
+** Attempt to display I/O stats on Linux using /proc/PID/io
+*/
+static void displayLinuxIoStats(FILE *out){
+ FILE *in;
+ char z[200];
+ sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid());
+ in = fopen(z, "rb");
+ if( in==0 ) return;
+ while( fgets(z, sizeof(z), in)!=0 ){
+ static const struct {
+ const char *zPattern;
+ const char *zDesc;
+ } aTrans[] = {
+ { "rchar: ", "Bytes received by read():" },
+ { "wchar: ", "Bytes sent to write():" },
+ { "syscr: ", "Read() system calls:" },
+ { "syscw: ", "Write() system calls:" },
+ { "read_bytes: ", "Bytes read from storage:" },
+ { "write_bytes: ", "Bytes written to storage:" },
+ { "cancelled_write_bytes: ", "Cancelled write bytes:" },
+ };
+ int i;
+ for(i=0; i<sizeof(aTrans)/sizeof(aTrans[0]); i++){
+ int n = (int)strlen(aTrans[i].zPattern);
+ if( strncmp(aTrans[i].zPattern, z, n)==0 ){
+ fprintf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
+ break;
+ }
+ }
+ }
+ fclose(in);
+}
+#endif
+
+/*
+** Display memory stats.
+*/
+static int display_stats(
+ sqlite3 *db, /* Database to query */
+ int bReset /* True to reset SQLite stats */
+){
+ int iCur;
+ int iHiwtr;
+ FILE *out = stdout;
+
+ fprintf(out, "\n");
+
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
+ fprintf(out,
+ "Memory Used: %d (max %d) bytes\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
+ fprintf(out, "Number of Outstanding Allocations: %d (max %d)\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
+ fprintf(out,
+ "Number of Pcache Pages Used: %d (max %d) pages\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
+ fprintf(out,
+ "Number of Pcache Overflow Bytes: %d (max %d) bytes\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
+ fprintf(out,
+ "Number of Scratch Allocations Used: %d (max %d)\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
+ fprintf(out,
+ "Number of Scratch Overflow Bytes: %d (max %d) bytes\n",
+ iCur, iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
+ fprintf(out, "Largest Allocation: %d bytes\n",
+ iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
+ fprintf(out, "Largest Pcache Allocation: %d bytes\n",
+ iHiwtr);
+ iHiwtr = iCur = -1;
+ sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
+ fprintf(out, "Largest Scratch Allocation: %d bytes\n",
+ iHiwtr);
+
+ iHiwtr = iCur = -1;
+ sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
+ fprintf(out, "Pager Heap Usage: %d bytes\n",
+ iCur);
+ iHiwtr = iCur = -1;
+ sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
+ fprintf(out, "Page cache hits: %d\n", iCur);
+ iHiwtr = iCur = -1;
+ sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
+ fprintf(out, "Page cache misses: %d\n", iCur);
+ iHiwtr = iCur = -1;
+ sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
+ fprintf(out, "Page cache writes: %d\n", iCur);
+ iHiwtr = iCur = -1;
+
+#ifdef __linux__
+ displayLinuxIoStats(out);
+#endif
+
+ /* Do not remove this machine readable comment: extra-stats-output-here */
+
+ fprintf(out, "\n");
+ return 0;
+}
+
/* Blob access order */
#define ORDER_ASC 1
#define ORDER_DESC 2
int iPagesize = 0; /* Database page size */
int iCache = 1000; /* Database cache size in kibibytes */
int bBlobApi = 0; /* Use the incremental blob I/O API */
+ int bStats = 0; /* Print stats before exiting */
int eOrder = ORDER_ASC; /* Access order */
sqlite3 *db = 0; /* Database connection */
sqlite3_stmt *pStmt = 0; /* Prepared statement for SQL access */
bBlobApi = 1;
continue;
}
+ if( strcmp(z, "-stats")==0 ){
+ bStats = 1;
+ continue;
+ }
fatalError("unknown option: \"%s\"", argv[i]);
}
tmStart = timeOfDay();
}
if( pStmt ) sqlite3_finalize(pStmt);
if( pBlob ) sqlite3_blob_close(pBlob);
+ if( bStats ){
+ display_stats(db, 0);
+ }
if( db ) sqlite3_close(db);
tmElapsed = timeOfDay() - tmStart;
if( nExtra ){