From: drh Date: Thu, 26 Jan 2017 01:54:39 +0000 (+0000) Subject: Enhancements to the kvtest utility program. Add the --jmode option. X-Git-Tag: version-3.17.0~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b15f6e11bad7e8faeef497aadf6b5df8bf229c4;p=thirdparty%2Fsqlite.git Enhancements to the kvtest utility program. Add the --jmode option. Improved output formatting. FossilOrigin-Name: 62a4851ccf88837d1c16dae8204f7f264e80e3c9 --- diff --git a/manifest b/manifest index 70cd2eef66..46dc00f8c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\sthe\sICU\sextension\sto\suse\sa\sstatic\sinitializer,\sas\sVC++\scomplains\sabout\na\sdynamic\sinitialization.\s\sMaybe\sthe\sdynamic\sstructure\sinitialization\sis\sa\nGCC\sextension. -D 2017-01-26T00:58:27.622 +C Enhancements\sto\sthe\skvtest\sutility\sprogram.\s\sAdd\sthe\s--jmode\soption.\s\nImproved\soutput\sformatting. +D 2017-01-26T01:54:39.591 F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da @@ -898,7 +898,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 d2d7c434023498237cf731df21ca0687bf103858 +F test/kvtest.c dc6e5e9066fa5e19f7368c7dfbe8c6b9642a706f F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302 @@ -1547,7 +1547,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 4801bd59a01dcc11a3eb9e776e7599b36f162d2a -R 11380cdeca896e71dff2973b03351379 +P 50e60cb44fd3687dde5551d02bad60c323beaabc +R 6c49e01bee6ced9ad603e50cc8404852 U drh -Z dca6dbb559e3b4e2e7d7b023b68a9123 +Z 5b3363ef063097392f2b7107d7fe03e8 diff --git a/manifest.uuid b/manifest.uuid index 6734156cad..7d6c267913 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50e60cb44fd3687dde5551d02bad60c323beaabc \ No newline at end of file +62a4851ccf88837d1c16dae8204f7f264e80e3c9 \ No newline at end of file diff --git a/test/kvtest.c b/test/kvtest.c index c82a3f899e..765a7ee968 100644 --- a/test/kvtest.c +++ b/test/kvtest.c @@ -79,16 +79,17 @@ 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" -" --asc Read blobs in ascending order\n" -" --blob-api Use the BLOB API\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" -" --mmap N Mmap as much as N bytes of DBFILE\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" +" --asc Read blobs in ascending order\n" +" --blob-api Use the BLOB API\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" +" --mmap N Mmap as much as N bytes of DBFILE\n" +" --jmode MODE Set MODE journal mode prior to starting\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 */ @@ -539,9 +540,6 @@ static int display_stats( displayLinuxIoStats(out); #endif - /* Do not remove this machine readable comment: extra-stats-output-here */ - - fprintf(out, "\n"); return 0; } @@ -562,7 +560,7 @@ static int runMain(int argc, char **argv){ int nCount = 1000; /* Number of blob fetch operations */ int nExtra = 0; /* Extra cycles */ int iKey = 1; /* Next blob key */ - int iMax = 1000; /* Largest allowed key */ + int iMax = 0; /* 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 */ @@ -578,6 +576,7 @@ static int runMain(int argc, char **argv){ sqlite3_int64 nTotal = 0; /* Total data read */ unsigned char *pData = 0; /* Content of the blob */ int nAlloc = 0; /* Space allocated for pData[] */ + const char *zJMode = 0; /* Journal mode */ assert( strcmp(argv[1],"run")==0 ); @@ -605,7 +604,6 @@ static int runMain(int argc, char **argv){ if( strcmp(z, "-max-id")==0 ){ if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]); iMax = integerValue(argv[++i]); - if( iMax<1 ) fatalError("the --max-id must be positive"); continue; } if( strcmp(z, "-start")==0 ){ @@ -619,6 +617,11 @@ static int runMain(int argc, char **argv){ iCache = integerValue(argv[++i]); continue; } + if( strcmp(z, "-jmode")==0 ){ + if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]); + zJMode = argv[++i]; + continue; + } if( strcmp(z, "-random")==0 ){ eOrder = ORDER_RANDOM; continue; @@ -667,8 +670,29 @@ static int runMain(int argc, char **argv){ } sqlite3_finalize(pStmt); pStmt = 0; + if( zJMode ){ + zSql = sqlite3_mprintf("PRAGMA journal_mode=%Q", zJMode); + sqlite3_exec(db, zSql, 0, 0, 0); + sqlite3_free(zSql); + } + sqlite3_prepare_v2(db, "PRAGMA journal_mode", -1, &pStmt, 0); + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + zJMode = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0)); + }else{ + zJMode = "???"; + } + sqlite3_finalize(pStmt); + if( iMax<=0 ){ + sqlite3_prepare_v2(db, "SELECT max(k) FROM kv", -1, &pStmt, 0); + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + iMax = sqlite3_column_int(pStmt, 0); + } + sqlite3_finalize(pStmt); + } + pStmt = 0; sqlite3_exec(db, "BEGIN", 0, 0, 0); } + if( iMax<=0 ) iMax = 1000; for(i=0; i