From: drh Date: Thu, 29 Dec 2016 14:44:43 +0000 (+0000) Subject: Improvements to the kvtest.c utility. Added the --cache-size option. X-Git-Tag: version-3.16.0~11^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61c565f63bbf5959160230ee481689b7b4745d9a;p=thirdparty%2Fsqlite.git Improvements to the kvtest.c utility. Added the --cache-size option. Additional reporting of version and settings at the end of "./kvtest run". FossilOrigin-Name: f6fcac6ae8b3bffee6bf994eef2064affd301a95 --- diff --git a/manifest b/manifest index d07e3a5fa2..56f5c02cde 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\skvtest.c\stest\sprogram\sfor\smeasuring\skey/value\sread\sperformance\sunder\nvarious\sscenarios. -D 2016-12-29T03:57:43.130 +C Improvements\sto\sthe\skvtest.c\sutility.\s\sAdded\sthe\s--cache-size\soption.\nAdditional\sreporting\sof\sversion\sand\ssettings\sat\sthe\send\sof\s"./kvtest\srun". +D 2016-12-29T14:44:43.614 F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da @@ -894,7 +894,7 @@ F test/json101.test c0897616f32d95431f37fd291cb78742181980ac F test/json102.test bf3fe7a706d30936a76a0f7a0375e1e8e73aff5a F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0 F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff -F test/kvtest.c 1f8e6f0352ebb0ef4179cd7968af594eee130d57 +F test/kvtest.c c3dac524f2eb0f73dbeea6c20f5154cfeaf17cbb F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302 @@ -1540,10 +1540,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a6af06f164b1f65779e2171ec4946119c66f9be8 -R a9bf163ca1249527027c884b8ea94c96 -T *branch * kvtest -T *sym-kvtest * -T -sym-trunk * +P 489e0787c1ea47963174387e8ade6295ceff568e +R a988144fafa83a0cd326685ae38da518 U drh -Z fb835c04c55072b05b31100f6eb7b616 +Z 4424d9424f7545651642c0148887a562 diff --git a/manifest.uuid b/manifest.uuid index 437dcdf57b..a2cbdb5225 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -489e0787c1ea47963174387e8ade6295ceff568e \ No newline at end of file +f6fcac6ae8b3bffee6bf994eef2064affd301a95 \ No newline at end of file diff --git a/test/kvtest.c b/test/kvtest.c index 9b9a0c3d40..94e15e4e16 100644 --- a/test/kvtest.c +++ b/test/kvtest.c @@ -36,11 +36,13 @@ static const char zHelp[] = " Run a performance test. DBFILE can be either the name of a\n" " database or a directory containing sample files. Options:\n" "\n" -" --count N Read N blobs\n" +" --asc Read blobs in ascending order\n" " --blob-api Use the BLOB API\n" -" --random Read blobs in a random order\n" +" --cache-size N Database cache size\n" +" --count N Read N blobs\n" " --desc Read blobs in descending order\n" " --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" ; @@ -314,6 +316,8 @@ static int runMain(int argc, char **argv){ int nExtra = 0; /* Extra cycles */ int iKey = 1; /* Next blob key */ int iMax = 1000; /* Largest allowed key */ + 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 eOrder = ORDER_ASC; /* Access order */ sqlite3 *db = 0; /* Database connection */ @@ -354,6 +358,11 @@ static int runMain(int argc, char **argv){ if( iKey<1 ) fatalError("the --start must be positive"); continue; } + if( strcmp(z, "-cache-size")==0 ){ + if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]); + iCache = atoi(argv[++i]); + continue; + } if( strcmp(z, "-random")==0 ){ eOrder = ORDER_RANDOM; continue; @@ -374,10 +383,28 @@ static int runMain(int argc, char **argv){ } tmStart = timeOfDay(); if( eType==PATH_DB ){ + char *zSql; rc = sqlite3_open(zDb, &db); if( rc ){ fatalError("cannot open database \"%s\": %s", zDb, sqlite3_errmsg(db)); } + zSql = sqlite3_mprintf("PRAGMA cache_size=%d", iCache); + sqlite3_exec(db, zSql, 0, 0, 0); + sqlite3_free(zSql); + pStmt = 0; + sqlite3_prepare_v2(db, "PRAGMA page_size", -1, &pStmt, 0); + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + iPagesize = sqlite3_column_int(pStmt, 0); + } + sqlite3_finalize(pStmt); + sqlite3_prepare_v2(db, "PRAGMA cache_size", -1, &pStmt, 0); + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + iCache = sqlite3_column_int(pStmt, 0); + }else{ + iCache = 0; + } + sqlite3_finalize(pStmt); + pStmt = 0; sqlite3_exec(db, "BEGIN", 0, 0, 0); } for(i=0; i